1
1
mirror of https://github.com/rsms/inter.git synced 2024-11-26 23:56:59 +03:00

Removes math codepoint from some enclosed glyphs and removed upsilonlatin.001

The following glyphs have been assigned new private-use codepoints:
- plus.circled      E15F
- minus.circled     E160
- multiply.circled  E161
- divide.circled    E162

upsilonlatin.001 has been removed (unused glyph.)

closes #250
This commit is contained in:
Rasmus Andersson 2020-04-04 12:06:12 -07:00
parent 6528f926dd
commit 4519bffb7c
2 changed files with 68 additions and 717 deletions

View File

@ -1,18 +1,24 @@
#
# Assigns private-use codepoints to glyphs which are not mapped
# to any Unicode codepoints.
#
# This script will ignore glyphs which name starts with "." as well as
# empty glyphs and glyphs which are not exported.
#
#MenuTitle: Assign fallback codepoints
# -*- coding: utf-8 -*-
__doc__="""
Assigns private-use codepoints to glyphs which are not mapped
to any Unicode codepoints.
This script will ignore glyphs:
- glyphs which are not exported
- glyphs which name starts with "."
- glyphs which name ends with ".case"
- empty glyphs
"""
import sys
from collections import OrderedDict
DRY_RUN = True
DRY_RUN = False
font = Glyphs.font
font.disableUpdateInterface()
def isEmpty(g):
for master in g.parent.masters:
layer = g.layers[master.id]
@ -20,6 +26,18 @@ def isEmpty(g):
return False
return True
def includeGlyph(g):
if not g.export:
return False
if g.name[0] == '.':
return False
if g.name.endswith(".case"):
return False
# finally, return true if the glyph has no codepoint assigned
return g.unicodes is None or len(g.unicodes) == 0
try:
# find next unallocated private-use codepoint
nextcp = 0xE000
@ -40,8 +58,7 @@ try:
# assign private-use codepoints to glyphs that have no existing unicode mapping
for g in font.glyphs:
# only care for glyphs which are being exported (also ignore "special" glyphs)
if g.export and g.name[0] != '.' and (g.unicodes is None or len(g.unicodes) == 0):
if includeGlyph(g):
# error on empty glyphs -- there should be no unmapped empty glyphs
if isEmpty(g):
sys.stderr.write('ERR: glyph %r is empty but has no unicode mapping (skipping)\n' % g.name)

File diff suppressed because it is too large Load Diff