MCPcopy Index your code
hub / github.com/rsms/inter / getUnicodeMap

Function getUnicodeMap

misc/tools/subset.py:329–338  ·  view source on GitHub ↗
(font :ttLib.TTFont)

Source from the content-addressed store, hash-verified

327
328
329def getUnicodeMap(font :ttLib.TTFont) -> {int:str} : # codepoint=>glyphname
330 # https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6cmap.html
331 bestCodeSubTable = None
332 bestCodeSubTableFormat = 0
333 for st in font['cmap'].tables:
334 if st.platformID == 0: # 0=unicode, 1=mac, 2=(reserved), 3=microsoft
335 if st.format > bestCodeSubTableFormat:
336 bestCodeSubTable = st
337 bestCodeSubTableFormat = st.format
338 return bestCodeSubTable.cmap
339
340
341def genCompactCodepointRanges(codepoints :[int], groupAllThreshold :int) -> str:

Callers 2

subset_fontFunction · 0.85
genCSSFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…