From 06aa092f8d7c70ecf00995d742cab04447f6cebb Mon Sep 17 00:00:00 2001 From: be5invis Date: Sat, 29 Aug 2015 03:53:19 +0800 Subject: [PATCH] Fixed some weird bug about GDEF and mark feature. Move to 0.1.8. --- buildglyphs.patel | 4 +-- features/common.fea | 34 ++++---------------------- generate.js | 4 +-- glyphs/autobuilds.patel | 38 +++++++++++++++-------------- glyphs/latin-extend-basis.patel | 6 ++--- glyphs/latin-extend-decorated.patel | 2 +- parameters.patel | 2 +- 7 files changed, 34 insertions(+), 56 deletions(-) diff --git a/buildglyphs.patel b/buildglyphs.patel index 63458e3..bddd828 100644 --- a/buildglyphs.patel +++ b/buildglyphs.patel @@ -201,8 +201,8 @@ define [buildFont para recursive] : begin { define capitalMarks : StdAnchorGroup markAboveCap markBelowZero markToprightCap markBottomrightZero define bMarks : StdAnchorGroup markAboveCap markBelowZero markToprightCap markBottomrightZero define eMarks : StdAnchorGroup markAboveLower markBelowZero markToprightLower markBottomrightZero - define pMarks : StdAnchorGroup markAboveLower markBelowZero markToprightLower markBottomrightLower - define ifMarks : StdAnchorGroup markAboveCap markBelowZero markToprightCap markBottomrightLower + define pMarks : StdAnchorGroup markAboveLower markBelowLower markToprightLower markBottomrightLower + define ifMarks : StdAnchorGroup markAboveCap markBelowLower markToprightCap markBottomrightLower ### Necessary macros # Remap Glyph's methods to macros in order to simplify writing diff --git a/features/common.fea b/features/common.fea index 7092fe3..c78ccfe 100644 --- a/features/common.fea +++ b/features/common.fea @@ -1,5 +1,5 @@ lookup ccmpManual1 { - sub [i cyrUkraniani j cyrje uni012F]' @MG_above by [dotlessi dotlessi dotlessj dotlessj iogonek.dotless]; + sub [i cyrUkraniani j cyrje iogonekBelow]' @MG_above by [dotlessi dotlessi dotlessj dotlessj iogonek.dotless]; sub eta iotaBelow' by iotaLF; sub eta @MG_above iotaBelow' by iotaLF; @@ -45,44 +45,20 @@ feature ccmp { feature mark { script latn; language dflt; - lookup markAuto_above; - lookup markAuto_below; - lookup markAuto_trailing; - lookup markAuto_lf; - lookup markAuto_topright; - lookup markAuto_bottomright; + lookup markAuto_letter; lookup markAuto_overlay; - lookup markAuto_slash; script grek; language dflt; - lookup markAuto_above; - lookup markAuto_below; - lookup markAuto_trailing; - lookup markAuto_lf; - lookup markAuto_topright; - lookup markAuto_bottomright; + lookup markAuto_letter; lookup markAuto_overlay; - lookup markAuto_slash; script cyrl; language dflt; - lookup markAuto_above; - lookup markAuto_below; - lookup markAuto_trailing; - lookup markAuto_lf; - lookup markAuto_topright; - lookup markAuto_bottomright; + lookup markAuto_letter; lookup markAuto_overlay; - lookup markAuto_slash; script dflt; language dflt; - lookup markAuto_above; - lookup markAuto_below; - lookup markAuto_trailing; - lookup markAuto_lf; - lookup markAuto_topright; - lookup markAuto_bottomright; + lookup markAuto_letter; lookup markAuto_overlay; - lookup markAuto_slash; } mark; feature mkmk { diff --git a/generate.js b/generate.js index 8f2f336..1575e7a 100644 --- a/generate.js +++ b/generate.js @@ -58,8 +58,8 @@ if(argv.dumpfeature) { featurefile += 'lookup mkmkAuto {' + mkmk.marks.join(';\n') + ';\n' + mkmk.bases.join(';\n') + ';} mkmkAuto;' // gdef - var gdef = ttfFont.features.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;' + //var gdef = ttfFont.features.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'); }; \ No newline at end of file diff --git a/glyphs/autobuilds.patel b/glyphs/autobuilds.patel index 430b346..54de222 100644 --- a/glyphs/autobuilds.patel +++ b/glyphs/autobuilds.patel @@ -541,29 +541,31 @@ set font.features.mark (.) set font.features.mkmk (.marks () .bases ()) set font.features.markGlyphs (.) set font.features.gdef (.simple () .ligature () .mark ()) -define [buildAnchorDescription glyph inserter propx propy] : begin { +define [buildAnchorDescription glyph inserter propx propy prefix th] : begin { local buf '' - foreach key [items-of : Object.keys glyph.anchors] : buf = buf + ' ' + inserter + ' @' + key + foreach key [items-of : Object.keys glyph.anchors] : if [!th || th.(key)] : buf = buf + ' ' + inserter + ' @' + prefix + key return buf } # mark -define [createMarkLookup anchorid] : let [lookup : set font.features.mark.(anchorid) (.marks () .bases ())] : foreach glyph [items-of glyphList] : begin { - if [glyph.anchors && glyph.anchors.(anchorid)] : begin { - local anchor glyph.anchors.(anchorid) - if [anchor.type === 'base'] { - lookup.bases.push : 'pos mark [' + glyph.name + '] mark @' + anchorid - lookup.marks.push : 'markClass [' + glyph.name + '] @' + anchorid +define [createMarkLookup tableName anchorClasses] : let [lookup : set font.features.mark.(tableName) (.marks () .bases ())] : begin { + local th (.) + foreach [ac : items-of anchorClasses] : set th.(ac) true + foreach glyph [items-of glyphList] : if glyph.anchors : begin { + local anchorKeys : Object.keys glyph.anchors + local hasAnchor false + foreach [key : items-of anchorKeys] : if th.(key) : set hasAnchor true + if hasAnchor : begin { + local isMarkGlyph false + foreach key [items-of anchorKeys] : if [glyph.anchors.(key).type == 'mark'] : set isMarkGlyph true + if isMarkGlyph { + then : lookup.marks.push : 'markClass ' + glyph.name + [buildAnchorDescription glyph '' 'x' 'y' 'mark' th] + else : lookup.bases.push : 'pos base ' + glyph.name + [buildAnchorDescription glyph 'mark' 'x' 'y' 'mark' th] + } } } } -createMarkLookup 'above' -createMarkLookup 'below' -createMarkLookup 'trailing' -createMarkLookup 'lf' -createMarkLookup 'topright' -createMarkLookup 'bottomright' -createMarkLookup 'overlay' -createMarkLookup 'slash' +createMarkLookup 'letter' ('above' 'below' 'trailing' 'lf' 'topright' 'bottomright') +createMarkLookup 'overlay' ('overlay' 'slash') # mkmk and GDEF foreach glyph [items-of glyphList] : if [glyph.anchors && [begin [local anchorKeys : Object.keys glyph.anchors] anchorKeys.length]] { then { @@ -573,8 +575,8 @@ foreach glyph [items-of glyphList] : if [glyph.anchors && [begin [local anchorKe 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'] + font.features.mkmk.marks.push : 'markClass ' + glyph.name + ' ' + [buildAnchorDescription glyph '' 'x' 'y' 'mkmk'] + font.features.mkmk.bases.push : 'pos mark ' + glyph.name + ' ' + [buildAnchorDescription glyph 'mark' 'mbx' 'mby' 'mkmk'] foreach key [items-of anchorKeys] : begin { if [not font.features.markGlyphs.(key)] : set font.features.markGlyphs.(key) () font.features.markGlyphs.(key).push glyph.name diff --git a/glyphs/latin-extend-basis.patel b/glyphs/latin-extend-basis.patel index 514185a..23e900b 100644 --- a/glyphs/latin-extend-basis.patel +++ b/glyphs/latin-extend-basis.patel @@ -345,8 +345,8 @@ alias 'latinkappa' 0x138 'kappa' create-glyph 'eng' : glyph-construction { assign-unicode 0x14B - - include glyphs.n AS_BASE + include pMarks + include glyphs.n include : VerticalHook [RIGHTSB - HALFSTROKE * CORRECTION_HX] 0 [-HOOKX] HOOK } create-glyph 'Eng' : glyph-construction { @@ -791,7 +791,7 @@ turned nothing 0x265 'h' MIDDLE [XH / 2] pMarks turned nothing 0xA7B0 'K' MIDDLE [CAP / 2] turned nothing 0x29E 'k' MIDDLE [XH / 2] pMarks turned nothing 0x26F 'm' MIDDLE [XH / 2] -turned nothing 0x279 'r' MIDDLE [XH / 2] [anchorDeriv eMarks (.anchors (.bottomright (.x RIGHTSB - RBALANCE .y 0)))] +turned nothing 0x279 'r' MIDDLE [XH / 2] [anchorDeriv eMarks (.anchors (.bottomright (.type BASE .x RIGHTSB - RBALANCE .y 0)))] turned 'invsmcpR' 0x281 'cyrya' MIDDLE [XH / 2] turned nothing 0x287 't' MIDDLE [XH / 2] pMarks turned nothing 0x28C 'v' MIDDLE [XH / 2] diff --git a/glyphs/latin-extend-decorated.patel b/glyphs/latin-extend-decorated.patel index cbc9d6c..b9d56f8 100644 --- a/glyphs/latin-extend-decorated.patel +++ b/glyphs/latin-extend-decorated.patel @@ -659,4 +659,4 @@ create-glyph 'ltildeover' : glyph-construction { } # Turned glyphs -turned nothing 0x27A 'rlongleg' MIDDLE [XH / 2] [anchorDeriv bMarks (.anchors (.bottomright (.x RIGHTSB - RBALANCE .y 0)))] \ No newline at end of file +turned nothing 0x27A 'rlongleg' MIDDLE [XH / 2] [anchorDeriv bMarks (.anchors (.bottomright (.type BASE .x RIGHTSB - RBALANCE .y 0)))] \ No newline at end of file diff --git a/parameters.patel b/parameters.patel index 9ba2861..c884124 100644 --- a/parameters.patel +++ b/parameters.patel @@ -45,7 +45,7 @@ define regular ( .family 'Iosevka' .style 'Regular' .weight 400 - .version 'r0.1.7' + .version 'r0.1.8' .variantSelector (.) .copyright 'Copyright (c) 2015 Belleve Invis.' )