Fixed handling of contour tags.

This commit is contained in:
be5invis 2015-11-26 19:04:22 +08:00
parent 50fdae2c96
commit c3b45df019
5 changed files with 31 additions and 22 deletions

View File

@ -264,7 +264,9 @@ create-glyph 'u' : glyph-construction
assign-unicode 'u' assign-unicode 'u'
include eMarks include eMarks
set-anchor 'trailing' BASE (RIGHTSB - markHalfStroke) 0 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) include : FlipAround MIDDLE (XH / 2)
if SLAB : begin if SLAB : begin

View File

@ -372,7 +372,8 @@ alias 'latinkappa' 0x138 'cyrka'
create-glyph 'eng' : glyph-construction create-glyph 'eng' : glyph-construction
assign-unicode 0x14B assign-unicode 0x14B
include pMarks include pMarks
include glyphs.n false {'serifRB'} include glyphs.n false
eject-contour 'serifRB'
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

View File

@ -194,7 +194,8 @@ create-glyph 'ddot' : glyph-construction
create-glyph 'rlongleg' : glyph-construction create-glyph 'rlongleg' : glyph-construction
assign-unicode 0x27C assign-unicode 0x27C
include pMarks include pMarks
include glyphs.r false {'serifLB'} include glyphs.r false
eject-contour 'serifLB'
include : VBarLeft (SB + RBALANCE) DESCENDER 0 include : VBarLeft (SB + RBALANCE) DESCENDER 0
if SLAB : begin if SLAB : begin
include : CenterBottomSerif (SB + RBALANCE + STROKE * 0.75 * CORRECTION_HX) DESCENDER (JUT + HALFSTROKE / 2) include : CenterBottomSerif (SB + RBALANCE + STROKE * 0.75 * CORRECTION_HX) DESCENDER (JUT + HALFSTROKE / 2)
@ -211,22 +212,26 @@ create-glyph 'turnmleg' : glyph-construction
# Hookleft # Hookleft
create-glyph 'Bhookleft' : glyph-construction create-glyph 'Bhookleft' : glyph-construction
assign-unicode 0x181 assign-unicode 0x181
include glyphs.B AS_BASE {"serifLT"} include glyphs.B AS_BASE
eject-contour "serifLT"
include : LeftHook SB CAP include : LeftHook SB CAP
create-glyph 'Dhookleft' : glyph-construction create-glyph 'Dhookleft' : glyph-construction
assign-unicode 0x18A assign-unicode 0x18A
include glyphs.D AS_BASE {"serifLT"} include glyphs.D AS_BASE
eject-contour "serifLT"
include : LeftHook SB CAP include : LeftHook SB CAP
create-glyph 'Phookleft' : glyph-construction create-glyph 'Phookleft' : glyph-construction
assign-unicode 0x1A4 assign-unicode 0x1A4
include glyphs.P AS_BASE {"serifLT"} include glyphs.P AS_BASE
eject-contour "serifLT"
include : LeftHook (SB * 1.25) CAP include : LeftHook (SB * 1.25) CAP
create-glyph 'Thookleft' : glyph-construction create-glyph 'Thookleft' : glyph-construction
assign-unicode 0x1AC assign-unicode 0x1AC
include capitalMarks {"serifLT"} include capitalMarks
eject-contour "serifLT"
include : LeftHook (SB + [adviceBlackness 4.25] * 1.5) CAP MIDDLE include : LeftHook (SB + [adviceBlackness 4.25] * 1.5) CAP MIDDLE
include : HBarTop MIDDLE RIGHTSB CAP include : HBarTop MIDDLE RIGHTSB CAP
include : VBar MIDDLE 0 CAP include : VBar MIDDLE 0 CAP
@ -422,7 +427,8 @@ create-glyph 'fltail' : glyph-construction
create-glyph 'Fltail' : glyph-construction create-glyph 'Fltail' : glyph-construction
assign-unicode 0x191 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 include : VerticalHook (SB * 1.5 + HALFSTROKE * CORRECTION_HX) 0 (-HOOKX) HOOK
create-glyph 'nltail' : glyph-construction create-glyph 'nltail' : glyph-construction
@ -441,7 +447,8 @@ create-glyph 'tltail' : glyph-construction
create-glyph 'Nltail' : glyph-construction create-glyph 'Nltail' : glyph-construction
assign-unicode 0x19D 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 include : VerticalHook (SB + HALFSTROKE * CORRECTION_HX) 0 (-HOOKX) HOOK
create-glyph 'mltail' : glyph-construction create-glyph 'mltail' : glyph-construction
@ -501,7 +508,8 @@ create-glyph 'lrtail' : glyph-construction
create-glyph 'rrtail' : glyph-construction create-glyph 'rrtail' : glyph-construction
assign-unicode 0x27D assign-unicode 0x27D
include pMarks include pMarks
include glyphs.r false {'serifLB'} include glyphs.r false
eject-contour 'serifLB'
include : create-glyph : glyph-construction include : create-glyph : glyph-construction
include glyphs.rtailBR include glyphs.rtailBR
apply-transform : Upright apply-transform : Upright
@ -511,7 +519,8 @@ create-glyph 'rrtail' : glyph-construction
create-glyph 'turnrrtail' : glyph-construction create-glyph 'turnrrtail' : glyph-construction
assign-unicode 0x27B assign-unicode 0x27B
include pMarks include pMarks
include glyphs.r false {'serifLT'} include glyphs.r false
eject-contour 'serifLT'
include : FlipAround MIDDLE (XH / 2) include : FlipAround MIDDLE (XH / 2)
include : create-glyph : glyph-construction include : create-glyph : glyph-construction
include glyphs.rtailBR include glyphs.rtailBR
@ -803,7 +812,8 @@ create-glyph 'eshcurlytail' : glyph-construction
local m1 : MIDDLE - HALFSTROKE * CORRECTION_HX - FBALANCE local m1 : MIDDLE - HALFSTROKE * CORRECTION_HX - FBALANCE
local x2 : mix RIGHTSB m1 0.25 local x2 : mix RIGHTSB m1 0.25
local y2 : DESCENDER + O local y2 : DESCENDER + O
include glyphs.'longs.upright' false {'serifMB'} include glyphs.'longs.upright' false
eject-contour 'serifMB'
include : dispiro include : dispiro
widths.lhs widths.lhs
flat m1 XH [heading DOWNWARD] flat m1 XH [heading DOWNWARD]

