diff options
author | James Godfrey-Kittle <jamesgk@google.com> | 2015-04-27 17:40:58 -0700 |
---|---|---|
committer | James Godfrey-Kittle <jamesgk19@gmail.com> | 2015-04-27 17:40:58 -0700 |
commit | 03caa4051360c9da77ae1208075526f5e24ee704 (patch) | |
tree | 9c3934a2a1fb8e91877a770ef347908583a6af9e | |
parent | 3153a554bf3686d51043b5c2631b1d1a8bcdc540 (diff) | |
parent | 727e3852355b8c00386d81138b41416b27c84bd1 (diff) |
Merge pull request #9 from google/anchor-fix
Fix for dropped anchors
-rw-r--r-- | res/anchors_bold.json | 1092 | ||||
-rw-r--r-- | res/anchors_regular.json | 1092 | ||||
-rw-r--r-- | res/anchors_thin.json | 1092 | ||||
-rw-r--r-- | scripts/build-v2.py | 9 | ||||
-rw-r--r-- | scripts/lib/fontbuild/kerning.py | 27 | ||||
-rwxr-xr-x | scripts/lib/fontbuild/markFeature.py | 6 | ||||
-rw-r--r-- | scripts/lib/fontbuild/mix.py | 31 | ||||
-rw-r--r-- | src/v2/README.md | 6 | ||||
-rw-r--r-- | src/v2/get_dropped_anchors.py | 61 |
9 files changed, 3396 insertions, 20 deletions
diff --git a/res/anchors_bold.json b/res/anchors_bold.json new file mode 100644 index 0000000..b8f8956 --- /dev/null +++ b/res/anchors_bold.json @@ -0,0 +1,1092 @@ +{ + "Esh": { + "bottom": [ + 591, + 10 + ], + "top": [ + 591, + 1600 + ], + "top0315": [ + 1157, + 1600 + ] + }, + "Gbar": { + "bottom": [ + 726, + 0 + ], + "top": [ + 705, + 1600 + ], + "top0315": [ + 1466, + 1600 + ] + }, + "Ibar": { + "bottom": [ + 381, + 0 + ], + "top": [ + 381, + 1600 + ], + "top0315": [ + 761, + 1600 + ] + }, + "a_uni02DE": { + "bottom": [ + 467, + 22 + ], + "bottom_dd": [ + 1091, + -407 + ], + "markbottom": [ + 467, + 22 + ], + "ogonek": [ + 985, + 0 + ], + "rhalfring": [ + 691, + 1290 + ], + "top": [ + 540, + 1290 + ], + "top0315": [ + 1534, + 1290 + ], + "top_dd": [ + 1091, + 1600 + ] + }, + "acutedblnosp": { + "_marktop": [ + -661, + 1290 + ], + "mkmktop": [ + -661, + 1640 + ], + "parent_top": [ + -586, + 1379 + ] + }, + "acuterightnosp": { + "_marktop": [ + -105, + 1290 + ], + "mkmktop": [ + -105, + 1640 + ] + }, + "acutesubnosp": { + "_markbottom": [ + -613, + 0 + ], + "mkmkbottom_acc": [ + -613, + -390 + ] + }, + "bbar": { + "bottom": [ + 681, + -10 + ], + "cross": [ + 339, + 1302 + ], + "markbottom": [ + 681, + -10 + ], + "top": [ + 676, + 1600 + ], + "top0315": [ + 1237, + 1600 + ] + }, + "bridgeinvsubnosp": { + "_markbottom": [ + -577, + 0 + ], + "mkmkbottom_acc": [ + -577, + -486 + ] + }, + "circumflexnosp": { + "_marktop": [ + -579, + 1290 + ], + "mkmktop": [ + -579, + 1640 + ], + "parent_top": [ + -576, + 1389 + ] + }, + "circumflexsubnosp": { + "_bottom": [ + -576, + 0 + ], + "_markbottom": [ + -576, + 0 + ], + "mkmkbottom_acc": [ + -577, + -377 + ] + }, + "diaeresistonosnosp": { + "_marktop": [ + -591, + 1290 + ], + "mkmktop": [ + -591, + 1870 + ] + }, + "epsilon1": { + "bottom": [ + 597, + 0 + ], + "top": [ + 597, + 1290 + ], + "top0315": [ + 1153, + 1290 + ] + }, + "gbar_uni1ABE": { + "bottom": [ + 741, + -487 + ], + "cross": [ + 783, + -128 + ], + "markbottom": [ + 741, + -487 + ], + "top": [ + 741, + 1290 + ], + "top0315": [ + 1534, + 1290 + ] + }, + "gcursive": { + "bottom": [ + 554, + -447 + ], + "top": [ + 555, + 1290 + ], + "top0315": [ + 1176, + 1290 + ] + }, + "glottalstopbarrev": { + "bottom": [ + 558, + 0 + ], + "top": [ + 558, + 1633 + ], + "top0315": [ + 1066, + 1633 + ] + }, + "graveleftnosp": { + "_marktop": [ + 32, + 1290 + ], + "mkmktop": [ + 32, + 1640 + ] + }, + "gravesubnosp": { + "_markbottom": [ + -583, + 0 + ], + "mkmkbottom_acc": [ + -583, + -390 + ] + }, + "ibar": { + "bottom": [ + 381, + 0 + ], + "top": [ + 381, + 1600 + ], + "top0315": [ + 761, + 1600 + ] + }, + "jhookdblbar": { + "bottom": [ + 204, + -447 + ], + "top": [ + 634, + 1700 + ], + "top0315": [ + 848, + 1700 + ] + }, + "lbar": { + "bottom": [ + 381, + 10 + ], + "top": [ + 381, + 1677 + ], + "top0315": [ + 761, + 1677 + ] + }, + "linevertdblnosp": { + "_marktop": [ + -580, + 1180 + ], + "mkmktop": [ + -580, + 1680 + ], + "parent_top": [ + -578, + 1358 + ] + }, + "linevertnosp": { + "_marktop": [ + -576, + 1180 + ], + "mkmktop": [ + -576, + 1680 + ], + "parent_top": [ + -576, + 1358 + ] + }, + "linevertsubnosp": { + "_markbottom": [ + -579, + 0 + ], + "mkmkbottom_acc": [ + -579, + -514 + ] + }, + "lmidtilde": { + "bottom": [ + 420, + 0 + ], + "cross": [ + 426, + 842 + ], + "top": [ + 420, + 1600 + ], + "top0315": [ + 847, + 1600 + ] + }, + "macronsubnosp": { + "_bottom": [ + -576, + 0 + ], + "_markbottom": [ + -576, + 0 + ], + "mkmkbottom_acc": [ + -575, + -318 + ] + }, + "o_uni02DE": { + "bottom": [ + 576, + -10 + ], + "bottom_dd": [ + 1153, + -407 + ], + "markbottom": [ + 576, + -10 + ], + "top": [ + 576, + 1290 + ], + "top0315": [ + 1606, + 1290 + ], + "top_dd": [ + 1153, + 1600 + ] + }, + "overscorenosp": { + "_marktop": [ + -572, + 1584 + ], + "mkmktop": [ + -572, + 1910 + ], + "parent_top": [ + -573, + 1704 + ] + }, + "plussubnosp": { + "_markbottom": [ + -578, + 0 + ], + "mkmkbottom_acc": [ + -578, + -551 + ] + }, + "ringnosp": { + "_marktop": [ + -575, + 1121 + ], + "mkmktop": [ + -575, + 1571 + ], + "parent_top": [ + -575, + 1296 + ] + }, + "ringrighthalfsubnosp": { + "_markbottom": [ + -602, + 0 + ], + "mkmkbottom_acc": [ + -601, + -451 + ] + }, + "ringsubnosp": { + "_markbottom": [ + -584, + 0 + ], + "mkmkbottom_acc": [ + -584, + -490 + ] + }, + "tackupsubnosp": { + "_markbottom": [ + -578, + 0 + ], + "mkmkbottom_acc": [ + -578, + -492 + ] + }, + "tildecomb": { + "_marktop": [ + -582, + 1256 + ], + "_top": [ + -582, + 1256 + ], + "mkmktop": [ + -582, + 1606 + ], + "parent_top": [ + -556, + 1398 + ] + }, + "tildesubnosp": { + "_bottom": [ + -576, + 0 + ], + "_markbottom": [ + -576, + 0 + ], + "mkmkbottom_acc": [ + -576, + -407 + ] + }, + "underscorenosp": { + "_markbottom": [ + -577, + 0 + ], + "mkmkbottom_acc": [ + -577, + -403 + ] + }, + "uni0069.ccmp": { + "bottom": [ + 278, + 10 + ], + "top": [ + 289, + 1269 + ], + "top0315": [ + 577, + 1269 + ] + }, + "uni006A.ccmp": { + "bottom": [ + 190, + -459 + ], + "top": [ + 275, + 1269 + ], + "top0315": [ + 596, + 1269 + ] + }, + "uni012F.ccmp": { + "bottom": [ + 278, + -459 + ], + "top": [ + 289, + 1269 + ], + "top0315": [ + 577, + 1269 + ] + }, + "uni023D": { + "bottom": [ + 595, + 10 + ], + "top": [ + 366, + 1600 + ], + "top0315": [ + 1202, + 1600 + ] + }, + "uni0243": { + "bottom": [ + 675, + 10 + ], + "top": [ + 675, + 1612 + ], + "top0315": [ + 1417, + 1612 + ] + }, + "uni0248": { + "bottom": [ + 512, + -10 + ], + "top": [ + 858, + 1600 + ], + "top0315": [ + 1234, + 1600 + ] + }, + "uni0249": { + "bottom": [ + 386, + -459 + ], + "top": [ + 419, + 1600 + ], + "top0315": [ + 797, + 1600 + ] + }, + "uni0249.ccmp": { + "bottom": [ + 394, + -459 + ], + "top": [ + 394, + 1269 + ], + "top0315": [ + 796, + 1269 + ] + }, + "uni024D": { + "bottom": [ + 352, + 10 + ], + "top": [ + 462, + 1290 + ], + "top0315": [ + 858, + 1290 + ] + }, + "uni0268.ccmp": { + "bottom": [ + 371, + 10 + ], + "top": [ + 382, + 1269 + ], + "top0315": [ + 761, + 1269 + ] + }, + "uni0313": { + "_marktop": [ + -599, + 1069 + ], + "mkmktop": [ + -599, + 1684 + ], + "parent_top": [ + -576, + 1303 + ] + }, + "uni0315": { + "_marktop0315": [ + -56, + 1067 + ] + }, + "uni0342": { + "_marktop": [ + -573, + 1290 + ], + "mkmktop": [ + -573, + 1640 + ] + }, + "uni0343": { + "_marktop": [ + -611, + 1290 + ], + "mkmktop": [ + -611, + 1730 + ] + }, + "uni0348": { + "_markbottom": [ + -580, + 0 + ], + "mkmkbottom_acc": [ + -580, + -514 + ] + }, + "uni0354": { + "_markbottom": [ + -576, + 0 + ], + "mkmkbottom_acc": [ + -576, + -555 + ] + }, + "uni0355": { + "_markbottom": [ + -642, + 0 + ], + "mkmkbottom_acc": [ + -642, + -552 + ] + }, + "uni0356": { + "_markbottom": [ + -609, + 0 + ], + "mkmkbottom_acc": [ + -609, + -556 + ] + }, + "uni0357": { + "_marktop": [ + -625, + 1135 + ], + "mkmktop": [ + -625, + 1567 + ] + }, + "uni035C": { + "_markbottom_dd": [ + 0, + -30 + ] + }, + "uni035F": { + "_markbottom_dd": [ + 0, + -10 + ] + }, + "uni03F3.ccmp": { + "bottom": [ + 276, + -459 + ], + "top": [ + 275, + 1269 + ], + "top0315": [ + 596, + 1269 + ] + }, + "uni042B": { + "top": [ + 905, + 1600 + ], + "top0315": [ + 1785, + 1600 + ] + }, + "uni042B.smcp": { + "top": [ + 805, + 1320 + ], + "top0315": [ + 1614, + 1320 + ] + }, + "uni042E": { + "top": [ + 916, + 1600 + ], + "top0315": [ + 1972, + 1600 + ] + }, + "uni044B": { + "top": [ + 879, + 1290 + ], + "top0315": [ + 1730, + 1290 + ] + }, + "uni0456.ccmp": { + "bottom": [ + 278, + 10 + ], + "top": [ + 289, + 1269 + ], + "top0315": [ + 577, + 1269 + ] + }, + "uni0458.ccmp": { + "bottom": [ + 275, + -459 + ], + "top": [ + 275, + 1269 + ], + "top0315": [ + 596, + 1269 + ] + }, + "uni04BA": { + "left": [ + 989, + 0 + ], + "right": [ + 1313, + 0 + ], + "top": [ + 580, + 1612 + ], + "top0315": [ + 1444, + 1612 + ] + }, + "uni1AB4": { + "_marktop": [ + -576, + 1170 + ] + }, + "uni1AB5": { + "_markbottom": [ + -577, + 0 + ] + }, + "uni1AB8": { + "_markbottom": [ + -492, + 0 + ] + }, + "uni1D06": { + "bottom": [ + 713, + 0 + ], + "top": [ + 713, + 1290 + ], + "top0315": [ + 1287, + 1290 + ] + }, + "uni1D08": { + "bottom": [ + 533, + 0 + ], + "top": [ + 533, + 1290 + ], + "top0315": [ + 1057, + 1290 + ] + }, + "uni1D0E": { + "bottom": [ + 582, + 0 + ], + "top": [ + 582, + 1290 + ], + "top0315": [ + 1151, + 1290 + ] + }, + "uni1D1B": { + "bottom": [ + 536, + 0 + ], + "top": [ + 536, + 1290 + ], + "top0315": [ + 1064, + 1290 + ] + }, + "uni1D20": { + "bottom": [ + 525, + 0 + ], + "top": [ + 525, + 1290 + ], + "top0315": [ + 1052, + 1290 + ] + }, + "uni1D21": { + "bottom": [ + 749, + 0 + ], + "top": [ + 749, + 1290 + ], + "top0315": [ + 1493, + 1290 + ] + }, + "uni1D22": { + "bottom": [ + 504, + 0 + ], + "top": [ + 504, + 1290 + ], + "top0315": [ + 1051, + 1290 + ] + }, + "uni1D26": { + "bottom": [ + 514, + 0 + ], + "top": [ + 514, + 1290 + ], + "top0315": [ + 884, + 1290 + ] + }, + "uni1D28": { + "bottom": [ + 603, + 0 + ], + "top": [ + 603, + 1290 + ], + "top0315": [ + 1207, + 1290 + ] + }, + "uni1D29": { + "bottom": [ + 617, + 0 + ], + "top": [ + 617, + 1290 + ], + "top0315": [ + 1178, + 1290 + ] + }, + "uni1D2B": { + "bottom": [ + 614, + 0 + ], + "top": [ + 614, + 1290 + ], + "top0315": [ + 1181, + 1290 + ] + }, + "uni1D7B": { + "bottom": [ + 380, + 0 + ], + "top": [ + 380, + 1290 + ], + "top0315": [ + 761, + 1290 + ] + }, + "uni1D7C": { + "bottom": [ + 389, + 0 + ], + "top": [ + 389, + 1290 + ], + "top0315": [ + 799, + 1290 + ] + }, + "uni1DCE": { + "_marktop": [ + -578, + 967 + ] + }, + "uni1DE0": { + "_marktop": [ + -576, + 1170 + ] + }, + "uni1DEE": { + "_marktop": [ + -576, + 950 + ] + }, + "uni1DF5": { + "_marktop": [ + -578, + 1170 + ] + }, + "uni1DFE": { + "_marktop": [ + -576, + 1170 + ] + }, + "uni1FC0": { + "_top": [ + 474, + 1182 + ] + } +}
\ No newline at end of file diff --git a/res/anchors_regular.json b/res/anchors_regular.json new file mode 100644 index 0000000..f98241f --- /dev/null +++ b/res/anchors_regular.json @@ -0,0 +1,1092 @@ +{ + "Esh": { + "bottom": [ + 584, + 10 + ], + "top": [ + 584, + 1612 + ], + "top0315": [ + 1175, + 1612 + ] + }, + "Gbar": { + "bottom": [ + 668, + -10 + ], + "top": [ + 668, + 1633 + ], + "top0315": [ + 1394, + 1633 + ] + }, + "Ibar": { + "bottom": [ + 341, + 10 + ], + "top": [ + 341, + 1612 + ], + "top0315": [ + 682, + 1612 + ] + }, + "a_uni02DE": { + "bottom": [ + 501, + 0 + ], + "bottom_dd": [ + 1118, + -407 + ], + "markbottom": [ + 501, + 0 + ], + "ogonek": [ + 974, + 0 + ], + "rhalfring": [ + 700, + 1290 + ], + "top": [ + 582, + 1290 + ], + "top0315": [ + 1488, + 1290 + ], + "top_dd": [ + 1118, + 1600 + ] + }, + "acutedblnosp": { + "_marktop": [ + -661, + 1290 + ], + "mkmktop": [ + -661, + 1620 + ], + "parent_top": [ + -589, + 1388 + ] + }, + "acuterightnosp": { + "_marktop": [ + -105, + 1290 + ], + "mkmktop": [ + -105, + 1590 + ] + }, + "acutesubnosp": { + "_markbottom": [ + -613, + 0 + ], + "mkmkbottom_acc": [ + -612, + -390 + ] + }, + "bbar": { + "bottom": [ + 600, + -10 + ], + "cross": [ + 428, + 1303 + ], + "markbottom": [ + 600, + -10 + ], + "top": [ + 640, + 1611 + ], + "top0315": [ + 1244, + 1611 + ] + }, + "bridgeinvsubnosp": { + "_markbottom": [ + -587, + 0 + ], + "mkmkbottom_acc": [ + -587, + -497 + ] + }, + "circumflexnosp": { + "_marktop": [ + -591, + 1290 + ], + "mkmktop": [ + -591, + 1640 + ], + "parent_top": [ + -590, + 1395 + ] + }, + "circumflexsubnosp": { + "_bottom": [ + -588, + 0 + ], + "_markbottom": [ + -588, + 0 + ], + "mkmkbottom_acc": [ + -588, + -406 + ] + }, + "diaeresistonosnosp": { + "_marktop": [ + -591, + 1290 + ], + "mkmktop": [ + -591, + 1747 + ] + }, + "epsilon1": { + "bottom": [ + 551, + 0 + ], + "top": [ + 551, + 1290 + ], + "top0315": [ + 1103, + 1290 + ] + }, + "gbar_uni1ABE": { + "bottom": [ + 616, + -487 + ], + "cross": [ + 618, + -114 + ], + "markbottom": [ + 616, + -487 + ], + "top": [ + 617, + 1290 + ], + "top0315": [ + 1329, + 1290 + ] + }, + "gcursive": { + "bottom": [ + 555, + -447 + ], + "top": [ + 555, + 1290 + ], + "top0315": [ + 1153, + 1290 + ] + }, + "glottalstopbarrev": { + "bottom": [ + 572, + 0 + ], + "top": [ + 572, + 1633 + ], + "top0315": [ + 1076, + 1633 + ] + }, + "graveleftnosp": { + "_marktop": [ + 32, + 1290 + ], + "mkmktop": [ + 32, + 1590 + ] + }, + "gravesubnosp": { + "_markbottom": [ + -583, + 0 + ], + "mkmkbottom_acc": [ + -583, + -390 + ] + }, + "ibar": { + "bottom": [ + 341, + 0 + ], + "top": [ + 341, + 1600 + ], + "top0315": [ + 682, + 1600 + ] + }, + "jhookdblbar": { + "bottom": [ + 216, + -447 + ], + "top": [ + 576, + 1700 + ], + "top0315": [ + 842, + 1700 + ] + }, + "lbar": { + "bottom": [ + 341, + 10 + ], + "top": [ + 341, + 1699 + ], + "top0315": [ + 682, + 1699 + ] + }, + "linevertdblnosp": { + "_marktop": [ + -590, + 1185 + ], + "mkmktop": [ + -590, + 1630 + ], + "parent_top": [ + -591, + 1355 + ] + }, + "linevertnosp": { + "_marktop": [ + -587, + 1185 + ], + "mkmktop": [ + -588, + 1630 + ], + "parent_top": [ + -588, + 1355 + ] + }, + "linevertsubnosp": { + "_markbottom": [ + -590, + 0 + ], + "mkmkbottom_acc": [ + -584, + -489 + ] + }, + "lmidtilde": { + "bottom": [ + 361, + 0 + ], + "cross": [ + 361, + 768 + ], + "top": [ + 361, + 1600 + ], + "top0315": [ + 735, + 1600 + ] + }, + "macronsubnosp": { + "_bottom": [ + -588, + 0 + ], + "_markbottom": [ + -588, + 0 + ], + "mkmkbottom_acc": [ + -588, + -295 + ] + }, + "o_uni02DE": { + "bottom": [ + 586, + 0 + ], + "bottom_dd": [ + 1173, + -407 + ], + "markbottom": [ + 586, + 0 + ], + "top": [ + 576, + 1290 + ], + "top0315": [ + 1583, + 1290 + ], + "top_dd": [ + 1173, + 1600 + ] + }, + "overscorenosp": { + "_marktop": [ + -587, + 1571 + ], + "mkmktop": [ + -587, + 1833 + ], + "parent_top": [ + -588, + 1666 + ] + }, + "plussubnosp": { + "_markbottom": [ + -590, + 0 + ], + "mkmkbottom_acc": [ + -588, + -459 + ] + }, + "ringnosp": { + "_marktop": [ + -586, + 1290 + ], + "mkmktop": [ + -586, + 1700 + ], + "parent_top": [ + -586, + 1413 + ] + }, + "ringrighthalfsubnosp": { + "_markbottom": [ + -624, + 0 + ], + "mkmkbottom_acc": [ + -624, + -479 + ] + }, + "ringsubnosp": { + "_markbottom": [ + -584, + 0 + ], + "mkmkbottom_acc": [ + -584, + -460 + ] + }, + "tackupsubnosp": { + "_markbottom": [ + -590, + 0 + ], + "mkmkbottom_acc": [ + -590, + -429 + ] + }, + "tildecomb": { + "_marktop": [ + -542, + 1256 + ], + "_top": [ + -542, + 1256 + ], + "mkmktop": [ + -542, + 1566 + ], + "parent_top": [ + -535, + 1377 + ] + }, + "tildesubnosp": { + "_bottom": [ + -588, + 0 + ], + "_markbottom": [ + -588, + 0 + ], + "mkmkbottom_acc": [ + -588, + -432 + ] + }, + "underscorenosp": { + "_markbottom": [ + -588, + 0 + ], + "mkmkbottom_acc": [ + -588, + -304 + ] + }, + "uni0069.ccmp": { + "bottom": [ + 253, + 10 + ], + "top": [ + 257, + 1290 + ], + "top0315": [ + 518, + 1290 + ] + }, + "uni006A.ccmp": { + "bottom": [ + 190, + -459 + ], + "top": [ + 272, + 1249 + ], + "top0315": [ + 526, + 1249 + ] + }, + "uni012F.ccmp": { + "bottom": [ + 253, + -459 + ], + "top": [ + 257, + 1290 + ], + "top0315": [ + 518, + 1290 + ] + }, + "uni023D": { + "bottom": [ + 619, + 10 + ], + "top": [ + 328, + 1600 + ], + "top0315": [ + 1174, + 1600 + ] + }, + "uni0243": { + "bottom": [ + 630, + 10 + ], + "top": [ + 630, + 1612 + ], + "top0315": [ + 1346, + 1612 + ] + }, + "uni0248": { + "bottom": [ + 512, + -10 + ], + "top": [ + 866, + 1601 + ], + "top0315": [ + 1224, + 1601 + ] + }, + "uni0249": { + "bottom": [ + 324, + -459 + ], + "top": [ + 357, + 1600 + ], + "top0315": [ + 702, + 1600 + ] + }, + "uni0249.ccmp": { + "bottom": [ + 369, + -459 + ], + "top": [ + 369, + 1249 + ], + "top0315": [ + 713, + 1249 + ] + }, + "uni024D": { + "bottom": [ + 328, + 10 + ], + "top": [ + 407, + 1290 + ], + "top0315": [ + 788, + 1290 + ] + }, + "uni0268.ccmp": { + "bottom": [ + 357, + 10 + ], + "top": [ + 361, + 1290 + ], + "top0315": [ + 702, + 1290 + ] + }, + "uni0313": { + "_marktop": [ + -611, + 1065 + ], + "mkmktop": [ + -611, + 1684 + ], + "parent_top": [ + -587, + 1272 + ] + }, + "uni0315": { + "_marktop0315": [ + -82, + 1059 + ] + }, + "uni0342": { + "_marktop": [ + -573, + 1290 + ], + "mkmktop": [ + -573, + 1540 + ] + }, + "uni0343": { + "_marktop": [ + -611, + 1290 + ], + "mkmktop": [ + -611, + 1721 + ] + }, + "uni0348": { + "_markbottom": [ + -587, + 0 + ], + "mkmkbottom_acc": [ + -587, + -489 + ] + }, + "uni0354": { + "_markbottom": [ + -563, + 0 + ], + "mkmkbottom_acc": [ + -563, + -554 + ] + }, + "uni0355": { + "_markbottom": [ + -537, + 0 + ], + "mkmkbottom_acc": [ + -537, + -554 + ] + }, + "uni0356": { + "_markbottom": [ + -494, + 0 + ], + "mkmkbottom_acc": [ + -494, + -551 + ] + }, + "uni0357": { + "_marktop": [ + -640, + 1110 + ], + "mkmktop": [ + -640, + 1548 + ] + }, + "uni035C": { + "_markbottom_dd": [ + 0, + -40 + ] + }, + "uni035F": { + "_markbottom_dd": [ + 0, + -50 + ] + }, + "uni03F3.ccmp": { + "bottom": [ + 272, + -459 + ], + "top": [ + 272, + 1249 + ], + "top0315": [ + 526, + 1249 + ] + }, + "uni042B": { + "top": [ + 892, + 1612 + ], + "top0315": [ + 1785, + 1612 + ] + }, + "uni042B.smcp": { + "top": [ + 767, + 1320 + ], + "top0315": [ + 1543, + 1320 + ] + }, + "uni042E": { + "top": [ + 916, + 1600 + ], + "top0315": [ + 1824, + 1600 + ] + }, + "uni044B": { + "top": [ + 786, + 1269 + ], + "top0315": [ + 1602, + 1269 + ] + }, + "uni0456.ccmp": { + "bottom": [ + 253, + 10 + ], + "top": [ + 257, + 1290 + ], + "top0315": [ + 518, + 1290 + ] + }, + "uni0458.ccmp": { + "bottom": [ + 272, + -459 + ], + "top": [ + 272, + 1249 + ], + "top0315": [ + 526, + 1249 + ] + }, + "uni04BA": { + "left": [ + 1031, + 0 + ], + "right": [ + 1231, + 0 + ], + "top": [ + 688, + 1612 + ], + "top0315": [ + 1399, + 1612 + ] + }, + "uni1AB4": { + "_marktop": [ + -630, + 1170 + ] + }, + "uni1AB5": { + "_markbottom": [ + -541, + 0 + ] + }, + "uni1AB8": { + "_markbottom": [ + -582, + 0 + ] + }, + "uni1D06": { + "bottom": [ + 661, + 0 + ], + "top": [ + 661, + 1290 + ], + "top0315": [ + 1248, + 1290 + ] + }, + "uni1D08": { + "bottom": [ + 523, + 0 + ], + "top": [ + 523, + 1290 + ], + "top0315": [ + 1041, + 1290 + ] + }, + "uni1D0E": { + "bottom": [ + 603, + 0 + ], + "top": [ + 603, + 1290 + ], + "top0315": [ + 1189, + 1290 + ] + }, + "uni1D1B": { + "bottom": [ + 492, + 0 + ], + "top": [ + 492, + 1290 + ], + "top0315": [ + 987, + 1290 + ] + }, + "uni1D20": { + "bottom": [ + 502, + 0 + ], + "top": [ + 502, + 1290 + ], + "top0315": [ + 995, + 1290 + ] + }, + "uni1D21": { + "bottom": [ + 766, + 0 + ], + "top": [ + 766, + 1290 + ], + "top0315": [ + 1540, + 1290 + ] + }, + "uni1D22": { + "bottom": [ + 482, + 0 + ], + "top": [ + 482, + 1290 + ], + "top0315": [ + 1020, + 1290 + ] + }, + "uni1D26": { + "bottom": [ + 521, + 0 + ], + "top": [ + 521, + 1290 + ], + "top0315": [ + 861, + 1290 + ] + }, + "uni1D28": { + "bottom": [ + 596, + 0 + ], + "top": [ + 596, + 1290 + ], + "top0315": [ + 1189, + 1290 + ] + }, + "uni1D29": { + "bottom": [ + 596, + 0 + ], + "top": [ + 596, + 1290 + ], + "top0315": [ + 1107, + 1290 + ] + }, + "uni1D2B": { + "bottom": [ + 642, + 0 + ], + "top": [ + 642, + 1290 + ], + "top0315": [ + 1191, + 1290 + ] + }, + "uni1D7B": { + "bottom": [ + 341, + 0 + ], + "top": [ + 341, + 1290 + ], + "top0315": [ + 682, + 1290 + ] + }, + "uni1D7C": { + "bottom": [ + 337, + 0 + ], + "top": [ + 337, + 1290 + ], + "top0315": [ + 710, + 1290 + ] + }, + "uni1DCE": { + "_marktop": [ + -508, + 993 + ] + }, + "uni1DE0": { + "_marktop": [ + -588, + 1170 + ] + }, + "uni1DEE": { + "_marktop": [ + -587, + 945 + ] + }, + "uni1DF5": { + "_marktop": [ + -588, + 1170 + ] + }, + "uni1DFE": { + "_marktop": [ + -587, + 1170 + ] + }, + "uni1FC0": { + "_top": [ + 354, + 1182 + ] + } +}
\ No newline at end of file diff --git a/res/anchors_thin.json b/res/anchors_thin.json new file mode 100644 index 0000000..ca4b92f --- /dev/null +++ b/res/anchors_thin.json @@ -0,0 +1,1092 @@ +{ + "Esh": { + "bottom": [ + 553, + 10 + ], + "top": [ + 553, + 1612 + ], + "top0315": [ + 1121, + 1612 + ] + }, + "Gbar": { + "bottom": [ + 729, + 0 + ], + "top": [ + 703, + 1633 + ], + "top0315": [ + 1406, + 1633 + ] + }, + "Ibar": { + "bottom": [ + 314, + 0 + ], + "top": [ + 314, + 1612 + ], + "top0315": [ + 627, + 1612 + ] + }, + "a_uni02DE": { + "bottom": [ + 507, + 0 + ], + "bottom_dd": [ + 1081, + -407 + ], + "markbottom": [ + 507, + 0 + ], + "ogonek": [ + 933, + 0 + ], + "rhalfring": [ + 700, + 1263 + ], + "top": [ + 577, + 1292 + ], + "top0315": [ + 1421, + 1292 + ], + "top_dd": [ + 1081, + 1600 + ] + }, + "acutedblnosp": { + "_marktop": [ + -629, + 1290 + ], + "mkmktop": [ + -629, + 1600 + ], + "parent_top": [ + -566, + 1383 + ] + }, + "acuterightnosp": { + "_marktop": [ + -83, + 1290 + ], + "mkmktop": [ + -83, + 1540 + ] + }, + "acutesubnosp": { + "_markbottom": [ + -551, + 0 + ], + "mkmkbottom_acc": [ + -551, + -371 + ] + }, + "bbar": { + "bottom": [ + 584, + -10 + ], + "cross": [ + 208, + 1306 + ], + "markbottom": [ + 584, + -10 + ], + "top": [ + 577, + 1612 + ], + "top0315": [ + 1134, + 1612 + ] + }, + "bridgeinvsubnosp": { + "_markbottom": [ + -563, + 0 + ], + "mkmkbottom_acc": [ + -563, + -487 + ] + }, + "circumflexnosp": { + "_marktop": [ + -565, + 1290 + ], + "mkmktop": [ + -565, + 1606 + ], + "parent_top": [ + -562, + 1390 + ] + }, + "circumflexsubnosp": { + "_bottom": [ + -562, + 0 + ], + "_markbottom": [ + -562, + 0 + ], + "mkmkbottom_acc": [ + -561, + -384 + ] + }, + "diaeresistonosnosp": { + "_marktop": [ + -556, + 1290 + ], + "mkmktop": [ + -556, + 1700 + ] + }, + "epsilon1": { + "bottom": [ + 551, + 0 + ], + "top": [ + 551, + 1290 + ], + "top0315": [ + 1122, + 1290 + ] + }, + "gbar_uni1ABE": { + "bottom": [ + 632, + -447 + ], + "cross": [ + 632, + -134 + ], + "markbottom": [ + 632, + -447 + ], + "top": [ + 645, + 1290 + ], + "top0315": [ + 1311, + 1290 + ] + }, + "gcursive": { + "bottom": [ + 567, + -447 + ], + "top": [ + 567, + 1290 + ], + "top0315": [ + 1123, + 1290 + ] + }, + "glottalstopbarrev": { + "bottom": [ + 549, + 0 + ], + "top": [ + 549, + 1633 + ], + "top0315": [ + 1032, + 1633 + ] + }, + "graveleftnosp": { + "_marktop": [ + 32, + 1290 + ], + "mkmktop": [ + 32, + 1540 + ] + }, + "gravesubnosp": { + "_markbottom": [ + -583, + 0 + ], + "mkmkbottom_acc": [ + -583, + -371 + ] + }, + "ibar": { + "bottom": [ + 333, + 0 + ], + "top": [ + 333, + 1600 + ], + "top0315": [ + 667, + 1600 + ] + }, + "jhookdblbar": { + "bottom": [ + 225, + -447 + ], + "top": [ + 590, + 1700 + ], + "top0315": [ + 828, + 1700 + ] + }, + "lbar": { + "bottom": [ + 314, + 10 + ], + "top": [ + 314, + 1673 + ], + "top0315": [ + 627, + 1673 + ] + }, + "linevertdblnosp": { + "_marktop": [ + -558, + 1171 + ], + "mkmktop": [ + -558, + 1635 + ], + "parent_top": [ + -558, + 1355 + ] + }, + "linevertnosp": { + "_marktop": [ + -562, + 1171 + ], + "mkmktop": [ + -562, + 1635 + ], + "parent_top": [ + -562, + 1355 + ] + }, + "linevertsubnosp": { + "_markbottom": [ + -565, + 0 + ], + "mkmkbottom_acc": [ + -565, + -489 + ] + }, + "lmidtilde": { + "bottom": [ + 364, + 0 + ], + "cross": [ + 363, + 800 + ], + "top": [ + 364, + 1600 + ], + "top0315": [ + 719, + 1600 + ] + }, + "macronsubnosp": { + "_bottom": [ + -562, + 0 + ], + "_markbottom": [ + -561, + 0 + ], + "mkmkbottom_acc": [ + -561, + -243 + ] + }, + "o_uni02DE": { + "bottom": [ + 567, + -10 + ], + "bottom_dd": [ + 1127, + -407 + ], + "markbottom": [ + 567, + -10 + ], + "top": [ + 567, + 1290 + ], + "top0315": [ + 1547, + 1290 + ], + "top_dd": [ + 1127, + 1600 + ] + }, + "overscorenosp": { + "_marktop": [ + -573, + 1514 + ], + "mkmktop": [ + -569, + 1761 + ], + "parent_top": [ + -562, + 1653 + ] + }, + "plussubnosp": { + "_markbottom": [ + -563, + 0 + ], + "mkmkbottom_acc": [ + -563, + -489 + ] + }, + "ringnosp": { + "_marktop": [ + -617, + 1230 + ], + "mkmktop": [ + -617, + 1617 + ], + "parent_top": [ + -616, + 1384 + ] + }, + "ringrighthalfsubnosp": { + "_markbottom": [ + -588, + 0 + ], + "mkmkbottom_acc": [ + -588, + -390 + ] + }, + "ringsubnosp": { + "_markbottom": [ + -620, + 0 + ], + "mkmkbottom_acc": [ + -620, + -418 + ] + }, + "tackupsubnosp": { + "_markbottom": [ + -563, + 0 + ], + "mkmkbottom_acc": [ + -563, + -429 + ] + }, + "tildecomb": { + "_marktop": [ + -492, + 1260 + ], + "_top": [ + -492, + 1260 + ], + "mkmktop": [ + -492, + 1510 + ], + "parent_top": [ + -503, + 1379 + ] + }, + "tildesubnosp": { + "_bottom": [ + -562, + 0 + ], + "_markbottom": [ + -561, + 0 + ], + "mkmkbottom_acc": [ + -561, + -363 + ] + }, + "underscorenosp": { + "_markbottom": [ + -562, + 0 + ], + "mkmkbottom_acc": [ + -562, + -244 + ] + }, + "uni0069.ccmp": { + "bottom": [ + 210, + 10 + ], + "top": [ + 209, + 1269 + ], + "top0315": [ + 406, + 1269 + ] + }, + "uni006A.ccmp": { + "bottom": [ + 190, + -459 + ], + "top": [ + 209, + 1249 + ], + "top0315": [ + 445, + 1249 + ] + }, + "uni012F.ccmp": { + "bottom": [ + 210, + -459 + ], + "top": [ + 209, + 1269 + ], + "top0315": [ + 406, + 1269 + ] + }, + "uni023D": { + "bottom": [ + 625, + 10 + ], + "top": [ + 332, + 1549 + ], + "top0315": [ + 1164, + 1549 + ] + }, + "uni0243": { + "bottom": [ + 636, + 10 + ], + "top": [ + 636, + 1612 + ], + "top0315": [ + 1341, + 1612 + ] + }, + "uni0248": { + "bottom": [ + 512, + -10 + ], + "top": [ + 902, + 1582 + ], + "top0315": [ + 1235, + 1582 + ] + }, + "uni0249": { + "bottom": [ + 299, + -459 + ], + "top": [ + 332, + 1600 + ], + "top0315": [ + 666, + 1600 + ] + }, + "uni0249.ccmp": { + "bottom": [ + 340, + -459 + ], + "top": [ + 340, + 1249 + ], + "top0315": [ + 680, + 1249 + ] + }, + "uni024D": { + "bottom": [ + 260, + 19 + ], + "top": [ + 413, + 1290 + ], + "top0315": [ + 747, + 1290 + ] + }, + "uni0268.ccmp": { + "bottom": [ + 333, + 10 + ], + "top": [ + 332, + 1269 + ], + "top0315": [ + 667, + 1269 + ] + }, + "uni0313": { + "_marktop": [ + -574, + 1151 + ], + "mkmktop": [ + -574, + 1684 + ], + "parent_top": [ + -561, + 1353 + ] + }, + "uni0315": { + "_marktop0315": [ + -144, + 1151 + ] + }, + "uni0342": { + "_marktop": [ + -530, + 1290 + ], + "mkmktop": [ + -530, + 1540 + ] + }, + "uni0343": { + "_marktop": [ + -534, + 1290 + ], + "mkmktop": [ + -534, + 1540 + ] + }, + "uni0348": { + "_markbottom": [ + -565, + 0 + ], + "mkmkbottom_acc": [ + -565, + -489 + ] + }, + "uni0354": { + "_markbottom": [ + -562, + 0 + ], + "mkmkbottom_acc": [ + -562, + -548 + ] + }, + "uni0355": { + "_markbottom": [ + -596, + 0 + ], + "mkmkbottom_acc": [ + -595, + -549 + ] + }, + "uni0356": { + "_markbottom": [ + -592, + 0 + ], + "mkmkbottom_acc": [ + -592, + -551 + ] + }, + "uni0357": { + "_marktop": [ + -580, + 1193 + ], + "mkmktop": [ + -580, + 1507 + ] + }, + "uni035C": { + "_markbottom_dd": [ + 0, + -40 + ] + }, + "uni035F": { + "_markbottom_dd": [ + 0, + -50 + ] + }, + "uni03F3.ccmp": { + "bottom": [ + 209, + -459 + ], + "top": [ + 209, + 1249 + ], + "top0315": [ + 422, + 1249 + ] + }, + "uni042B": { + "top": [ + 875, + 1612 + ], + "top0315": [ + 1648, + 1612 + ] + }, + "uni042B.smcp": { + "top": [ + 656, + 1320 + ], + "top0315": [ + 1326, + 1320 + ] + }, + "uni042E": { + "top": [ + 916, + 1600 + ], + "top0315": [ + 1896, + 1600 + ] + }, + "uni044B": { + "top": [ + 804, + 1269 + ], + "top0315": [ + 1486, + 1269 + ] + }, + "uni0456.ccmp": { + "bottom": [ + 210, + 10 + ], + "top": [ + 209, + 1269 + ], + "top0315": [ + 406, + 1269 + ] + }, + "uni0458.ccmp": { + "bottom": [ + 209, + -459 + ], + "top": [ + 209, + 1249 + ], + "top0315": [ + 422, + 1249 + ] + }, + "uni04BA": { + "left": [ + 1075, + 0 + ], + "right": [ + 1129, + 0 + ], + "top": [ + 227, + 1612 + ], + "top0315": [ + 1325, + 1612 + ] + }, + "uni1AB4": { + "_marktop": [ + -562, + 1170 + ] + }, + "uni1AB5": { + "_markbottom": [ + -563, + 0 + ] + }, + "uni1AB8": { + "_markbottom": [ + -457, + 0 + ] + }, + "uni1D06": { + "bottom": [ + 656, + 0 + ], + "top": [ + 656, + 1290 + ], + "top0315": [ + 1180, + 1290 + ] + }, + "uni1D08": { + "bottom": [ + 529, + 0 + ], + "top": [ + 529, + 1290 + ], + "top0315": [ + 1035, + 1290 + ] + }, + "uni1D0E": { + "bottom": [ + 564, + 0 + ], + "top": [ + 564, + 1290 + ], + "top0315": [ + 1122, + 1290 + ] + }, + "uni1D1B": { + "bottom": [ + 472, + 0 + ], + "top": [ + 472, + 1290 + ], + "top0315": [ + 962, + 1290 + ] + }, + "uni1D20": { + "bottom": [ + 491, + 0 + ], + "top": [ + 491, + 1290 + ], + "top0315": [ + 978, + 1290 + ] + }, + "uni1D21": { + "bottom": [ + 769, + 0 + ], + "top": [ + 769, + 1290 + ], + "top0315": [ + 1539, + 1290 + ] + }, + "uni1D22": { + "bottom": [ + 487, + 0 + ], + "top": [ + 487, + 1290 + ], + "top0315": [ + 978, + 1290 + ] + }, + "uni1D26": { + "bottom": [ + 491, + 0 + ], + "top": [ + 491, + 1290 + ], + "top0315": [ + 867, + 1290 + ] + }, + "uni1D28": { + "bottom": [ + 564, + 0 + ], + "top": [ + 564, + 1290 + ], + "top0315": [ + 1122, + 1290 + ] + }, + "uni1D29": { + "bottom": [ + 568, + 0 + ], + "top": [ + 568, + 1290 + ], + "top0315": [ + 1056, + 1290 + ] + }, + "uni1D2B": { + "bottom": [ + 617, + 0 + ], + "top": [ + 617, + 1290 + ], + "top0315": [ + 1122, + 1290 + ] + }, + "uni1D7B": { + "bottom": [ + 359, + 0 + ], + "top": [ + 359, + 1290 + ], + "top0315": [ + 667, + 1290 + ] + }, + "uni1D7C": { + "bottom": [ + 336, + 0 + ], + "top": [ + 336, + 1290 + ], + "top0315": [ + 702, + 1290 + ] + }, + "uni1DCE": { + "_marktop": [ + -513, + 1052 + ] + }, + "uni1DE0": { + "_marktop": [ + -562, + 1170 + ] + }, + "uni1DEE": { + "_marktop": [ + -562, + 944 + ] + }, + "uni1DF5": { + "_marktop": [ + -563, + 1170 + ] + }, + "uni1DFE": { + "_marktop": [ + -562, + 1170 + ] + }, + "uni1FC0": { + "_top": [ + 353, + 1263 + ] + } +}
\ No newline at end of file diff --git a/scripts/build-v2.py b/scripts/build-v2.py index a861a76..58842d6 100644 --- a/scripts/build-v2.py +++ b/scripts/build-v2.py @@ -31,9 +31,12 @@ BASEDIR = os.path.abspath( # Masters -rg = Master("%s/src/v2/Roboto_Regular.ufo" % BASEDIR) -bd = Master("%s/src/v2/Roboto_Bold.ufo" % BASEDIR) -th = Master("%s/src/v2/Roboto_Thin.ufo" % BASEDIR) +rg = Master("%s/src/v2/Roboto_Regular.ufo" % BASEDIR, + anchorPath="%s/res/anchors_regular.json" % BASEDIR) +bd = Master("%s/src/v2/Roboto_Bold.ufo" % BASEDIR, + anchorPath="%s/res/anchors_bold.json" % BASEDIR) +th = Master("%s/src/v2/Roboto_Thin.ufo" % BASEDIR, + anchorPath="%s/res/anchors_thin.json" % BASEDIR) # build condensed masters diff --git a/scripts/lib/fontbuild/kerning.py b/scripts/lib/fontbuild/kerning.py index 816ca1d..302c330 100644 --- a/scripts/lib/fontbuild/kerning.py +++ b/scripts/lib/fontbuild/kerning.py @@ -29,6 +29,7 @@ class KernFeatureWriter(AbstractFeatureWriter): self.kerning = font.kerning self.leftClasses = [] self.rightClasses = [] + self.classSizes = {} def write(self, linesep="\n"): """Write kern feature.""" @@ -42,30 +43,30 @@ class KernFeatureWriter(AbstractFeatureWriter): for rightName, rightContents in self.rightClasses: rightKey = rightContents[0] pair = leftKey, rightKey - if not self.kerning.has_key(pair): + kerningVal = self.kerning[pair] + if kerningVal is None: continue - classPairKerning[leftName, rightName] = self.kerning[pair] + classPairKerning[leftName, rightName] = kerningVal self.kerning.remove(pair) # collect rules with left class and right glyph - for pair, val in self.kerning.getLeft(leftKey): - leftClassKerning[leftName, pair[1]] = self.kerning[pair] + for pair, kerningVal in self.kerning.getLeft(leftKey): + leftClassKerning[leftName, pair[1]] = kerningVal self.kerning.remove(pair) # collect rules with left glyph and right class for rightName, rightContents in self.rightClasses: rightKey = rightContents[0] - for pair, val in self.kerning.getRight(rightKey): - rightClassKerning[pair[0], rightName] = self.kerning[pair] + for pair, kerningVal in self.kerning.getRight(rightKey): + rightClassKerning[pair[0], rightName] = kerningVal self.kerning.remove(pair) # write the feature + self.ruleCount = 0 lines = ["feature kern {"] lines.append(self._writeKerning(self.kerning, linesep)) lines.append(self._writeKerning(leftClassKerning, linesep, True)) - lines.append(" subtable;") lines.append(self._writeKerning(rightClassKerning, linesep, True)) - lines.append(" subtable;") lines.append(self._writeKerning(classPairKerning, linesep)) lines.append("} kern;") return linesep.join(lines) @@ -78,6 +79,15 @@ class KernFeatureWriter(AbstractFeatureWriter): pairs = kerning.items() pairs.sort() for (left, right), val in pairs: + if enum: + rulesAdded = (self.classSizes.get(left, 1) * + self.classSizes.get(right, 1)) + else: + rulesAdded = 1 + self.ruleCount += rulesAdded + if self.ruleCount > 2048: + lines.append(" subtable;") + self.ruleCount = rulesAdded lines.append(" %spos %s %s %d;" % (enum, left, right, val)) return linesep.join(lines) @@ -91,6 +101,7 @@ class KernFeatureWriter(AbstractFeatureWriter): self.leftClasses.append(info) elif name.endswith("_R"): self.rightClasses.append(info) + self.classSizes[name] = len(contents) def makeKernFeature(font, text): diff --git a/scripts/lib/fontbuild/markFeature.py b/scripts/lib/fontbuild/markFeature.py index 30da7c3..b617ef6 100755 --- a/scripts/lib/fontbuild/markFeature.py +++ b/scripts/lib/fontbuild/markFeature.py @@ -108,12 +108,6 @@ def GenerateFeature_mark(font): classname = "@MC_" + anchor_name
accent_name_list = CreateAccNameList(font, acc_anchor_name, comb_accent_only)
- if not accent_name_list:
- print (
- 'No glyph found with anchor "%s", skipping mark lookup for %s.' %
- (acc_anchor_name, classname))
- continue
-
accent_mark_list = CreateAccGlyphList(font, accent_name_list, acc_anchor_name)
base_mark_list = CreateGlyphList(font, accent_name_list, anchor_name)
text += Create_mark_lookup(accent_mark_list, base_mark_list, lookupname, classname, expand_to_composits)
diff --git a/scripts/lib/fontbuild/mix.py b/scripts/lib/fontbuild/mix.py index 70d2e3a..bd396ed 100644 --- a/scripts/lib/fontbuild/mix.py +++ b/scripts/lib/fontbuild/mix.py @@ -15,6 +15,7 @@ from numpy import array, append import copy +import json from robofab.objects.objectsRF import RPoint from robofab.world import OpenFont from decomposeGlyph import decomposeGlyph @@ -214,12 +215,13 @@ class FGlyph: class Master: - def __init__(self, font=None, v=0, kernlist=None, overlay=None): + def __init__(self, font=None, v=0, kernlist=None, overlay=None, + anchorPath=None): if isinstance(font, FFont): self.font = None self.ffont = font elif isinstance(font,str): - self.openFont(font,overlay) + self.openFont(font,overlay, anchorPath) elif isinstance(font,Mix): self.font = font else: @@ -238,7 +240,7 @@ class Master: and not k[0] == ""] #TODO implement class based kerning / external kerning file - def openFont(self, path, overlayPath=None): + def openFont(self, path, overlayPath=None, anchorPath=None): self.font = OpenFont(path) for g in self.font: size = len(g) @@ -252,6 +254,29 @@ class Master: for overlayGlyph in overlayFont: font.insertGlyph(overlayGlyph) + # work around a bug with vfb2ufo in which anchors are dropped from + # glyphs containing components and no contours. "anchorPath" should + # point to the output of src/v2/get_dropped_anchors.py + if anchorPath: + anchorData = json.load(open(anchorPath)) + for glyphName, anchors in anchorData.items(): + + # another bug: some entire glyphs are dropped during conversion. + # example: gbar_uni1ABE + try: + glyph = self.font[glyphName] + except KeyError: + continue + + # another bug: some glyphs are decomposed during conversion, in + # which case they unexpectedly don't drop anchors. + # examples: uni04BA, Gbar (partially decomposed) + if glyph.anchors: + continue + + for name, (x, y) in anchors.items(): + glyph.appendAnchor(str(name), (x, y)) + self.ffont = FFont(self.font) diff --git a/src/v2/README.md b/src/v2/README.md index 62cc8d5..b2362d6 100644 --- a/src/v2/README.md +++ b/src/v2/README.md @@ -17,3 +17,9 @@ wine [path-to-vfb2ufo]/exe/vfb2ufo.exe [roboto]/src/v2/Roboto_Bold.vfb The converter should work both ways, so it is possible to convert altered UFOs back into VFBs which can be opened in FontLab. + +**Note:** There is currently an issue when converting via vfb2ufo, in which +some anchors are dropped from glyphs. For now it is also necessary to run the +script `get_dropped_anchors.py` through FontLab after updating the VFBs, in +order to extract these dropped anchors into an external resource which is then +re-incorporated into the masters during the build. diff --git a/src/v2/get_dropped_anchors.py b/src/v2/get_dropped_anchors.py new file mode 100644 index 0000000..3fd5676 --- /dev/null +++ b/src/v2/get_dropped_anchors.py @@ -0,0 +1,61 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from FL import * + +import json +import os + + +def main(): + """Extract anchors which will be dropped during conversion via vfb2ufo. + + Specifically, these are the anchors belonging to glyphs containing + components but no contours. This script exports them to json files. + """ + + path = "" # CHANGE THIS TO LOCAL ROBOTO PATH + if not path: + print "Please change the 'path' variable to your local roboto location" + return + + # list of input fonts (master VFBs) with their respective weights + fonts = ( + (os.path.join(path, "src", "v2", "Roboto_Thin.vfb"), "thin"), + (os.path.join(path, "src", "v2", "Roboto_Regular.vfb"), "regular"), + (os.path.join(path, "src", "v2", "Roboto_Bold.vfb"), "bold")) + + # extract the anchors which will be dropped + for fontpath, weight in fonts: + fontData = {} + font = Font(fontpath) + for i in range(len(font)): + glyph = font[i] + if glyph.anchors and glyph.components and not glyph.nodes: + glyphData = {} + for anchor in glyph.anchors: + glyphData[anchor.name] = [anchor.x, anchor.y] + fontData[glyph.name] = glyphData + + # write the data as json + outpath = os.path.join(path, "res", "anchors_%s.json" % weight) + with open(outpath, "w") as outfile: + json.dump(fontData, outfile, sort_keys=True, indent=2, + separators=(',', ': ')) + print "Wrote " + outpath + print "Done" + + +main() |