diff --git a/Tests/tx_data/expected_output/cff2_vf.dcf.txt b/Tests/tx_data/expected_output/cff2_vf.dcf.txt new file mode 100644 index 000000000..7aff83186 --- /dev/null +++ b/Tests/tx_data/expected_output/cff2_vf.dcf.txt @@ -0,0 +1,309 @@ +### Header (00000000-00000004) +major =2 +minor =0 +hdrSize=5 +offSize=0 +### Top DICT Data (00000005-0000000d) + [0]={ + 58 CharStrings + 18 VarStore + 1336 FDArray +} +### VarStore (00000012-00000039) +length =38 +format = 1 +regionListOffset = 0000000c +subtableCount = 1 +--- subtableOffsets[index]={offset} +[0]={0000001c} +--- RegionList +axisCount = 1 +regionCount = 2 +--- RegionCoords[region,axis]={start,peak,end} +[0,0]={3,3,0} +[1,0]={0,1,1} +--- VarStoreSubtable[0] +itemCount = 0 +shortDeltaCount = 0 +regionIndexCount = 2 +--- RegionIndex[region]={index} +[0]={0} +[1]={1} +--- DeltaValue[item,region]={delta} + +### FDArray INDEX (00000538-00000544) +--- object[index]={value} +[0]={ + 119 1349 Private +} +### CharStrings INDEX (0000003a-00000537) +--- object[index]={value} +[0]={ + 0 50 570 50 -28 10 63 -38 -28 10 3 blend + hstem + 80 60 360 60 -35 20 70 -40 -35 20 3 blend + vstem + 80 hmoveto + 60 -35 20 1 blend + hlineto + 420 670 35 -20 7 -18 2 blend + rlineto + -60 35 -20 1 blend + hlineto + -420 -670 -35 20 -7 18 2 blend + rlineto + 480 hmoveto + -420 670 -35 20 7 -18 2 blend + rlineto + -60 35 -20 1 blend + hlineto + 420 -670 35 -20 -7 18 2 blend + rlineto + 60 -35 20 1 blend + hlineto + -420 50 -35 10 -28 10 2 blend + rmoveto + 570 360 -570 -360 63 -38 70 -20 -63 38 -70 20 4 blend + vlineto + -60 -50 35 -10 28 -10 2 blend + rmoveto + 480 670 7 -18 1 blend + -480 -670 -7 18 1 blend + hlineto +} +[1]={ + 0 55 164 46 410 -29 19 57 -58 -26 17 7 -1 4 blend + -20 hstemhm + 5 230 -230 648 7 5 -32 -20 32 20 -9 7 4 blend + hintmask[E8] + 5 7 5 1 blend + hmoveto + hintmask[F0] + 230 40 -32 -20 -20 19 2 blend + hlineto + -110 15 13 21 -9 0 2 blend + rlineto + -20 6 3 1 blend + hlineto + -100 -15 13 -4 9 0 2 blend + rlineto + -40 20 -19 1 blend + vlineto + 66 7 -11 1 blend + hmoveto + 47 -18 17 1 blend + hlineto + 204 599 -23 0 201 -599 7 -18 68 -16 6 -20 -10 -70 15 -42 -58 86 6 blend + rlineto + 93 -61 108 1 blend + hlineto + -230 675 1 7 9 -23 2 blend + rlineto + -60 40 -60 1 blend + hlineto + -232 -675 10 8 -9 23 2 blend + rlineto + 99 219 -11 4 28 -39 2 blend + rmoveto + 302 -7 10 1 blend + hlineto + -16 46 8 -9 -26 17 2 blend + rlineto + -270 -8 0 1 blend + hlineto + -16 -46 7 -1 26 -17 2 blend + rlineto + 213 -219 17 -39 -28 39 2 blend + rmoveto + 270 40 -22 53 -20 16 2 blend + hlineto + -124 15 10 -6 -9 0 2 blend + rlineto + -20 6 -65 1 blend + hlineto + -126 -15 6 18 9 0 2 blend + rlineto + -40 20 -16 1 blend + vlineto +} +[2]={ + 0 55 437 178 -50 50 5 20 5 20 5 20 5 20 5 20 5 20 5 20 5 20 5 20 5 20 5 20 5 20 5 20 5 20 -28 19 50 -48 -15 11 28 -9 -28 9 -7 18 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 33 blend + hstemhm + 24 52 180 90 180 52 1 -3 -33 41 58 -70 -60 108 58 -69 -33 40.5 6 blend + cntrmask[000070] + hintmask[BFFFF0] + 291 55 -1 4 -28 19 2 blend + rmoveto + -140 -15 13 -11 8 0 2 blend + rlineto + -40 300 40 20 -19 -32 59 -20 19 3 blend + vlineto + -140 15 13 -15 -8 0 2 blend + rlineto + -20 6 -33 1 blend + hlineto + -35 255 27 -36 28 -19 2 blend + rmoveto + -105 1 0 1 blend + 0 -104 -3 -101 1 0 -1 0 2 blend + vhcurveto + 96 -62 108 1 blend + hlineto + -3 103 1 0 -1 0 2 blend + 0 104 103 1 1 1 blend + vvcurveto + 50 7 -19 1 blend + vlineto + 105 -1 0 1 blend + 0 104 3 101 -1 0 1 0 2 blend + vhcurveto + -96 62 -108 1 blend + hlineto + 3 -103 -1 0 1 0 2 blend + 0 -104 -103 -1 0 1 blend + vvcurveto + -50 -7 18 1 blend + vlineto + 283 310 -20 84 35 -27 2 blend + rmoveto + -45 50 31 -37 -28 9 2 blend + rlineto + hintmask[C00070] + 32 -178 -13 -8 15 -11 2 blend + rlineto + 56 -32 37 1 blend + hlineto + hintmask[A00070] + -8 178 -2 7 -15 11 2 blend + rlineto + -546 12 -57 1 blend + hlineto + hintmask[C00070] + -8 -178 -2 6 15 -11 2 blend + rlineto + 56 -32 38 1 blend + hlineto + hintmask[A00070] + 32 178 -45 -50 -13 -8 -15 11 31 -38 28 -9 4 blend + rlineto + 476 20 60 1 blend + hlineto +} +[3]={ + 0 55 364 55 -35 35 -29 11 54 -14 -29 16 15 -16 -15 16 5 blend + hstemhm + 45 117 -47 36 -36 47 -47 116 316 77 -77 150 -120 47 0 -22 -3 1 25 -13 -25 8 25 -8 -25 13 25 -13 -2 -6 0 -20 -51 105 51 -105 -33 79 17 -22 -35 48 14 blend + hintmask[C500] + 329 40 26 -45 3 -5 2 blend + rmoveto + 49 -27 21 1 blend + hlineto + 190 434 11 -18 -7 18 2 blend + rlineto + -43 21 -17 1 blend + hlineto + -168 -385 -24 56 -25 90 2 blend + rlineto + 30 -20 11 1 blend + hlineto + -171 385 -30 54 25 -90 2 blend + rlineto + -79 51 -99 1 blend + hlineto + 192 -434 18 -8 7 -18 2 blend + rlineto + 218 -40 -9 -15 -3 5 2 blend + rmoveto + 80 -48 105 1 blend + hlineto + -2 45 -1 101 64 2 2 -2 -2 2 blend + vvcurveto + 54 -4 13 1 blend + vlineto + 64 -2 -2 1 blend + 1 101 2 2 1 blend + 2 45 vhcurveto + -75 49 -95 1 blend + hlineto + -5 -264 2 -10 4 -11 2 blend + rlineto + hintmask[9000] + 0 -210 -3 0 0 -2 2 blend + rlineto + -502 -17 38 1 blend + hmoveto + hintmask[8200] + 186 35 20 -18 -15 16 2 blend + hlineto + -80 20 -18 9 -14 -5 2 blend + rlineto + hintmask[9080] + -20 10 1 1 blend + hlineto + -86 -20 -12 8 14 5 2 blend + rlineto + -35 15 -16 1 blend + vlineto + 426 6 -17 1 blend + hmoveto + 226 35 -20 58 -15 16 2 blend + hlineto + -100 20 2 6 -14 0 2 blend + rlineto + -20 10 -76 1 blend + hlineto + -106 -20 8 12 14 0 2 blend + rlineto + hintmask[C400] + -35 15 -16 1 blend + vlineto + -356 16 5 1 blend + hmoveto + 47 210 -25 13 0 1 2 blend + hlineto + -10 264 4 -5 -4 12 2 blend + rlineto + -37 21 -8 1 blend + hlineto + hintmask[3000] + -474 4 -13 1 blend + vlineto + -70 439 -22 17 11 -3 2 blend + rmoveto + hintmask[4800] + 86 -20 12 7 14 0 2 blend + rlineto + 20 55 -15 -16 -29 16 2 blend + hlineto + hintmask[5040] + -106 -35 3 9 15 -16 2 blend + hlineto + 532 -20 4 14 14 0 2 blend + rmoveto + hintmask[4080] + 20 -15 28 1 blend + hlineto + hintmask[2080] + 100 20 -2 -6 -14 0 2 blend + rlineto + hintmask[4080] + 35 -15 16 1 blend + vlineto +} +### Private DICT (00000545-000005bb) + -15 15 474 13 40 13 10 13 84 13 10 15 45 20 2 -5 -2 5 -4 13 0 3 11 -28 0 3 -1 -5 0 3 1 -12 0 3 0 2 -2 5 3 -6 0 0 14 blend + BlueValues + -250 10 -5 18 0 0 2 blend + OtherBlues + -15 15 475 13 39 13 9 14 83 13 10 15 45 20 FamilyBlues + -249 10 FamilyOtherBlues + .0375 BlueScale + 0 BlueFuzz + 55 -29 19 1 blend + StdHW + 80 -52 110 1 blend + StdVW + 40 15 -20 20 -9 -1 2 blend + StemSnapH + 80 10 -52 110 -6 0 2 blend + StemSnapV diff --git a/Tests/tx_data/expected_output/cff2_vf.pfa b/Tests/tx_data/expected_output/cff2_vf.pfa index 6a5dd6029..efa32e39a 100644 --- a/Tests/tx_data/expected_output/cff2_vf.pfa +++ b/Tests/tx_data/expected_output/cff2_vf.pfa @@ -1,15 +1,15 @@ -%!FontType1-1.1: TestVarReadVariable-Roman 1.0 +%!FontType1-1.1: TestVF-Roman 1.0 %ADOt1write: (1.0.34) -%%BeginResource: font TestVarReadVariable-Roman +%%BeginResource: font TestVF-Roman 12 dict dup begin /FontType 1 def -/FontName /TestVarReadVariable-Roman def +/FontName /TestVF-Roman def /FontInfo 10 dict dup begin /version (1.0) def /Notice ( 2014 - 2017 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name Source. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.) def /Copyright ( 2014 - 2017 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name Source.) def -/FullName (Test VarRead Variable) def -/FamilyName (Test VarRead Variable) def +/FullName (Test VF) def +/FamilyName (Test VF) def /UnderlinePosition -75 def /FSType 0 def end def @@ -46,25 +46,35 @@ C3FFDB5BC9D1F365FE0705A6CE3A68618D88909C9D393BA015794DDB1E4413FC 9E230067967A1A32702BFD2F70E8FEBC99A576DDD10C20B0E29BF9BF3264F928 E3EA8544E47A13E3EE3335C0E5F4172491E78AEE043AD539BBB6F81F2408DC74 C9AA8E62155668BF1FF08BE002434036F98D02BF5FDE0CC3E30C449D2835F104 -AE8052E8FBCC0AD2C91531800D60087F71A97E1266A7180F0AEAC2E9026033D3 -B9925A90E5B292E98592AEB9BCAF2C281D848DD1D6B25D219373CC1B01F7DFEC -D963D774D46E07B4D5F23B3F95B1DAB8DDF874C74E9009E0CD7965E1DDC8DD63 -5726EBD927A1FDF360429553B6E66D4663757CFC625B856BDC4144E6C05BBA91 -D5D4735596200E7B8B4F1FA15A70875721E86E11B33C795AE9A2FA7A71B65851 -17BAF710EE8E02E8E2341A6775449EE1A4D883EFCA17F351146C4B6B6D77B85B -D30EB6834BC65DB94655CA2D297ED3552CE81D7835801B8C99C15206A6912FEF -73912CC0D685E8B035806EA1CCEFFD0F12306D4D6626B4855968A84DEC8525E7 -48193B6EA33C86670DA96B0747C8AFA1083E68917F6146BBC1FA9AC56883839E -0FC810DE0AA916446682EEE2D6D64D128163A4E89EEB67A62FFE2B819BB72D04 -8B3EDF83FEDC78FA81E6CAD38BEDBF581E9AB17778CAE81AF7AD2D3B48614C7D -76207EAB528D32902ACD990AC009ED5A125C4ADACED342428BE5CB2238A25780 -49D2411616F9D9082C89F995A9A1B881898606C7CA2FCA668B990335F2C489FE -B6E635D1C1A6F69627567B1C7416BDA2AD0070E7AAC9935E8B683868D3B0B432 -87E5F558A9B892B2622B192DF236EE8EECB32B75BC721B68F2ADBBC4B3BCC22F -9856590C1931C5FA25D12CBDEC375D0A6D5DB292C19AD43EF791B020B0670A36 -CF81142E9DE1000C43A545363D4FC006955C9BFB60636DC264DB692AB5732E2D -64F0D358F915D1BA4308F0508F9100DDAA50F314143E93C365B29678E1BC59B2 -383FF3212DB3963AF8280F73EE5F2599CA6250A9FF640166D3C5C0 +AE8052E8FBC21C4EDC17D30FFE342ACE28C71DA65B5424E323967AAFFF0AAB5E +1AA6973127756C8DF272527F471756E4835595648FF0AED53E165F745E229D9C +B39321DA1231EAB189EAE4F237A2721C1B52E17272D182BC9C540816CFCA8885 +C3469A19DA9399B1BF3A2B54C42F108676C173E04935743CD27E55F6C7EB5591 +776F0FDAF92D7139CAC14C1CFEC72C294DC67FE36E537946714ECA7E71EB1B8C +70AD1DEAFF25567B0FFDF8537D00A410F4C5ABAC79652BE571B768718CB16E27 +0D368AC463411C8D8471CA878CF07193294C9815C8032645321EA8FB0DDF44C9 +CC4740096580C65DE8A755A368EB12EF6B723C8CBE06C7155CEFD435D360420A +CDF358F793F09E5431D4963ADE42C5E32F797372CA72D9AAE7F5CE860C6A6912 +457AB6BA189D17F2EFCE9C67E2E64DD88574C5DE125BEFE11531055DD742FB18 +03CEE77A83F5E0739BF5A5FA609BE5E50D8D88710530F29C37F0B6CEBED17F33 +02C8BACA8004FBBFF904C02D0B585F0E8A0DE411405875486B46712D82AFEA58 +BFF8344ECEEFA860724E16BDE477CEE0D504AC3D89004E76F05D1BDCEFF34B23 +39A46FC8D315227701D5A50307C391FF7DEBC6CE8B6E20AF42A8772CB541EBA6 +FB0DC861D67F0CEA4717CCF7EEE194FDFA5C78D6E5AA0FDF96BB4E55CF5BC977 +4DCF22B04D10BAA4B917955E464DF562269EE1BC91457FD4597F501F3E075C79 +17F9D3E49E017B7A391B60A88F5AD2BBEC6681383E8DA01DE183F74A90CC32F1 +DC7E181B55C0E65205EBCAC79FF0B0DFC1BF78D0BE4C47CFD212A494D74231BB +B21FDC3F0D60BB5F3B2965F6A153EBBC1D06661D7A6374C83DC568C6525EB970 +D03F122EF8C78A400115CA41FE5B3AC674F3D4CE1FDD50863EF9C26AEC0459E8 +C1C25DAAE821518241D7C8D38474B28BD1E36D50BF2829C655D79A02FB05063E +8C90EAA3723A0F58DFB51E66250E8A4143CA52FE5048A7A79F5C74BFA7B7E5E6 +79A96EE88184A4A1AC5659BAE2A9277D5D0916E5CADD737E9D7DC9813EC3BB7E +5432179C6FB4F00FF343A13E7C89BA17F5C83BC468DB68F1110F68B09E94309F +9FBC2C7F9F09F11531FE07EF469F9EDC4C43F00D422A0EC290476E591DF98C5D +4D57324F1BEB16618799A6681854A7D942BBE9ECFF1066751DCC3A2D83B471B3 +958283CFFD98AF0F01E7DA1089BF9EDAA320261C265D13679FDEA080503F950C +C69837B88921C8BBCCE7E05B8878659B9917C1BF3052E3532A834D83D8CC00AB +C96E7E736B303C29FADAD5DEEBA0773FED5F0D216C2625075F89E3B0 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 diff --git a/Tests/tx_data/input/cff2_vf.otf b/Tests/tx_data/input/cff2_vf.otf index 525d5dce6..68633b61a 100644 Binary files a/Tests/tx_data/input/cff2_vf.otf and b/Tests/tx_data/input/cff2_vf.otf differ diff --git a/Tests/tx_test.py b/Tests/tx_test.py index 9f697e4a5..856be3031 100755 --- a/Tests/tx_test.py +++ b/Tests/tx_test.py @@ -196,3 +196,13 @@ def test_long_charstring_bug444(): actual_path = runner(CMD + ['-o', '0', '-f', 'CJK-VarTest.otf']) expected_path = _get_expected_path('CJK-VarTest.txt') assert differ([expected_path, actual_path, '-s', '## Filename']) + + +def test_many_hints_string_bug354(): + # The glyph T@gid002 has 33 hstem hints. This tests a bug where + # tx defined an array of only 6 operants. + # This is encountered only when wrinting to a VF CFF2. + cff2_path = runner(CMD + ['-o', 'cff2', '-f', 'cff2_vf.otf']) + dcf_txt_path = runner(CMD + ['-a', '-f', cff2_path, '-o', 'dcf']) + expected_path = _get_expected_path('cff2_vf.dcf.txt') + assert differ([expected_path, dcf_txt_path]) diff --git a/afdko/Tools/Programs/public/lib/api/cffwrite.h b/afdko/Tools/Programs/public/lib/api/cffwrite.h index bb3d8651c..2f41374a0 100644 --- a/afdko/Tools/Programs/public/lib/api/cffwrite.h +++ b/afdko/Tools/Programs/public/lib/api/cffwrite.h @@ -6,7 +6,7 @@ This software is licensed as OpenSource, under the Apache License, Version 2.0. #include "ctlshare.h" -#define CFW_VERSION CTL_MAKE_VERSION(1,0,51) +#define CFW_VERSION CTL_MAKE_VERSION(1,0,52) #include "absfont.h" diff --git a/afdko/Tools/Programs/public/lib/api/t2cstr.h b/afdko/Tools/Programs/public/lib/api/t2cstr.h index a82b7daad..460eecd3f 100644 --- a/afdko/Tools/Programs/public/lib/api/t2cstr.h +++ b/afdko/Tools/Programs/public/lib/api/t2cstr.h @@ -10,7 +10,7 @@ This software is licensed as OpenSource, under the Apache License, Version 2.0. #include "ctlshare.h" -#define T2C_VERSION CTL_MAKE_VERSION(1,0,20) +#define T2C_VERSION CTL_MAKE_VERSION(1,0,21) #include "absfont.h" diff --git a/afdko/Tools/Programs/public/lib/source/cffwrite/cffwrite.c b/afdko/Tools/Programs/public/lib/source/cffwrite/cffwrite.c index 3f76a0426..66508957a 100644 --- a/afdko/Tools/Programs/public/lib/source/cffwrite/cffwrite.c +++ b/afdko/Tools/Programs/public/lib/source/cffwrite/cffwrite.c @@ -730,15 +730,14 @@ static Offset calcFontOffsets(controlCtx h, cff_Font *font, Offset offset) { cfwCharsetGetOffset(g, font->iObject.charset, h->offset.charset); font->offset.Encoding = cfwEncodingGetOffset(g, font->iObject.Encoding, h->offset.Encoding); - font->offset.FDSelect = - cfwFdselectGetOffset(g, font->iObject.FDSelect, h->offset.FDSelect); + font->offset.FDSelect = + cfwFdselectGetOffset(g, font->iObject.FDSelect, h->offset.FDSelect); - if (font->size.VarStore > 0) { - font->offset.VarStore = offset; - offset += font->size.VarStore; - } - font->offset.CharStrings = offset; - font->offset.FDArray = font->offset.CharStrings + font->size.CharStrings; + if (font->size.VarStore > 0) { + font->offset.VarStore = h->offset.varStore; + } + font->offset.CharStrings = offset; + font->offset.FDArray = font->offset.CharStrings + font->size.CharStrings; font->offset.Private = font->offset.FDArray + font->size.FDArray; font->offset.Subrs = font->offset.Private + font->size.Private; /* Compute individual Private DICT offsets */ diff --git a/afdko/Tools/Programs/public/lib/source/t2cstr/t2cstr.c b/afdko/Tools/Programs/public/lib/source/t2cstr/t2cstr.c index 343121449..de1e5719c 100644 --- a/afdko/Tools/Programs/public/lib/source/t2cstr/t2cstr.c +++ b/afdko/Tools/Programs/public/lib/source/t2cstr/t2cstr.c @@ -75,7 +75,7 @@ struct _t2cCtx unsigned short numRegions; long blendCnt; abfOpEntry blendArray[CFF2_MAX_OP_STACK]; - abfBlendArg blendArgs[6]; + abfBlendArg blendArgs[T2_MAX_STEMS]; } stack; long maxOpStack; float BCA[TX_BCA_LENGTH]; /* BuildCharArray */