From c3b45df019e4cf6937bc9585bce6881aadffeaa0 Mon Sep 17 00:00:00 2001 From: be5invis Date: Thu, 26 Nov 2015 19:04:22 +0800 Subject: [PATCH] Fixed handling of contour tags. --- glyphs/latin-basic-lower.patel | 4 +++- glyphs/latin-extend-basis.patel | 3 ++- glyphs/latin-extend-decorated.patel | 30 +++++++++++++++++++---------- makesupport.mk | 2 +- support/glyph.patel | 14 +++++--------- 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/glyphs/latin-basic-lower.patel b/glyphs/latin-basic-lower.patel index c941a48..65478b9 100644 --- a/glyphs/latin-basic-lower.patel +++ b/glyphs/latin-basic-lower.patel @@ -264,7 +264,9 @@ create-glyph 'u' : glyph-construction assign-unicode 'u' include eMarks set-anchor 'trailing' BASE (RIGHTSB - markHalfStroke) 0 - include glyphs.n false {'serifRB', 'serifLB'} + include glyphs.n + eject-contour 'serifRB' + eject-contour 'serifLB' include : FlipAround MIDDLE (XH / 2) if SLAB : begin diff --git a/glyphs/latin-extend-basis.patel b/glyphs/latin-extend-basis.patel index 70d807a..0860b90 100644 --- a/glyphs/latin-extend-basis.patel +++ b/glyphs/latin-extend-basis.patel @@ -372,7 +372,8 @@ alias 'latinkappa' 0x138 'cyrka' create-glyph 'eng' : glyph-construction assign-unicode 0x14B include pMarks - include glyphs.n false {'serifRB'} + include glyphs.n false + eject-contour 'serifRB' include : VerticalHook (RIGHTSB - HALFSTROKE * CORRECTION_HX) 0 (-HOOKX) HOOK create-glyph 'Eng' : glyph-construction diff --git a/glyphs/latin-extend-decorated.patel b/glyphs/latin-extend-decorated.patel index 7482982..38cf68e 100644 --- a/glyphs/latin-extend-decorated.patel +++ b/glyphs/latin-extend-decorated.patel @@ -194,7 +194,8 @@ create-glyph 'ddot' : glyph-construction create-glyph 'rlongleg' : glyph-construction assign-unicode 0x27C include pMarks - include glyphs.r false {'serifLB'} + include glyphs.r false + eject-contour 'serifLB' include : VBarLeft (SB + RBALANCE) DESCENDER 0 if SLAB : begin include : CenterBottomSerif (SB + RBALANCE + STROKE * 0.75 * CORRECTION_HX) DESCENDER (JUT + HALFSTROKE / 2) @@ -211,22 +212,26 @@ create-glyph 'turnmleg' : glyph-construction # Hookleft create-glyph 'Bhookleft' : glyph-construction assign-unicode 0x181 - include glyphs.B AS_BASE {"serifLT"} + include glyphs.B AS_BASE + eject-contour "serifLT" include : LeftHook SB CAP create-glyph 'Dhookleft' : glyph-construction assign-unicode 0x18A - include glyphs.D AS_BASE {"serifLT"} + include glyphs.D AS_BASE + eject-contour "serifLT" include : LeftHook SB CAP create-glyph 'Phookleft' : glyph-construction assign-unicode 0x1A4 - include glyphs.P AS_BASE {"serifLT"} + include glyphs.P AS_BASE + eject-contour "serifLT" include : LeftHook (SB * 1.25) CAP create-glyph 'Thookleft' : glyph-construction assign-unicode 0x1AC - include capitalMarks {"serifLT"} + include capitalMarks + eject-contour "serifLT" include : LeftHook (SB + [adviceBlackness 4.25] * 1.5) CAP MIDDLE include : HBarTop MIDDLE RIGHTSB CAP include : VBar MIDDLE 0 CAP @@ -422,7 +427,8 @@ create-glyph 'fltail' : glyph-construction create-glyph 'Fltail' : glyph-construction assign-unicode 0x191 - include glyphs.F AS_BASE {'serifBottom'} + include glyphs.F AS_BASE + eject-contour 'serifBottom' include : VerticalHook (SB * 1.5 + HALFSTROKE * CORRECTION_HX) 0 (-HOOKX) HOOK create-glyph 'nltail' : glyph-construction @@ -441,7 +447,8 @@ create-glyph 'tltail' : glyph-construction create-glyph 'Nltail' : glyph-construction assign-unicode 0x19D - include glyphs.N AS_BASE {'serifLB'} + include glyphs.N AS_BASE + eject-contour 'serifLB' include : VerticalHook (SB + HALFSTROKE * CORRECTION_HX) 0 (-HOOKX) HOOK create-glyph 'mltail' : glyph-construction @@ -501,7 +508,8 @@ create-glyph 'lrtail' : glyph-construction create-glyph 'rrtail' : glyph-construction assign-unicode 0x27D include pMarks - include glyphs.r false {'serifLB'} + include glyphs.r false + eject-contour 'serifLB' include : create-glyph : glyph-construction include glyphs.rtailBR apply-transform : Upright @@ -511,7 +519,8 @@ create-glyph 'rrtail' : glyph-construction create-glyph 'turnrrtail' : glyph-construction assign-unicode 0x27B include pMarks - include glyphs.r false {'serifLT'} + include glyphs.r false + eject-contour 'serifLT' include : FlipAround MIDDLE (XH / 2) include : create-glyph : glyph-construction include glyphs.rtailBR @@ -803,7 +812,8 @@ create-glyph 'eshcurlytail' : glyph-construction local m1 : MIDDLE - HALFSTROKE * CORRECTION_HX - FBALANCE local x2 : mix RIGHTSB m1 0.25 local y2 : DESCENDER + O - include glyphs.'longs.upright' false {'serifMB'} + include glyphs.'longs.upright' false + eject-contour 'serifMB' include : dispiro widths.lhs flat m1 XH [heading DOWNWARD] diff --git a/makesupport.mk b/makesupport.mk index d539b70..3a087f6 100644 --- a/makesupport.mk +++ b/makesupport.mk @@ -5,7 +5,7 @@ SCRIPTS = $(SUPPORT_FILES) buildglyphs.js SCRIPTS_FROM_PATEL = $(SUPPORT_FILES_FROM_PATEL) buildglyphs.js buildglyphs.js : buildglyphs.patel $(GLYPH_SEGMENTS) - patel-c --strict $< -o $@ + patel-c --optimize --strict $< -o $@ $(SUPPORT_FILES_FROM_PATEL) : patel-c --optimize --strict $< -o $@ diff --git a/support/glyph.patel b/support/glyph.patel index d8752dd..7ddd034 100644 --- a/support/glyph.patel +++ b/support/glyph.patel @@ -88,7 +88,7 @@ define [Glyph.prototype.eject-contour tag] : begin set this.contours : this.contours.filter : lambda [c] (c.tag !== tag) return this -define [Glyph.prototype.include component copyAnchors quenches] : begin +define [Glyph.prototype.include component copyAnchors] : begin local glyph : match component [aFunction it] : return : component.call this {:: contours} {.contours contours} @@ -128,14 +128,10 @@ define [Glyph.prototype.include component copyAnchors quenches] : begin set transform.y : transform.y + shifty if contours : begin foreach [contour : items-of contours] : begin - local doput true - if quenches : foreach [tag : items-of quenches] : begin - if [contour.tag === tag] : set doput false - if doput : begin - local c {} - foreach [point : items-of contour] : c.push : tp transform point - set c.tag contour.tag - this.contours.push c + local c {} + foreach [point : items-of contour] : c.push : tp transform point + set c.tag : contour.tag || t.defaultTag + this.contours.push c if (([not contours] || copyAnchors) && glyph.anchors) : set this.anchors : let [a {.}] [anchors glyph.anchors] [keys : Object.keys glyph.anchors] : begin foreach k [items-of keys] [set a.(k) anchors.(k)] * a