def _makef4(): from fontio3.kerx import format4 sv = [ "00 00 00 06", # numClasses "00 00 00 14", # offset to class table "00 00 00 34", # offset to state array "00 00 00 58", # offset to entry table "00 00 00 70", # flags and offset to control point table # Class table starts here (offset = 0x0014 bytes) "00 02", # lookup format 2 "00 06 00 02 00 0C 00 01 00 00", # binary search header "00 0B 00 0A 00 04", # segment 0 -> class 4 "00 16 00 14 00 05", # segment 1 -> class 5 "FF FF FF FF FF FF", # guardian "00 00", # padding to 32-bit alignment (needed?) # State array starts here (offset = 0x0034 bytes) "00 00 00 00 00 00 00 00 00 01 00 00", # SOT "00 00 00 00 00 00 00 00 00 01 00 00", # SOL "00 00 00 00 00 02 00 00 00 01 00 03", # Saw first # Entry array starts here (offset = 0x0058 bytes) "00 00 00 00 FF FF", # entry 0 - NOP "00 02 80 00 FF FF", # entry 1 - mark and go to state "Saw first" "00 02 00 00 FF FF", # entry 2 - go to state "Saw first" "00 00 00 00 00 00", # entry 3 - do the attachment and go to state SOT # Control point array starts here (offset = 0x0070 bytes) "00 08 00 10" # control point entry 0 ] binData = utilities.fromhex(' '.join(sv)) return format4.Format4.frombytes(binData)
# Component table starts here (offset = 0x015C) "00 00", # component 0: base of ligature table "00 02", # component 1: offset to lig[2] (ff) "00 00", # component 2: offset to lig[0] (fi) "00 03", # component 3: delta from lig[0] (fi) to lig[3] (ffi) "00 05", # component 4: offset to lig[5] (special office lig) "00 01", # component 5: offset to lig[1] (fl) # Ligature table starts here (offset = 0x0168) "00 C0", # ligature 0: glyph 192 (fi) "00 C1", # ligature 1: glyph 193 (fl) "01 4A", # ligature 2: glyph 330 (ff) "01 4B", # ligagure 3: glyph 331 (ffi) "01 4C", # ligature 4: glyph 332 (ffl) "03 69" # ligature 5: glyph 873 (special office lig) ] _binData = utilities.fromhex(' '.join(_sv)) del _sv def _test(): import doctest doctest.testmod() if __name__ == "__main__": if __debug__: _test()
# # Test code # if 0: def __________________(): pass if __debug__: from fontio3 import utilities from fontio3.utilities import walker from io import StringIO _testingData = ( utilities.fromhex("00010000 0000 0000 0000 0000"), utilities.fromhex("00010002 0000 0000 0000 0000 0000"), utilities.fromhex("00010003 0000 0000 0000 0000 0000 0000 0000"), utilities.fromhex("DEADBEEF")) def _test(): import doctest doctest.testmod() if __name__ == "__main__": if __debug__: _test()
from fontio3.fontdata import mapmeta from fontio3.fontmath import matrix from fontio3.h2 import analyzer, hints_tt from fontio3.hints import hints_tt as hints_tt_old from fontio3.TSI import TSILoc, TSILowLevel # ----------------------------------------------------------------------------- # # Constants # # The following is to get around a computed CALL. Grrrr..... _fdef17_orig = utilities.fromhex("20 69 B0 40 61 B0 00 8B " "20 B1 2C C0 8A 8C B8 10 " "00 62 60 2B 0C 64 23 64 " "61 5C 58 B0 03 61 59") _fdef17_rewrite = utilities.fromhex("20 69 20 B0 01 51 58 B0 " "2C 1B 20 B0 02 54 58 B0 " "2D 1B 20 B0 03 54 58 B0 " "2E 1B B0 2F 59 59 59 2B " "0C 64 23 64 61 5C 58 B0 " "03 61 59") _fdef49_orig = utilities.fromhex("4B 53 58 20 B0 03 25 49 " "64 69 20 B0 05 26 B0 06 " "25 49 64 23 61 B0 80 62 " "B0 20 61 6A B0 0E 23 44 " "B0 04 26 10 B0 0E F6 8A " "10 B0 0E 23 44 B0 0E F6 "
# ----------------------------------------------------------------------------- # # Test code # if 0: def __________________(): pass if __debug__: from fontio3 import utilities s = utilities.fromhex("B1 19 02 2C B2 01 02 03 50 2D 2C 00 01 2D") _testingValues = (Fpgm(), Fpgm.frombytes(s)) del s def _test(): import doctest doctest.testmod() if __name__ == "__main__": _test()
# # Test code # if 0: def __________________(): pass if __debug__: from fontio3 import utilities _testingData = ( utilities.fromhex("03 00 03 00 00 FF 00 05 FE 00 07 FA 00 08"), utilities.fromhex("03 00 02 00 00 FF 00 05 FE 00"), utilities.fromhex("03 00 02 FF FF")) _testingValues = (Format3(), Format3({ 4: 255, 1: 255, 0: 255, 2: 255, 3: 255, 5: 254, 6: 254, 7: 250 }), Format3.frombytes(_testingData[0]))
# ----------------------------------------------------------------------------- # # Test code # if 0: def __________________(): pass if __debug__: from fontio3 import utilities b = utilities.fromhex("00 01 00 03 00 06 00 02 00 13 00 01 FF FF 00 03") _testingValues = (Gasp(), Gasp.frombytes(b)) del b def _test(): import doctest doctest.testmod() if __name__ == "__main__": if __debug__: _test()
fdkeys = sorted([x for x in self if isinstance(x, int)]) w.addGroup("B", [self[k] for k in fdkeys]) # ----------------------------------------------------------------------------- # # Test code # if 0: def __________________(): pass if __debug__: from fontio3 import utilities _testingData = (utilities.fromhex("00 FF FE FF FE 01"),) _testingValues = ( Format0(), Format0({3:1, 4:1, 5:1, 6:2, 7:2, 8:2, 0:0, 1:0, 2:0}, nGlyphs=9), Format0.frombytes(_testingData[0], nGlyphs=5)) def _test(): import doctest doctest.testmod() if __name__ == "__main__": if __debug__: _test()
# if 0: def __________________(): pass if __debug__: _cstv = ttcomponents._testingValues _stv = ttsimpleglyph._testingValues _testingValues = ( TTCompositeGlyph(), TTCompositeGlyph( bounds = ttbounds._testingValues[2], components = _cstv[1], # glyphs 100, 80 hintBytes = utilities.fromhex("00 01")), TTCompositeGlyph(components=_cstv[2]), # glyph 901 TTCompositeGlyph(components=_cstv[3]), # glyphs 902, 903 TTCompositeGlyph(components=_cstv[4]), # glyph 904 TTCompositeGlyph(components=_cstv[5])) # glyph 905 class _FakeEditor: def __init__(self, g): self.glyf = g def get(self, key): return self.glyf _fakeGlyf_1 = { 5: _testingValues[1], 80: _stv[1], 100: _stv[1]}
# # Test code # if 0: def __________________(): pass if __debug__: from fontio3 import utilities _cstv = ttcontours._testingValues _testingValues = [ TTSimpleGlyph(), TTSimpleGlyph(hintBytes=utilities.fromhex("00 01")), TTSimpleGlyph( contours = _cstv[1], hintBytes=utilities.fromhex("00 01"))] _testingValues[2] = _testingValues[2].recalculated() _testingValues = tuple(_testingValues) del _cstv def _test(): import doctest doctest.testmod() if __name__ == "__main__": if __debug__:
# ----------------------------------------------------------------------------- # # Test code # if 0: def __________________(): pass if __debug__: from fontio3 import utilities from fontio3.utilities import walker, writer _testingData = (utilities.fromhex("8B 00 F7 C0 02 8C 0C 00"), utilities.fromhex("F8 88 00 8B 16 8B 0C 00")) def _test(): import doctest doctest.testmod() if __name__ == "__main__": if __debug__: _test()