View File

@ -5,7 +5,7 @@ SCRIPTS = $(SUPPORT_FILES) buildglyphs.js
SCRIPTS_FROM_PATEL = $(SUPPORT_FILES_FROM_PATEL) buildglyphs.js SCRIPTS_FROM_PATEL = $(SUPPORT_FILES_FROM_PATEL) buildglyphs.js
buildglyphs.js : buildglyphs.patel $(GLYPH_SEGMENTS) buildglyphs.js : buildglyphs.patel $(GLYPH_SEGMENTS)
patel-c --strict $< -o $@ patel-c --optimize --strict $< -o $@
$(SUPPORT_FILES_FROM_PATEL) : $(SUPPORT_FILES_FROM_PATEL) :
patel-c --optimize --strict $< -o $@ patel-c --optimize --strict $< -o $@

View File

@ -88,7 +88,7 @@ define [Glyph.prototype.eject-contour tag] : begin
set this.contours : this.contours.filter : lambda [c] (c.tag !== tag) set this.contours : this.contours.filter : lambda [c] (c.tag !== tag)
return this return this
define [Glyph.prototype.include component copyAnchors quenches] : begin define [Glyph.prototype.include component copyAnchors] : begin
local glyph : match component local glyph : match component
[aFunction it] : return : component.call this [aFunction it] : return : component.call this
{:: contours} {.contours contours} {:: contours} {.contours contours}
@ -128,14 +128,10 @@ define [Glyph.prototype.include component copyAnchors quenches] : begin
set transform.y : transform.y + shifty set transform.y : transform.y + shifty
if contours : begin if contours : begin
foreach [contour : items-of contours] : begin foreach [contour : items-of contours] : begin
local doput true local c {}
if quenches : foreach [tag : items-of quenches] : begin foreach [point : items-of contour] : c.push : tp transform point
if [contour.tag === tag] : set doput false set c.tag : contour.tag || t.defaultTag
if doput : begin this.contours.push c
local c {}
foreach [point : items-of contour] : c.push : tp transform point
set c.tag contour.tag
this.contours.push c
if (([not contours] || copyAnchors) && glyph.anchors) : set this.anchors : let [a {.}] [anchors glyph.anchors] [keys : Object.keys glyph.anchors] : begin 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)] foreach k [items-of keys] [set a.(k) anchors.(k)]
* a * a