Fixed some weird bug about GDEF and mark feature. Move to 0.1.8.

This commit is contained in:
be5invis 2015-08-29 03:53:19 +08:00
parent f3ae40b75d
commit 06aa092f8d
7 changed files with 34 additions and 56 deletions

View File

@ -201,8 +201,8 @@ define [buildFont para recursive] : begin {
define capitalMarks : StdAnchorGroup markAboveCap markBelowZero markToprightCap markBottomrightZero define capitalMarks : StdAnchorGroup markAboveCap markBelowZero markToprightCap markBottomrightZero
define bMarks : StdAnchorGroup markAboveCap markBelowZero markToprightCap markBottomrightZero define bMarks : StdAnchorGroup markAboveCap markBelowZero markToprightCap markBottomrightZero
define eMarks : StdAnchorGroup markAboveLower markBelowZero markToprightLower markBottomrightZero define eMarks : StdAnchorGroup markAboveLower markBelowZero markToprightLower markBottomrightZero
define pMarks : StdAnchorGroup markAboveLower markBelowZero markToprightLower markBottomrightLower define pMarks : StdAnchorGroup markAboveLower markBelowLower markToprightLower markBottomrightLower
define ifMarks : StdAnchorGroup markAboveCap markBelowZero markToprightCap markBottomrightLower define ifMarks : StdAnchorGroup markAboveCap markBelowLower markToprightCap markBottomrightLower
### Necessary macros ### Necessary macros
# Remap Glyph's methods to macros in order to simplify writing # Remap Glyph's methods to macros in order to simplify writing

View File

@ -1,5 +1,5 @@
lookup ccmpManual1 { 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 iotaBelow' by iotaLF;
sub eta @MG_above iotaBelow' by iotaLF; sub eta @MG_above iotaBelow' by iotaLF;
@ -45,44 +45,20 @@ feature ccmp {
feature mark { feature mark {
script latn; script latn;
language dflt; language dflt;
lookup markAuto_above; lookup markAuto_letter;
lookup markAuto_below;
lookup markAuto_trailing;
lookup markAuto_lf;
lookup markAuto_topright;
lookup markAuto_bottomright;
lookup markAuto_overlay; lookup markAuto_overlay;
lookup markAuto_slash;
script grek; script grek;
language dflt; language dflt;
lookup markAuto_above; lookup markAuto_letter;
lookup markAuto_below;
lookup markAuto_trailing;
lookup markAuto_lf;
lookup markAuto_topright;
lookup markAuto_bottomright;
lookup markAuto_overlay; lookup markAuto_overlay;
lookup markAuto_slash;
script cyrl; script cyrl;
language dflt; language dflt;
lookup markAuto_above; lookup markAuto_letter;
lookup markAuto_below;
lookup markAuto_trailing;
lookup markAuto_lf;
lookup markAuto_topright;
lookup markAuto_bottomright;
lookup markAuto_overlay; lookup markAuto_overlay;
lookup markAuto_slash;
script dflt; script dflt;
language dflt; language dflt;
lookup markAuto_above; lookup markAuto_letter;
lookup markAuto_below;
lookup markAuto_trailing;
lookup markAuto_lf;
lookup markAuto_topright;
lookup markAuto_bottomright;
lookup markAuto_overlay; lookup markAuto_overlay;
lookup markAuto_slash;
} mark; } mark;
feature mkmk { feature mkmk {

View File

@ -58,8 +58,8 @@ if(argv.dumpfeature) {
featurefile += 'lookup mkmkAuto {' + mkmk.marks.join(';\n') + ';\n' + mkmk.bases.join(';\n') + ';} mkmkAuto;' featurefile += 'lookup mkmkAuto {' + mkmk.marks.join(';\n') + ';\n' + mkmk.bases.join(';\n') + ';} mkmkAuto;'
// gdef // gdef
var gdef = ttfFont.features.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;' //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'); fs.writeFileSync(argv.dumpfeature, featurefile, 'utf8');
}; };

View File

@ -541,29 +541,31 @@ set font.features.mark (.)
set font.features.mkmk (.marks () .bases ()) set font.features.mkmk (.marks () .bases ())
set font.features.markGlyphs (.) set font.features.markGlyphs (.)
set font.features.gdef (.simple () .ligature () .mark ()) 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 '' local buf ''
foreach key [items-of : Object.keys glyph.anchors] : buf = buf + ' <anchor ' + [Math.round [upmscale * glyph.anchors.(key).(propx)]] + ' ' + [Math.round [upmscale * glyph.anchors.(key).(propy)]] + '> ' + inserter + ' @' + key foreach key [items-of : Object.keys glyph.anchors] : if [!th || th.(key)] : buf = buf + ' <anchor ' + [Math.round [upmscale * glyph.anchors.(key).(propx)]] + ' ' + [Math.round [upmscale * glyph.anchors.(key).(propy)]] + '> ' + inserter + ' @' + prefix + key
return buf return buf
} }
# mark # mark
define [createMarkLookup anchorid] : let [lookup : set font.features.mark.(anchorid) (.marks () .bases ())] : foreach glyph [items-of glyphList] : begin { define [createMarkLookup tableName anchorClasses] : let [lookup : set font.features.mark.(tableName) (.marks () .bases ())] : begin {
if [glyph.anchors && glyph.anchors.(anchorid)] : begin { local th (.)
local anchor glyph.anchors.(anchorid) foreach [ac : items-of anchorClasses] : set th.(ac) true
if [anchor.type === 'base'] { foreach glyph [items-of glyphList] : if glyph.anchors : begin {
lookup.bases.push : 'pos mark [' + glyph.name + '] <anchor ' + [Math.round : upmscale * anchor.x] + ' ' + [Math.round : upmscale * anchor.y] + '> mark @' + anchorid local anchorKeys : Object.keys glyph.anchors
lookup.marks.push : 'markClass [' + glyph.name + '] <anchor ' + [Math.round : upmscale * anchor.x] + ' ' + [Math.round : upmscale * anchor.y] + '> @' + anchorid 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 'letter' ('above' 'below' 'trailing' 'lf' 'topright' 'bottomright')
createMarkLookup 'below' createMarkLookup 'overlay' ('overlay' 'slash')
createMarkLookup 'trailing'
createMarkLookup 'lf'
createMarkLookup 'topright'
createMarkLookup 'bottomright'
createMarkLookup 'overlay'
createMarkLookup 'slash'
# mkmk and GDEF # mkmk and GDEF
foreach glyph [items-of glyphList] : if [glyph.anchors && [begin [local anchorKeys : Object.keys glyph.anchors] anchorKeys.length]] { foreach glyph [items-of glyphList] : if [glyph.anchors && [begin [local anchorKeys : Object.keys glyph.anchors] anchorKeys.length]] {
then { then {
@ -573,8 +575,8 @@ foreach glyph [items-of glyphList] : if [glyph.anchors && [begin [local anchorKe
if isMarkGlyph { if isMarkGlyph {
then { then {
font.features.mkmk.marks.push : 'markClass [' + glyph.name + '] ' + [buildAnchorDescription glyph '' 'x' 'y'] 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'] font.features.mkmk.bases.push : 'pos mark ' + glyph.name + ' ' + [buildAnchorDescription glyph 'mark' 'mbx' 'mby' 'mkmk']
foreach key [items-of anchorKeys] : begin { foreach key [items-of anchorKeys] : begin {
if [not font.features.markGlyphs.(key)] : set font.features.markGlyphs.(key) () if [not font.features.markGlyphs.(key)] : set font.features.markGlyphs.(key) ()
font.features.markGlyphs.(key).push glyph.name font.features.markGlyphs.(key).push glyph.name

View File

@ -345,8 +345,8 @@ alias 'latinkappa' 0x138 'kappa'
create-glyph 'eng' : glyph-construction { create-glyph 'eng' : glyph-construction {
assign-unicode 0x14B assign-unicode 0x14B
include pMarks
include glyphs.n AS_BASE include glyphs.n
include : VerticalHook [RIGHTSB - HALFSTROKE * CORRECTION_HX] 0 [-HOOKX] HOOK include : VerticalHook [RIGHTSB - HALFSTROKE * CORRECTION_HX] 0 [-HOOKX] HOOK
} }
create-glyph 'Eng' : glyph-construction { 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 0xA7B0 'K' MIDDLE [CAP / 2]
turned nothing 0x29E 'k' MIDDLE [XH / 2] pMarks turned nothing 0x29E 'k' MIDDLE [XH / 2] pMarks
turned nothing 0x26F 'm' MIDDLE [XH / 2] 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 'invsmcpR' 0x281 'cyrya' MIDDLE [XH / 2]
turned nothing 0x287 't' MIDDLE [XH / 2] pMarks turned nothing 0x287 't' MIDDLE [XH / 2] pMarks
turned nothing 0x28C 'v' MIDDLE [XH / 2] turned nothing 0x28C 'v' MIDDLE [XH / 2]

View File

@ -659,4 +659,4 @@ create-glyph 'ltildeover' : glyph-construction {
} }
# Turned glyphs # Turned glyphs
turned nothing 0x27A 'rlongleg' MIDDLE [XH / 2] [anchorDeriv bMarks (.anchors (.bottomright (.x RIGHTSB - RBALANCE .y 0)))] turned nothing 0x27A 'rlongleg' MIDDLE [XH / 2] [anchorDeriv bMarks (.anchors (.bottomright (.type BASE .x RIGHTSB - RBALANCE .y 0)))]

View File

@ -45,7 +45,7 @@ define regular (
.family 'Iosevka' .family 'Iosevka'
.style 'Regular' .style 'Regular'
.weight 400 .weight 400
.version 'r0.1.7' .version 'r0.1.8'
.variantSelector (.) .variantSelector (.)
.copyright 'Copyright (c) 2015 Belleve Invis.' .copyright 'Copyright (c) 2015 Belleve Invis.'
) )