• Stars
    star
    143
  • Rank 256,953 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created over 11 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python script to draw all the box drawing characters and block elements based on parameters.

boxDrawing.py

Soon after the first public release of Source Code Pro, users noted a lack of Box Drawing Characters. Fortunately, this flaw could be remedied soon afterโ€”the whole set of Box Drawing Characters, plus all of the Block Elements are now part of Source Code Pro.

Source Code Pro is a typeface family intended for both programmers and designers. It has a fairly wide range of weights, therefore it was agreed to adjust the Box Drawing Characters in their stem widths, to make for a better corresponding appearance. The reasoning behind this decision is that everyone will benefit: The programmer will like the screen display adjusted to the chosen text weight. The graphic designer will appreciate a multitude of combination possibilities; and an unseen dynamic range of drawing boxes.

All that is why this script was written. Drawing those generic glyphs by hand is not an amazing or creativity-challenging task. Much more fun is derived from modifying a script, which is capable of generating the most unexpected variations of Box Drawing Charactersโ€”over and over.

What does this script do?

This script will draw the complete ranges of Box Drawing Characters (U+2500โ€“U+257F) and Block Elements (U+2580โ€“U+259F) in the font editor of your choice.
The design of those characters is based on a handful of parameters, which can be changed in the script file itself. Feel free to create Box Drawing Characters that are longer than usual; exceedingly wide, fat (both?); or hairline-thin.

Time was spent to make this script compatible with the triumvirate of commercial font editing applications; this means that this script will run in RoboFont, Glyphs, and even FontLab without any modifications. It is also possible to run the script straight from the command line, which will generate a new UFO file right to your desktop.

(NB: FontLab 5 can no longer be tested because macOS 10.15 does not run 32-bit applications).

Tested versions:
Robofont: Version Version 3.4b (build 2003232105) Glyphs: Version 2.6.1 (1230)

Dependencies:

  • When using Glyphs or FontLab, Robofab must be installed and working.

  • When using Glyphs, please make sure you have the GSPen.py and objectsGS.py modules installed.

  • When running the script from the command line, the FontParts Python module must be installed.

What does this script not do?

This script is not for adding Box Drawing Characters to existing, compiled fonts.
It is assumed you have type design software, and font source data available; or at least know what to do with a UFO file.

What are Box Drawing Characters?

Box Drawing Unicode range 2500-257F and Block Elements Unicode range 2580-259F:

0 1 2 3 4 5 6 7 8 9 A B C D E F
U+250x โ”€ โ” โ”‚ โ”ƒ โ”„ โ”… โ”† โ”‡ โ”ˆ โ”‰ โ”Š โ”‹ โ”Œ โ” โ”Ž โ”
U+251x โ” โ”‘ โ”’ โ”“ โ”” โ”• โ”– โ”— โ”˜ โ”™ โ”š โ”› โ”œ โ” โ”ž โ”Ÿ
U+252x โ”  โ”ก โ”ข โ”ฃ โ”ค โ”ฅ โ”ฆ โ”ง โ”จ โ”ฉ โ”ช โ”ซ โ”ฌ โ”ญ โ”ฎ โ”ฏ
U+253x โ”ฐ โ”ฑ โ”ฒ โ”ณ โ”ด โ”ต โ”ถ โ”ท โ”ธ โ”น โ”บ โ”ป โ”ผ โ”ฝ โ”พ โ”ฟ
U+254x โ•€ โ• โ•‚ โ•ƒ โ•„ โ•… โ•† โ•‡ โ•ˆ โ•‰ โ•Š โ•‹ โ•Œ โ• โ•Ž โ•
U+255x โ• โ•‘ โ•’ โ•“ โ•” โ•• โ•– โ•— โ•˜ โ•™ โ•š โ•› โ•œ โ• โ•ž โ•Ÿ
U+256x โ•  โ•ก โ•ข โ•ฃ โ•ค โ•ฅ โ•ฆ โ•ง โ•จ โ•ฉ โ•ช โ•ซ โ•ฌ โ•ญ โ•ฎ โ•ฏ
U+257x โ•ฐ โ•ฑ โ•ฒ โ•ณ โ•ด โ•ต โ•ถ โ•ท โ•ธ โ•น โ•บ โ•ป โ•ผ โ•ฝ โ•พ โ•ฟ
U+258x โ–€ โ– โ–‚ โ–ƒ โ–„ โ–… โ–† โ–‡ โ–ˆ โ–‰ โ–Š โ–‹ โ–Œ โ– โ–Ž โ–
U+259x โ– โ–‘ โ–’ โ–“ โ–” โ–• โ–– โ–— โ–˜ โ–™ โ–š โ–› โ–œ โ– โ–ž โ–Ÿ

