MCPcopy
hub / github.com/rsms/inter / genUnicodeRange

Function genUnicodeRange

misc/tools/subset.py:307–326  ·  view source on GitHub ↗
(codepoints :list)

Source from the content-addressed store, hash-verified

305
306
307def genUnicodeRange(codepoints :list) -> (set, str):
308 unicodes = set()
309 unicodeRange = []
310 for v in codepoints:
311 if isinstance(v, int):
312 unicodes.add(v)
313 unicodeRange.append('U+%04X' % v)
314 else:
315 first = 0
316 for v2 in v:
317 first = v2
318 break
319 last = 0
320 for v2 in v:
321 unicodes.add(v2)
322 last = v2
323 last += 1 # since unicode ranges are inclusive (but python ranges aren't)
324 unicodes.add(last)
325 unicodeRange.append('U+%04X-%04X' % (first,last))
326 return unicodes, ','.join(unicodeRange)
327
328
329def getUnicodeMap(font :ttLib.TTFont) -> {int:str} : # codepoint=>glyphname

Callers 2

subset_fontFunction · 0.85
genCSSFunction · 0.85

Calls 1

addMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…