Oh, i forgot glyph names should contain hyphen.

This commit is contained in:
be5invis 2015-08-23 09:03:43 +08:00
parent e9274696ec
commit e6415918fe
3 changed files with 31 additions and 21 deletions

View File

@ -67,7 +67,7 @@ if(argv.dumpfeature) {
// gdef
var gdef = ttfFont.features.gdef;
featurefile += '@GDEF_Simple = [' + gdef.simple.join(' ') + ']; @GDEF_Ligature =[' + gdef.ligature.join(' ') + ']; @GDEF_Mark = [' + gdef.mark.join(' ') + ']; table GDEF { GlyphClassDef @GDEF_Simple, @GDEF_Ligature, @GDEF_Mark, ;} GDEF;'
featurefile += '@GDEF_Simple = [' + gdef.simple.join(' \n') + '];\n@GDEF_Ligature =[' + gdef.ligature.join(' \n') + '];\n@GDEF_Mark = [' + gdef.mark.join(' \n') + '];\ntable GDEF { GlyphClassDef @GDEF_Simple, @GDEF_Ligature, @GDEF_Mark, ;} GDEF;'
fs.writeFileSync(argv.dumpfeature, featurefile, 'utf8');
};

View File

@ -479,6 +479,11 @@ createFractions : list {
define [createLigature unicode] : begin {
local ids : ().slice.call arguments 1
local glyphName : ids.join '_'
if glyphs.(glyphName) : begin {
local j 2
while glyphs.[glyphName + j] : inc j
set glyphName [glyphName + j]
}
create-glyph glyphName : glyph-construction {
if unicode : assign-unicode unicode
set-width : ids.length * WIDTH
@ -560,21 +565,26 @@ createMarkLookup 'bottomright'
createMarkLookup 'overlay'
createMarkLookup 'slash'
# mkmk and GDEF
foreach glyph [items-of glyphList] : if [glyph.anchors && [begin [local anchorKeys : Object.keys glyph.anchors] anchorKeys.length]] : begin {
local isMarkGlyph false
foreach key [items-of anchorKeys] : if [glyph.anchors.(key).type == 'mark'] : set isMarkGlyph true
foreach glyph [items-of glyphList] : if [glyph.anchors && [begin [local anchorKeys : Object.keys glyph.anchors] anchorKeys.length]] {
then {
local isMarkGlyph false
foreach key [items-of anchorKeys] : if [glyph.anchors.(key).type == 'mark'] : set isMarkGlyph true
if isMarkGlyph {
then {
if isMarkGlyph {
then {
font.features.mkmk.marks.push : 'markClass [' + glyph.name + '] ' + [buildAnchorDescription glyph '' 'x' 'y']
font.features.mkmk.bases.push : 'pos mark [' + glyph.name + '] ' + [buildAnchorDescription glyph 'mark' 'mbx' 'mby']
foreach key [items-of anchorKeys] : begin {
if [not font.features.markGlyphs.(key)] : set font.features.markGlyphs.(key) ()
font.features.markGlyphs.(key).push glyph.name
font.features.mkmk.marks.push : 'markClass [' + glyph.name + '] ' + [buildAnchorDescription glyph '' 'x' 'y']
font.features.mkmk.bases.push : 'pos mark [' + glyph.name + '] ' + [buildAnchorDescription glyph 'mark' 'mbx' 'mby']
foreach key [items-of anchorKeys] : begin {
if [not font.features.markGlyphs.(key)] : set font.features.markGlyphs.(key) ()
font.features.markGlyphs.(key).push glyph.name
}
font.features.gdef.mark.push glyph.name
}
font.features.gdef.mark.push glyph.name
else : if [[regex '_'].test glyph.name] [font.features.gdef.ligature.push glyph.name] [font.features.gdef.simple.push glyph.name]
}
else : if [[regex '_'].test glyph.name] [font.features.gdef.ligature.push glyph.name] [font.features.gdef.simple.push glyph.name]
}
else {
if [[regex '_'].test glyph.name] [font.features.gdef.ligature.push glyph.name] [font.features.gdef.simple.push glyph.name]
}
}

View File

@ -65,7 +65,7 @@ create-glyph 'OE' : glyph-construction {
include : OEShape CAP
}
create-glyph 'ae-epart' : glyph-construction {
create-glyph 'aeepart' : glyph-construction {
dont-export
local sw : adviceBlackness 3.25
local eLeft : MIDDLE - sw / 2 * CORRECTION_HX
@ -93,7 +93,7 @@ create-glyph 'ae-epart' : glyph-construction {
:.line-to [RIGHTSB - sw / 2] barbottom
:.heads-to RIGHTWARD
}
create-glyph 'ae-apart' : glyph-construction {
create-glyph 'aeapart' : glyph-construction {
dont-export
local sw : adviceBlackness 3.25
@ -123,7 +123,7 @@ create-glyph 'ae-apart' : glyph-construction {
curl [abarRight - 1] bartop [heading RIGHTWARD]
}
}
create-glyph 'oe-opart' : glyph-construction {
create-glyph 'oeopart' : glyph-construction {
dont-export
local sw : adviceBlackness 3.25
@ -135,15 +135,15 @@ create-glyph 'ae' : glyph-construction {
set-width WIDTH
assign-unicode 0xE6
include eMarks
include glyphs.ae-epart
include glyphs.ae-apart
include glyphs.aeepart
include glyphs.aeapart
}
create-glyph 'oe' : glyph-construction {
set-width WIDTH
assign-unicode 0x153
include eMarks
include glyphs.ae-epart
include glyphs.oe-opart
include glyphs.aeepart
include glyphs.oeopart
}
create-glyph 'Eth' : glyph-construction {