Both Box Drawing Characters and Block Elements are mostly at home in the world of text-based UI; you might remember brilliant examples from MS-DOS Defrag or ScanDisk.

    โ”Œโ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”Œโ”€โ”€โ”€โ”˜ โ”‚ Beautiful  โ”‚  
โ”‚     โ”‚ box.       โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•–
โ”‚     โ•ฐโ”€โ”ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค  โ”‚ Another    โ•Ÿโ”
โ”‚       โ”ƒ The same โ”‚  โ”‚ quite nice โ•‘โ”‚
โ”‚       โ”ƒ ole box. โ”‚  โ”‚ box.       โ•‘โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ธโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ•˜โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       

Box Drawing Characters can also be used for graphic design. As an example, see the โ€œsource codeโ€ (pun) of the Adobe Type Team holiday card 2012:

โ•”โ•*โ•“โ”€โ•ญโ•โ•ฎโ•“โ”€o*โ€บโ”โ”โ”‘โ•ป โ–ฒ,โ”Œโ”€ยป
โ•šโ•โ•—โ•‘โ•โ•ฝโ”…โ•ˆโ•™โ”€โ•–ยก โ”†0โ”†โ•ฝโ•ฒโ•ฟ โ”•โ”โ”“
โ•šโ•โ•œโ•™โ”โ•นยฉโ•นโ•šโ•โ•ฑโ•ณโˆ™โ”•โ•โ”™โ•ต=โ•น_โ””โ”€โ”›
โ•ฆโ”‰โ•ดโ•“โ”€โ•ฎโ•“โ”€ โ•ฑโ•ณยคโ•ณโ•ฒโ”• โ”Žโ”€โ”Žโ”ฌโ”ฌโ”’โ€ข
โ•‘ โ•—โ•‘โ”€โ•ฎโ•ฌ(โ€ขโ•ฑโˆ‘โ•ณษ”โ•ฒยกสปโ”ฃโ•ธ || โ”’
โ•™โ”€ยฉโ—Š โ—Šโ•™โ”€โ•ฑโ•ณโ•ณโ…“โ•ณโ•ณโ•ฒโ”†โ”–โ”€:โ”—โ”› โ”ธ
โ”Žโ•ฒ โ•ทโ•ญโ”€โ”จ?โ•ฑโ•ณยฟโ•ณโ•ณโ–ฒโ•ฒโ™ชโ•”โ•โ•ก****
โ”ƒโ•ฒโ•ฒโ”ƒโ”ƒโ”€โ•ฎโ•ฑโ†‘โ•ณโ•ณโ•ณแปฃโ•ณโ•ณโ•ฒโ•šโ•โ•—from
โ•ต Hโ”šโ•ฐโ”€แต’โ•ฑโ•ณโ•ณโˆžโ•ณโ•ณโ•ณยคโ•ฒโ•žโ•โ•theโ†“
โ†“โ•ŽOโ”Šโ—Šหˆโ•ฑโ•ณโ—‰โ•ณ%โ•ณโ•ณ=โ•ณโ•ณโ•ฒโ—†โ•ฆโ•โ•ฆโ•]
Hโ•ŽLโ”Šโ”€โ•ฑโ™ชโ•ณโ•ณสทโ•ณ โˆซโ•ณ ยงโ•ฒโ”Šโ•‘Aโ•‘โ„ข]
Aโ•ŽIโ”Šโ•โ•ฑโ•ณโˆ‚โ•ณโ•ณโ—†โ•ณโ•ณโ•ณฮฉโ•ณ โ•ฒโ”ŠDโ”Šโ•โ•—
Pโ”€Dโ”€โ”€โ•ฑโ•ณโ•ณยถโ•ณ โ•ณ$โ•ณ  ยคโ•ณโ”ŠOโ”ŠTโ•‘
Pโ•‘Aโ”Šโ•ฑโ•ณ ร˜โ•ณโ•ณฦ’โ•ณโ•ณโ•ณโ˜‘โ•ณ  โ•ฒBโ”ŠYโ•‘
Yโ•‘Yโ”Šโ•ฑยคโ•ณโ•ณล“โ•ณโ•ณโ•ณแน‚ โ•ณโ•ณ| โ•ฒEโ”ŠPโ•‘
โ”‚โ”Sโ•ฑโ•ณโ•ณโ•ณหฃโ•ณโ•ณร—โ•ณโ•ณโ•ณโ—† โ•ณยคโ•ณโ•ฒโ”ŠEโ”‚
โ†“ !!โ”Ÿโ•ฅโ”€โ•ฏโ”โ•‡โ”ฏโ–ˆโ”ฏโ•‡โ”‘โ–šโ”‚โ”‡โ”€โ”€โ”ดโ”€โ”Š
   โ•ถโ•โ•โ”Žโ”˜โ”‚โ”โ”ตโ”ผโ”ถโ”โ”‚โ”ˆโ•ขTEAM<โ•ฏ
   โ•บโ”โ”‚โ”ƒโ–‘โ–’โ–“โ–Œ!โ–โ–“โ–’โ–‘โ”ƒโ”‚โ”‚โ”ผโ˜‘โ”˜โ•ณ

