Skip to content

Commit

Permalink
create_font: Add minimum recommended characters
Browse files Browse the repository at this point in the history
Specifically add notdef, null, CR and space. Space is hardcoded to
a width of 1024. Todo: Space width should be a config yaml option.

The font rendering systems are supposed to fallback to the space width
in the next available fallback font, but it doesn't work reliably.

Workaround for: 13rac1/emojione-color-font#2
Caused by: https://bugzilla.gnome.org/show_bug.cgi?id=757785
Related: 13rac1/emojione-color-font#17
  • Loading branch information
13rac1 committed Mar 18, 2016
1 parent d78dbf4 commit 9c32d91
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
`scfbuild` creates *SVG in OpenType* color fonts directly from a set of source
SVG files greatly simplifying the process of creating a custom color font.

Regular color and standard character [glyph][1] are named by [Unicode][2] code
Regular color and standard character [glyphs][1] are named by [Unicode][2] code
point (e.g. `1f60e.svg`). [Ligatures][3] are named by code points separated
by a hyphen `-` (e.g.`1f441-1f5e8.svg`). Note: Color glyphs cannot exist alone,
they must replace existing standard glyphs.
Expand Down
14 changes: 12 additions & 2 deletions scfbuild/fforge.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,19 @@ def create_font():
font.addLookup('liga', 'gsub_ligature', (), feature_script_lang)
font.addLookupSubtable('liga', 'liga')

# Add required font characters
glyph = font.createChar(0x0, '.null')
# Add all recommended font characters
# Reference: https://www.microsoft.com/typography/otspec/recom.htm
glyph = font.createChar(-1, '.notdef')
glyph.width = 0
# @todo Needs a default notdef glyph
glyph = font.createChar(0x0, '.null')
glyph.width = 1024
glyph = font.createChar(0xD, 'CR')
# @todo: Add space width to config yaml
glyph.width = 1024
glyph = font.createChar(0x20, 'space')
# Half-width space
glyph.width = 1024
glyph = font.createChar(ZWJ_INT)
glyph.width = 0
glyph = font.createChar(VS16_INT)
Expand Down
1 change: 1 addition & 0 deletions scfbuild/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def main():
# -i --input - Input file instead of making a new one.
# -t --type TTF/WOFF
# --remove-unused
# --generate-conf

args = parser.parse_args()

Expand Down

0 comments on commit 9c32d91

Please sign in to comment.