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 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

View File

@ -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 {

View File

@ -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');
};

View File

@ -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 + ' <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
}
# 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 + '] <anchor ' + [Math.round : upmscale * anchor.x] + ' ' + [Math.round : upmscale * anchor.y] + '> mark @' + anchorid
lookup.marks.push : 'markClass [' + glyph.name + '] <anchor ' + [Math.round : upmscale * anchor.x] + ' ' + [Math.round : upmscale * anchor.y] + '> @' + 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

View File

@ -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]

View File

@ -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)))]
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'
.style 'Regular'
.weight 400
.version 'r0.1.7'
.version 'r0.1.8'
.variantSelector (.)
.copyright 'Copyright (c) 2015 Belleve Invis.'
)