The Project Page has some more examples for Box Drawing Characters in use (using Source Code Pro as a web font).

Usage:

  • Open font editor of your choice (one of the three mentioned above).
  • Open the boxDrawing.py script file in your font editor; or move it (and boxDrawingRecipes.py) to your scripts folder.
  • Run.
  • Watch Box Drawing Characters emerge.
  • Done.

Alternate method:

  • Run the script on the command line.
  • A UFO full of Box Drawing Characters is created (given that FontParts is installed and working).

More Repositories

1

afdko

Adobe Font Development Kit for OpenType
C
1,043
star
2

cmap-resources

CMap Resources
Makefile
243
star
3

opentype-svg

Tools and sample files for making OpenType-SVG fonts
Python
210
star
4

agl-aglfn

AGL & AGLFN
92
star
5

Adobe-Japan1

The Adobe-Japan1-7 Character Collection
69
star
6

agl-specification

Adobe Glyph List Specification
63
star
7

kern-dump

Scripts for working with and analyzing kerning information
Python
60
star
8

keyboard-layouts

Keyboard layout conversion from XML-based .keylayout to Windows-compatible .klc
Python
56
star
9

fontlab-scripts

Python scripts for FontLab
Python
55
star
10

aots

Annotated OpenType Specification
XSLT
45
star
11

psautohint

A standalone version of AFDKOโ€™s autohinter
C
43
star
12

adobe-latin-charsets

Adobe Latin Character Sets
HTML
40
star
13

python-scripts

Command line Python scripts
Python
35
star
14

drawBotProofing

Python
31
star
15

python-modules

Python modules
Python
29
star
16

mapping-resources-pdf

Mapping Resources for PDF
Makefile
27
star
17

Adobe-KR

The Adobe-KR-9 Character Collection
25
star
18

Adobe-GB1

The Adobe-GB1-6 Character Collection
24
star
19

kernalytics-rf-ext

Robofont Extension for editing kerning in multiple UFOs
Python
24
star
20

perl-scripts

Command-line Perl Scripts
Perl
22
star
21

pancjkv-ivd-collection

PanCJKV IVD Collection (UNREGISTERED)
Perl
22
star
22

adjust-anchors-rf-ext

Python
19
star
23

font-tech-notes

Font Tech Notes ported from Adobe's DevNet site.
16
star
24

otf-making-benchmark

Compare makeotf with fontmake output
Python
15
star
25

robofont-scripts

Python scripts for RoboFont
Python
14
star
26

adobe-cyrillic-charsets

Adobe Cyrillic Character Sets
HTML
13
star
27

Adobe-CNS1

The Adobe-CNS1-7 Character Collection
12
star
28

pyots

Python bindings for OpenType Sanitizer via Python C Extension
Python
11
star
29

adobe-greek-charsets

Adobe Greek Character Sets
HTML
10
star
30

cffsubr

Standalone CFF subroutinizer based on AFDKO tx
Python
8
star
31

Adobe-Manga1

The Adobe-Manga1-0 Character Collection
6
star
32

shell-scripts

Scripts to run in the Terminal
Shell
4
star
33

ehandler.ps

PostScript error handler
PostScript
4
star
34

krname-ivd-collection

KRName IVD Collection
PostScript
3
star
35

psautohint-testdata

PostScript
1
star