diff --git a/buildglyphs.patel b/buildglyphs.patel index d923064..4450c9a 100644 --- a/buildglyphs.patel +++ b/buildglyphs.patel @@ -43,33 +43,14 @@ define [buildFont para recursive] : begin { define unicodeGlyphs () define UPM 1000 - # metrics - define DESCENDER para.descender + define serifed : not [not para.serif] + # Key metrics define WIDTH para.width + define SB para.sb define CAP para.cap define XH para.xheight - define O para.o - define OXHOOK para.oxhook - define SB para.sb - define HOOK para.hook - define AHOOK para.ahook - define SHOOK para.shook - define RHOOK para.rhook - define HOOKX para.hookx - define SMOOTH para.smooth - define SMALLSMOOTH para.smallsmooth - define STROKE para.stroke - define DOTSIZE para.dotsize - define PERIODSIZE para.periodsize - define BARPOS para.barpos - define GBARPOS para.gbarpos - define FIVEBARPOS para.fivebarpos - define LONGJUT para.longjut - define JUT para.jut - define ACCENT para.accent - define ACCENTX para.accentx - - # Common metrics for symbols + define DESCENDER para.descender + # Key metrics for symbols local parenTop [[XH * 0.625] + [CAP - XH] * 2.5] local parenBot [[XH * 0.625] - [CAP - XH] * 2.5] local parenMid [mix parenTop parenBot 0.5] @@ -97,6 +78,45 @@ define [buildFont para recursive] : begin { return (.x [a.x / m] .y [a.y / m]) } + # Style parameters + define O para.o + define OXHOOK para.oxhook + define HOOK para.hook + define AHOOK para.ahook + define SHOOK para.shook + define RHOOK para.rhook + define HOOKX para.hookx + define SMOOTH para.smooth + define SMALLSMOOTH para.smallsmooth + define STROKE para.stroke + define DOTSIZE : fallback para.dotsize STROKE + define PERIODSIZE : fallback para.periodsize DOTSIZE + define BARPOS : fallback para.barpos 0.5 + define GBARPOS : fallback para.gbarpos 0.5 + define EBARPOS : fallback para.ebarpos BARPOS + define OVERLAYPOS para.overlaypos + define FIVEBARPOS para.fivebarpos + define LONGJUT para.longjut + define JUT para.jut + define ACCENT para.accent + define ACCENTX para.accentx + + define KAPPA para.kappa + define BKAPPA : para.bkappa || KAPPA + 0.1 + define KAPPA_SPIRO_ARC : KAPPA + 0.1 + define CKAPPA : para.ckappa || BKAPPA + define KAPPA_HOOK : fallback para.kappa_hook [BKAPPA + 0.1] + define KAPPA_AHOOK : fallback para.kappa_ahook KAPPA_HOOK + define KAPPA_RHOOK : fallback para.kappa_rhook KAPPA_HOOK + define TAILADJX : WIDTH * 0.2 + define TAILADJY : XH * 0.25 + define ILBALANCE : LONGJUT * 0.04 + define JBALANCE : fallback para.jbalance [STROKE / 2 + ILBALANCE] + define TBALANCE : fallback para.tbalance JBALANCE + define TBALANCE2 : fallback para.tbalance2 TBALANCE + define RBALANCE : fallback para.rbalance [JBALANCE * 0.3] + define SBALANCE : fallback para.sbalance 0.52 + # derived metrics define FULLWIDTH : if para.cjkSpacing [WIDTH * 2] WIDTH define XO : XH - O @@ -120,32 +140,6 @@ define [buildFont para recursive] : begin { define CORRECTION_OMIDX : globalTransform.yx * 1.2 define CORRECTION_OMIDS : STROKE * CORRECTION_OMIDX - # style parameters - define EBARPOS : para.ebarpos || BARPOS - define KAPPA para.kappa - define COKAPPA : 1 - KAPPA - define BKAPPA : para.bkappa || KAPPA + 0.1 - define KAPPA_SPIRO_ARC : KAPPA + 0.1 - define CKAPPA : para.ckappa || BKAPPA - define COBKAPPA : 1 - BKAPPA - define KAPPA_HOOK : fallback para.kappa_hook [BKAPPA + 0.1] - define KAPPA_AHOOK : fallback para.kappa_ahook KAPPA_HOOK - define KAPPA_RHOOK : fallback para.kappa_rhook KAPPA_HOOK - define TAILADJX : WIDTH * 0.2 - define TAILADJY : XH * 0.25 - define TAILADJKAPPA 0.75 - define TAILADJSX : WIDTH * 0.2 - define TAILADJSY 0 - define TAILADJSKAPPA 0.75 - define ILBALANCE : LONGJUT * 0.04 - define JBALANCE : para.jbalance || HALFSTROKE + ILBALANCE - define TBALANCE : para.tbalance || JBALANCE - define TBALANCE2 : para.tbalance2 || TBALANCE - define RBALANCE : para.rbalance || JBALANCE * 0.3 - define SBALANCE : fallback para.sbalance 0.52 - - define serifed : not [not para.serif] - # Blackness parameters # We will estimate blackness using lower-case 'e' define WHITENESS : [[XH - STROKE * 3] * [RIGHTSB - SB] * [1 / 3]] / [XH * [RIGHTSB - SB]] @@ -184,7 +178,14 @@ define [buildFont para recursive] : begin { } define [StdAnchorGroup] : begin { local a : anchorDeriv.apply null arguments - set a.anchors.overlay (.type BASE .x [mix a.anchors.below.x a.anchors.above.x BARPOS] .y [mix a.anchors.below.y a.anchors.above.y BARPOS]) + set a.anchors.overlay (.type BASE + .x [mix a.anchors.below.x a.anchors.above.x OVERLAYPOS] + .y [mix a.anchors.below.y a.anchors.above.y OVERLAYPOS] + ) + set a.anchors.slash (.type BASE + .x [mix a.anchors.below.x a.anchors.above.x 0.5] + .y [mix a.anchors.below.y a.anchors.above.y 0.5] + ) return a } diff --git a/features/common.fea b/features/common.fea index 1ca68cf..7092fe3 100644 --- a/features/common.fea +++ b/features/common.fea @@ -45,16 +45,44 @@ feature ccmp { feature mark { script latn; language dflt; - lookup markAuto; + lookup markAuto_above; + lookup markAuto_below; + lookup markAuto_trailing; + lookup markAuto_lf; + lookup markAuto_topright; + lookup markAuto_bottomright; + lookup markAuto_overlay; + lookup markAuto_slash; script grek; language dflt; - lookup markAuto; + lookup markAuto_above; + lookup markAuto_below; + lookup markAuto_trailing; + lookup markAuto_lf; + lookup markAuto_topright; + lookup markAuto_bottomright; + lookup markAuto_overlay; + lookup markAuto_slash; script cyrl; language dflt; - lookup markAuto; + lookup markAuto_above; + lookup markAuto_below; + lookup markAuto_trailing; + lookup markAuto_lf; + lookup markAuto_topright; + lookup markAuto_bottomright; + lookup markAuto_overlay; + lookup markAuto_slash; script dflt; language dflt; - lookup markAuto; + lookup markAuto_above; + lookup markAuto_below; + lookup markAuto_trailing; + lookup markAuto_lf; + lookup markAuto_topright; + lookup markAuto_bottomright; + lookup markAuto_overlay; + lookup markAuto_slash; } mark; feature mkmk { diff --git a/generate.js b/generate.js index d35d492..ad4967e 100644 --- a/generate.js +++ b/generate.js @@ -55,7 +55,11 @@ if(argv.dumpfeature) { } // mark var mark = ttfFont.features.mark; - featurefile += 'lookup markAuto {' + mark.marks.join(';\n') + ';\n' + mark.bases.join(';\n') + ';} markAuto;' + for(var id in mark) { + var lookup = mark[id]; + var lookupName = 'markAuto_' + id; + featurefile += 'lookup ' + lookupName + ' {' + lookup.marks.join(';\n') + ';\n' + lookup.bases.join(';\n') + ';} ' + lookupName + ';' + } // mkmk var mkmk = ttfFont.features.mkmk; diff --git a/glyphs/autobuilds.patel b/glyphs/autobuilds.patel index 1edc20c..6b39bb9 100644 --- a/glyphs/autobuilds.patel +++ b/glyphs/autobuilds.patel @@ -33,6 +33,7 @@ define customDecompositions ( ."\u1D7F" "\u028A\u0336" ."\u0289" "u\u0336" + ."\u0244" "U\u0336" ."\u0290" "z\u0322" ."\u0256" "d\u0322" @@ -490,7 +491,7 @@ create-glyph 'servicemark' : glyph-construction { ### Generate MARK and MKMK features -set font.features.mark (.marks () .bases ()) +set font.features.mark (.) set font.features.mkmk (.marks () .bases ()) set font.features.markGlyphs (.) @@ -499,14 +500,32 @@ define [buildAnchorDescription glyph inserter propx propy] : begin { foreach key [items-of : Object.keys glyph.anchors] : buf = buf + ' ' + inserter + ' @' + 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 + } + } +} +createMarkLookup 'above' +createMarkLookup 'below' +createMarkLookup 'trailing' +createMarkLookup 'lf' +createMarkLookup 'topright' +createMarkLookup 'bottomright' +createMarkLookup 'overlay' +createMarkLookup 'slash' +# mkmk 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 if isMarkGlyph { then { - font.features.mark.marks.push : 'markClass [' + glyph.name + '] ' + [buildAnchorDescription glyph '' 'x' 'y'] +# font.features.mark.marks.push : 'markClass [' + glyph.name + '] ' + [buildAnchorDescription glyph '' 'x' 'y'] 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 { @@ -514,6 +533,6 @@ foreach glyph [items-of glyphList] : if [glyph.anchors && [begin [local anchorKe font.features.markGlyphs.(key).push glyph.name } } - else : font.features.mark.bases.push : 'pos base [' + glyph.name + '] ' + [buildAnchorDescription glyph 'mark' 'x' 'y'] +# else : font.features.mark.bases.push : 'pos base [' + glyph.name + '] ' + [buildAnchorDescription glyph 'mark' 'x' 'y'] } } \ No newline at end of file diff --git a/glyphs/cyrillic-basic.patel b/glyphs/cyrillic-basic.patel index 00ca10c..3d70f28 100644 --- a/glyphs/cyrillic-basic.patel +++ b/glyphs/cyrillic-basic.patel @@ -43,8 +43,6 @@ define [CyrYeriShape top _left _right _fine] : glyph-construction { local right : fallback _right RIGHTSB local bowl : top * 0.55 + HALFSTROKE - local tkappa [COKAPPA - 0.22] - local bkappa [COKAPPA - 0.2] local turnbottom : bowl / 2 include : spiro { diff --git a/glyphs/latin-basic-capital.patel b/glyphs/latin-basic-capital.patel index 370b917..772fbe1 100644 --- a/glyphs/latin-basic-capital.patel +++ b/glyphs/latin-basic-capital.patel @@ -190,8 +190,6 @@ create-glyph 'K' : glyph-construction { ### B D P R define [BShape top] : glyph-construction { local bowl : top * 0.52 + HALFSTROKE - local tkappa [COKAPPA - 0.22] - local bkappa [COKAPPA - 0.2] local turntop : [top - [bowl - STROKE]] * 0.5 local turnbottom : bowl * 0.45 @@ -295,7 +293,6 @@ create-glyph 'C' : glyph-construction { set-width WIDTH assign-unicode 'C' include capitalMarks - include : spiro { widths.lhs g4 RIGHTSB [CAP - HOOK] diff --git a/glyphs/latin-basic-lower.patel b/glyphs/latin-basic-lower.patel index 2640359..5b1e9d4 100644 --- a/glyphs/latin-basic-lower.patel +++ b/glyphs/latin-basic-lower.patel @@ -202,7 +202,7 @@ define [SmallTShape top bot] : glyph-construction { curl center [bot + smb + STROKE] arcvh g4 turn [bot + O + STROKE] - quadcontrols [KAPPA_HOOK + TAILADJKAPPA * globalTransform.yx + 0.1] 0 + quadcontrols [KAPPA_HOOK + 0.75 * globalTransform.yx + 0.1] 0 g4 hookx [bot + HOOK + STROKE * 0.24] } diff --git a/glyphs/latin-extend-basis.patel b/glyphs/latin-extend-basis.patel index 63d5793..da80ffb 100644 --- a/glyphs/latin-extend-basis.patel +++ b/glyphs/latin-extend-basis.patel @@ -150,12 +150,7 @@ create-glyph 'Eth' : glyph-construction { assign-unicode 0xD0 include glyphs.D AS_BASE - include : create-stroke - :.start-from [SB * 0.3] [CAP * 0.54] - :.set-width HALFSTROKE HALFSTROKE - :.heads-to RIGHTWARD - :.line-to [mix [SB + STROKE] [RIGHTSB - STROKE] 0.55] [CAP * 0.54] - :.heads-to RIGHTWARD + include : HOverlayBar [SB * 0.3] [mix [SB + STROKE] [RIGHTSB - STROKE] 0.55] [CAP * BARPOS] } alias 'DCroat' 0x110 'Eth' alias 'arficanD' 0x189 'Eth' @@ -199,20 +194,17 @@ create-glyph 'Thorn' : glyph-construction { local bowlTop [CAP * 0.77] local bowlBottom [CAP * 0.23] - local bkappa [COKAPPA - 0.2] local turn : mix bowlTop bowlBottom 0.5 local turnRadius : [bowlTop - bowlBottom] / 2 - - include : create-stroke - :.start-from [SB * 1.25 + HALFSTROKE * 0.1] bowlTop - :.heads-to RIGHTWARD - :.set-width 0 STROKE - :.line-to [RIGHTSB - turnRadius] bowlTop - :.arc-hv-to [RIGHTSB - O] turn - :.arc-vh-to [RIGHTSB - turnRadius] bowlBottom - :.line-to [SB * 1.25 + HALFSTROKE * 0.1] bowlBottom - :.heads-to LEFTWARD + include : spiro { + widths.rhs + flat [SB * 1.25 + 1] bowlTop [heading RIGHTWARD] + curl [RIGHTSB - turnRadius] bowlTop + g4 [RIGHTSB - O] turn + flat [RIGHTSB - turnRadius] bowlBottom + curl [SB * 1.25 + 1] bowlBottom [heading LEFTWARD] + } include : create-stroke :.start-from [SB * 1.25] 0 @@ -693,6 +685,7 @@ alias 'smcpH' 0x29C 'cyren' alias 'latiniota' 0x269 'iota' alias 'revlatinepsilon' 0x25C 'cyrze' # Turned glyphs +turned nothing 0x2C6F 'A' MIDDLE [CAP / 2] turned nothing 0x250 'a' MIDDLE [XH / 2] turned nothing 0x252 'scripta' MIDDLE [XH / 2] turned nothing 0x186 'C' MIDDLE [CAP / 2] @@ -702,6 +695,7 @@ turned nothing 0x1DD 'e' MIDDLE [XH / 2] turned 'schwa' 0x259 'e' MIDDLE [XH / 2] turned nothing 0x1D77 'g' MIDDLE [mix DESCENDER XH 0.5] 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)))] diff --git a/glyphs/latin-extend-decorated.patel b/glyphs/latin-extend-decorated.patel index e98e75b..969bb6d 100644 --- a/glyphs/latin-extend-decorated.patel +++ b/glyphs/latin-extend-decorated.patel @@ -70,6 +70,16 @@ create-glyph 'tbar' : glyph-construction { include glyphs.t AS_BASE include : HOverlayBar [[mix MIDDLE SB 0.7] - TBALANCE * 0.5] [[mix MIDDLE RIGHTSB 0.7] - TBALANCE * 0.5] [mix 0 XH 0.6] } +create-glyph 'Cbar' : glyph-construction { + assign-unicode 0xA792 + include glyphs.C AS_BASE + include : HOverlayBar [SB * 0.3] [mix [SB + STROKE] [RIGHTSB - STROKE] 0.55] [CAP * BARPOS] +} +create-glyph 'cbar' : glyph-construction { + assign-unicode 0xA793 + include glyphs.c AS_BASE + include : HOverlayBar [SB * 0.3] [mix [SB + STROKE] [RIGHTSB - STROKE] 0.55] [XH * BARPOS] +} # Dotted create-glyph 'Ldot' : glyph-construction { assign-unicode 0x13F diff --git a/glyphs/overmarks.patel b/glyphs/overmarks.patel index f0da376..53aa83e 100644 --- a/glyphs/overmarks.patel +++ b/glyphs/overmarks.patel @@ -715,6 +715,24 @@ create-glyph 'longBarOver' : glyph-construction { set-anchor 'overlay' MARK markMiddle [XH / 2] markMiddle [XH / 2] include : HOverlayBar [[mix 0 SB 0.5] - WIDTH] [[mix WIDTH RIGHTSB 0.5] - WIDTH] [XH / 2] } +create-glyph 'slashOver' : glyph-construction { + set-width 0 + assign-unicode 0x337 + set-anchor 'slash' MARK markMiddle [XH / 2] markMiddle [XH / 2] + include : create-stroke + :.start-from [[mix 0 SB 0.5] - WIDTH] [XH * 0.25] + :.set-width markHalfStroke markHalfStroke + :.line-to [[mix WIDTH RIGHTSB 0.5] - WIDTH] [XH * 0.75] +} +create-glyph 'longSlashOver' : glyph-construction { + set-width 0 + assign-unicode 0x338 + set-anchor 'slash' MARK markMiddle [XH / 2] markMiddle [XH / 2] + include : create-stroke + :.start-from [[mix 0 SB 0.5] - WIDTH] [XH * 0.1] + :.set-width markHalfStroke markHalfStroke + :.line-to [[mix WIDTH RIGHTSB 0.5] - WIDTH] [XH * 0.9] +} # Double-character arcs create-glyph 'tieAbove' : glyph-construction { set-width 0 diff --git a/glyphs/symbol-geometric.patel b/glyphs/symbol-geometric.patel index f77d06e..089c364 100644 --- a/glyphs/symbol-geometric.patel +++ b/glyphs/symbol-geometric.patel @@ -156,15 +156,10 @@ let : begin { local cy : [XH / 2] + [RIGHTSB - MIDDLE] * [Math.sin angle] include : list : Ring [cy + fine] [cy - fine] [cx - fine] [cx + fine] true } - apply-transform : Upright - apply-transform : Translate 0 [parenMid - [XH / 2]] - apply-transform : Italify include eMarks - foreach k [items-of : Object.keys this.anchors] : begin { - set this.anchors.(k) (.x [this.anchors.(k).x + [parenMid - [XH / 2]] * globalTransform.yx] - .y [this.anchors.(k).y + [parenMid - [XH / 2]]] - .type this.anchors.(k).type ) - } + apply-transform [Upright] true + apply-transform [Translate 0 [parenMid - [XH / 2]]] true + apply-transform [Italify] true include : FullWidthify } diff --git a/parameters.patel b/parameters.patel index 596942c..6d24abc 100644 --- a/parameters.patel +++ b/parameters.patel @@ -11,6 +11,7 @@ define regular ( .descender [-194] .xheight 570 .barpos 0.52 + .overlaypos 0.52 .ebarpos 0.45 .gbarpos 0.35 .fivebarpos 0.55 diff --git a/support/stroke.patel b/support/stroke.patel index 6b87565..3aa24e5 100644 --- a/support/stroke.patel +++ b/support/stroke.patel @@ -13,9 +13,7 @@ define SAMPLES 3 define TINY 0.001 define LITTLE 0.01 define KAPPA 0.51 -define COKAPPA : 1 - KAPPA define BKAPPA : KAPPA + 0.1 -define COBKAPPA : COKAPPA - 0.1 define CKAPPA BKAPPA define [Stroke] : begin {