From f87c4549332823199b6af321a1dde88cecdeb962 Mon Sep 17 00:00:00 2001 From: Belleve Invis Date: Mon, 27 Jul 2015 00:49:00 +0800 Subject: [PATCH] LATIN-1 COMPLETE! --- buildglyphs-intro.patel | 2 + glyphs/autobuilds.patel | 67 ++++++++++++++++--- glyphs/common-shapes.patel | 10 +++ glyphs/latin-basic-lower.patel | 34 +++++----- glyphs/numbers.patel | 14 +++- glyphs/overmarks.patel | 8 +-- glyphs/symbol-ascii.patel | 91 ++++++------------------- glyphs/symbol-extend.patel | 118 +++++++++++++++++++++++++++++++-- pass1-cleanup.pe | 4 +- support/glyph.patel | 18 ++++- 10 files changed, 255 insertions(+), 111 deletions(-) diff --git a/buildglyphs-intro.patel b/buildglyphs-intro.patel index fc95418d7..75965744c 100644 --- a/buildglyphs-intro.patel +++ b/buildglyphs-intro.patel @@ -178,6 +178,8 @@ define-macro glyph-construction : syntax-rules { local line-to : this.line-to.bind this local curve-to : this.curve-to.bind this local cubic-to : this.cubic-to.bind this + local arc-hv-to : this.arc-hv-to.bind this + local arc-vh-to : this.arc-vh-to.bind this local put-shapes : this.put-shapes.bind this local reverse-last : this.reverse-last.bind this local include : this.include.bind this diff --git a/glyphs/autobuilds.patel b/glyphs/autobuilds.patel index 16acf8e99..63dab8547 100644 --- a/glyphs/autobuilds.patel +++ b/glyphs/autobuilds.patel @@ -40,7 +40,7 @@ define [createSuperscripts records] : if [not recursive] : begin { include miniatureFont.(glyphid) apply-transform : Upright apply-transform : Translate [-MIDDLE] [-CAP] - apply-transform : Scale 0.6 + apply-transform : Scale 0.7 apply-transform : Translate MIDDLE CAP apply-transform : Italify } @@ -55,13 +55,41 @@ define [createSubscripts records] : if [not recursive] : begin { include miniatureFont.(glyphid) apply-transform : Upright apply-transform : Translate [-MIDDLE] 0 - apply-transform : Scale 0.6 - apply-transform : Translate MIDDLE [-DESCENDER / 2] + apply-transform : Scale 0.7 + apply-transform : Translate MIDDLE [DESCENDER / 2] apply-transform : Italify } } } +define [createFractions records] : if [not recursive] : begin { + local pendingGlyphs : [records.map : [record] -> record.1].concat : records.map : [record] -> record.2 + local miniatureFont : Miniature pendingGlyphs 4 0.6 + foreach (unicode numid denid) [items-of records] : create-glyph ['fraction_' + numid + '_' + denid] : glyph-construction { + if unicode : assign-unicode unicode + local fine : adviceBlackness 4.2 + include : create-glyph : glyph-construction { + include : create-glyph : glyph-construction { + include miniatureFont.(numid) + apply-transform : Translate [MIDDLE - miniatureFont.(numid).advanceWidth / 2] 0 + } + apply-transform : Upright + apply-transform : Translate 0 [CAP + fine * 4] + apply-transform : Italify + include : create-glyph : glyph-construction { + include miniatureFont.(denid) + apply-transform : Translate [MIDDLE - miniatureFont.(denid).advanceWidth / 2] 0 + } + apply-transform : Upright + apply-transform : Translate [-MIDDLE] [-CAP - fine * 2] + apply-transform : Scale 0.5 + apply-transform : Translate MIDDLE parenMid + apply-transform : Italify + } + include : hbar SB RIGHTSB parenMid fine + } +} + createCircledGlyphs : list { list 0xA9 'C' list 0xAE 'R' @@ -70,33 +98,33 @@ createCircledGlyphs : list { create-glyph 'ordfeminine' : glyph-construction { assign-unicode 0xAA - include : Miniature ('a') 4.2 0.6 + include [Miniature ('a') 4.2 0.6].a include : create-stroke :.start-from SB DESCENDER :.set-width STROKE 0 :.heads-to RIGHTWARD :.line-to RIGHTSB DESCENDER :.heads-to RIGHTWARD - + apply-transform : Upright apply-transform : Translate [-MIDDLE] [-XH] - apply-transform : Scale 0.6 + apply-transform : Scale 0.7 apply-transform : Translate MIDDLE CAP apply-transform : Italify } create-glyph 'ordmasculine' : glyph-construction { assign-unicode 0xBA - include : Miniature ('o') 4.2 0.6 + include [Miniature ('o') 4.2 0.6].o include : create-stroke :.start-from SB DESCENDER :.set-width STROKE 0 :.heads-to RIGHTWARD :.line-to RIGHTSB DESCENDER :.heads-to RIGHTWARD - + apply-transform : Upright apply-transform : Translate [-MIDDLE] [-XH] - apply-transform : Scale 0.6 + apply-transform : Scale 0.7 apply-transform : Translate MIDDLE CAP apply-transform : Italify } @@ -188,6 +216,27 @@ createSubscripts : list { list 0x1D65 'v' } +createFractions : list { + list 0x00BC 'one' 'four' + list 0x00BD 'one' 'two' + list 0x00BE 'three' 'four' + list 0x2150 'one' 'seven' + list 0x2151 'one' 'nine' + list 0x2152 'one' 'ten' + list 0x2153 'one' 'three' + list 0x2154 'two' 'three' + list 0x2155 'one' 'five' + list 0x2156 'two' 'five' + list 0x2157 'three' 'five' + list 0x2158 'four' 'five' + list 0x2159 'one' 'six' + list 0x215A 'five' 'six' + list 0x215B 'one' 'eight' + list 0x215C 'three' 'eight' + list 0x215D 'five' 'eight' + list 0x215E 'seven' 'eight' +} + # Composite superscripts and subscripts define [doubleSuperscript a b] : glyph-construction { include a diff --git a/glyphs/common-shapes.patel b/glyphs/common-shapes.patel index 8dd3ea61f..2b1012ca9 100644 --- a/glyphs/common-shapes.patel +++ b/glyphs/common-shapes.patel @@ -258,4 +258,14 @@ define [vbar x ydown yup _fine] : glyph-construction { :.set-width fine fine :.line-to x yup :.heads-to [if [ydown < yup] UPWARD DOWNWARD] +} + + +# Common transformations +define [FlipAround x y] : glyph-construction { + apply-transform : Upright + apply-transform : Translate [-x] [-y] + apply-transform : Scale [-1] + apply-transform : Translate x y + apply-transform : Italify } \ No newline at end of file diff --git a/glyphs/latin-basic-lower.patel b/glyphs/latin-basic-lower.patel index c4f7878d2..b65fe8e72 100644 --- a/glyphs/latin-basic-lower.patel +++ b/glyphs/latin-basic-lower.patel @@ -34,10 +34,10 @@ define [oLeft] : glyph-construction { :.start-from MIDDLE [O + STROKE] :.heads-to LEFTWARD :.set-width STROKE 0 - :.arc-hv-to [SB + STROKE] [SMALLSMOOTHB - STROKE * 0.05] - :.set-width HALFSTROKE 0 - :.line-to [SB + STROKE] [XH - SMALLSMOOTHA + STROKE * 0.05] - :.set-width HALFSTROKE 0 + :.arc-hv-to [SB + STROKE * ITALICCOR] [SMALLSMOOTHB - STROKE * 0.05] + :.set-width [STROKE * 0.25] 0 + :.line-to [SB + STROKE * ITALICCOR] [XH - SMALLSMOOTHA + STROKE * 0.05] + :.set-width [STROKE * 0.25] 0 :.arc-vh-to MIDDLE [XO - STROKE] :.set-width STROKE 0 :.heads-to RIGHTWARD @@ -57,10 +57,10 @@ define [oRight] : glyph-construction { :.start-from MIDDLE [O + STROKE] :.heads-to RIGHTWARD :.set-width 0 STROKE - :.arc-hv-to [RIGHTSB - STROKE] [SMALLSMOOTHA - STROKE * 0.05] - :.set-width 0 HALFSTROKE - :.line-to [RIGHTSB - STROKE] [XH - SMALLSMOOTHB + STROKE * 0.05] - :.set-width 0 HALFSTROKE + :.arc-hv-to [RIGHTSB - STROKE * ITALICCOR] [SMALLSMOOTHA - STROKE * 0.05] + :.set-width 0 [STROKE * 0.25] + :.line-to [RIGHTSB - STROKE * ITALICCOR] [XH - SMALLSMOOTHB + STROKE * 0.05] + :.set-width 0 [STROKE * 0.25] :.arc-vh-to MIDDLE [XO - STROKE] :.set-width 0 STROKE :.heads-to LEFTWARD @@ -212,6 +212,7 @@ create-glyph 'e.italic' : glyph-construction { :.arc-vh-to MIDDLE O :.heads-to RIGHTWARD :.curve-to [MIDDLE + [KAPPA_HOOK + TAILADJKAPPA * globalTransform.yx] * [MIDDLE - SB]] O [RIGHTSB - OXHOOK + TAILADJX * globalTransform.yx] [HOOK - TAILADJY * globalTransform.yx] + :.set-samples 4 } create-glyph 'e' : glyph-construction { set-width WIDTH @@ -698,16 +699,17 @@ create-glyph 'r' : glyph-construction { :.heads-to LEFTWARD include : create-stroke :.start-from rmiddle [XO - STROKE] - :.set-width 0 STROKE - :.heads-to LEFTWARD - :.arc-hv-to [SB + STROKE * ITALICCOR + RBALANCE] [XH - SMALLSMOOTHA] - :.heads-to DOWNWARD - :.set-width 0 [STROKE * 0.3] + :.set-width 0 STROKE + :.heads-to LEFTWARD + :.arc-hv-to [SB + STROKE * ITALICCOR + RBALANCE] [XH - SMALLSMOOTHA] + :.heads-to DOWNWARD + :.set-width 0 [STROKE * 0.3] include : create-stroke :.start-from [SB + RBALANCE] 0 - :.heads-to UPWARD - :.set-width 0 STROKE - :.line-to [SB + RBALANCE] XH + :.heads-to UPWARD + :.set-width 0 STROKE + :.line-to [SB + RBALANCE] XH + :.heads-to UPWARD } ### f diff --git a/glyphs/numbers.patel b/glyphs/numbers.patel index 75e0fc2a0..53bf2cfcd 100644 --- a/glyphs/numbers.patel +++ b/glyphs/numbers.patel @@ -33,13 +33,13 @@ create-glyph 'one' : glyph-construction { assign-unicode '1' include : create-stroke - :.start-from [MIDDLE + JBALANCE * 0.6] 0 + :.start-from [MIDDLE + JBALANCE * 0.5] 0 :.set-width HALFSTROKE HALFSTROKE :.heads-to UPWARD - :.line-to [MIDDLE + JBALANCE * 0.6] CAP + :.line-to [MIDDLE + JBALANCE * 0.5] CAP :.heads-to UPWARD include : create-stroke - :.start-from [MIDDLE - HALFSTROKE + JBALANCE * 0.6] CAP + :.start-from [MIDDLE - HALFSTROKE + JBALANCE * 0.5] CAP :.set-width STROKE 0 :.line-to [MIDDLE - HOOK * 1.5 + JBALANCE * 0.5] [CAP - HOOK * 0.75] } @@ -198,4 +198,12 @@ create-glyph 'nine' : glyph-construction { :.set-width 0 STROKE :.line-to RIGHTSB [CAP * 0.4] include : sHookLower 0 [CAP * 0.4] HOOK [mix SB RIGHTSB 0.48] +} + +create-glyph 'ten' : glyph-construction { + set-width : WIDTH * 2 + include glyphs.one + apply-transform : Translate [-WIDTH] 0 + include glyphs.zero + apply-transform : Translate WIDTH 0 } \ No newline at end of file diff --git a/glyphs/overmarks.patel b/glyphs/overmarks.patel index c113f2efb..9635e2570 100644 --- a/glyphs/overmarks.patel +++ b/glyphs/overmarks.patel @@ -203,8 +203,8 @@ create-glyph 'doubleGraveAbove' : glyph-construction { assign-unicode 0x30F set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop - local m1 : markMiddle - markExtend * 0.75 - local m2 : markMiddle + markExtend * 0.75 + local m1 : markMiddle - markExtend * 0.85 + local m2 : markMiddle + markExtend * 0.85 include : create-stroke :.start-from [m1 + markStress] aboveMarkBot :.set-width markFine markFine @@ -223,8 +223,8 @@ create-glyph 'doubleAcuteAbove' : glyph-construction { assign-unicode 0x30B set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop - local m1 : markMiddle - markExtend * 0.75 - local m2 : markMiddle + markExtend * 0.75 + local m1 : markMiddle - markExtend * 0.85 + local m2 : markMiddle + markExtend * 0.85 include : create-stroke :.start-from [m1 - markStress] aboveMarkBot :.set-width markFine markFine diff --git a/glyphs/symbol-ascii.patel b/glyphs/symbol-ascii.patel index 32afddc9a..f7074d80c 100644 --- a/glyphs/symbol-ascii.patel +++ b/glyphs/symbol-ascii.patel @@ -121,13 +121,8 @@ create-glyph 'parenright' : glyph-construction { set-width WIDTH assign-unicode ')' - local p 0.6 - - include : create-stroke - :.start-from [mix RIGHTSB SB parenInside] parenTop - :.set-width 0 STROKE - :.curve-to [mix RIGHTSB SB parenOutside] [mix parenMid parenTop p] [mix RIGHTSB SB parenOutside] parenMid - :.curve-to [mix RIGHTSB SB parenOutside] [mix parenMid parenBot p] [mix RIGHTSB SB parenInside] parenBot + include glyphs.parenleft + include : FlipAround MIDDLE parenMid } create-glyph 'bracketleft' : glyph-construction { @@ -156,30 +151,12 @@ create-glyph 'bracketleft' : glyph-construction { :.heads-to UPWARD } -create-glyph 'parenright' : glyph-construction { +create-glyph 'bracketright' : glyph-construction { set-width WIDTH assign-unicode ']' - include : create-stroke - :.start-from [mix RIGHTSB SB bracketOutside] parenBot - :.set-width 0 STROKE - :.heads-to LEFTWARD - :.line-to [mix RIGHTSB SB bracketInside] parenBot - :.heads-to LEFTWARD - - include : create-stroke - :.start-from [mix RIGHTSB SB bracketOutside] parenTop - :.set-width STROKE 0 - :.heads-to LEFTWARD - :.line-to [mix RIGHTSB SB bracketInside] parenTop - :.heads-to LEFTWARD - - include : create-stroke - :.start-from [mix RIGHTSB SB bracketOutside] parenBot - :.set-width STROKE 0 - :.heads-to UPWARD - :.line-to [mix RIGHTSB SB bracketOutside] parenTop - :.heads-to UPWARD + include glyphs.bracketleft + include : FlipAround MIDDLE parenMid } create-glyph 'braceleft' : glyph-construction { @@ -212,26 +189,8 @@ create-glyph 'braceright' : glyph-construction { set-width WIDTH assign-unicode '}' - local parenCenter [mix RIGHTSB SB [mix braceInside braceOutside 0.5]] - local radius : [mix RIGHTSB SB braceOutside] - parenCenter - - include : create-stroke - :.start-from [mix RIGHTSB SB braceInside] [parenTop - HALFSTROKE] - :.set-width HALFSTROKE HALFSTROKE - :.heads-to RIGHTWARD - :.arc-hv-to parenCenter [parenTop - radius] - :.line-to parenCenter [parenMid + radius] - :.arc-vh-to [mix RIGHTSB SB braceOutside] parenMid - :.heads-to RIGHTWARD - - include : create-stroke - :.start-from [mix RIGHTSB SB braceInside] [parenBot + HALFSTROKE] - :.set-width HALFSTROKE HALFSTROKE - :.heads-to RIGHTWARD - :.arc-hv-to parenCenter [parenBot + radius] - :.line-to parenCenter [parenMid - radius] - :.arc-vh-to [mix RIGHTSB SB braceOutside] parenMid - :.heads-to RIGHTWARD + include glyphs.braceleft + include : FlipAround MIDDLE parenMid } ### Symbols with dots: period, comma, colon, semicolon @@ -298,8 +257,12 @@ create-glyph 'underscore' : glyph-construction { set-width WIDTH assign-unicode '_' - include : create-stroke :.start-from SB 0 :.heads-to RIGHTWARD :.set-width STROKE 0 - :.line-to RIGHTSB 0 :.heads-to RIGHTWARD + include : create-stroke + :.start-from SB 0 + :.heads-to RIGHTWARD + :.set-width STROKE 0 + :.line-to RIGHTSB 0 + :.heads-to RIGHTWARD } create-glyph 'hyphen' : glyph-construction { @@ -350,13 +313,8 @@ create-glyph 'backslash' : glyph-construction { set-width WIDTH assign-unicode "\\" - local cor : 1 / [Math.sqrt [1 - [Math.pow [[RIGHTSB - SB - STROKE] / [parenTop - parenBot]] 2]]] - - start-from RIGHTSB parenBot - line-to [RIGHTSB - STROKE * cor] parenBot - line-to SB parenTop - line-to [SB + STROKE * cor] parenTop - reverse-last + include glyphs.slash + include : FlipAround MIDDLE parenMid } create-glyph 'numbersign' : glyph-construction { set-width WIDTH @@ -374,8 +332,8 @@ create-glyph 'less' : glyph-construction { set-width WIDTH assign-unicode '<' - local top : mix 0 CAP 0.75 - local bot : mix 0 CAP 0.1 + local top : mix parenMid parenTop 0.5 + local bot : mix parenMid parenBot 0.5 include : create-stroke :.start-from RIGHTSB top @@ -399,19 +357,8 @@ create-glyph 'greater' : glyph-construction { local top : mix 0 CAP 0.75 local bot : mix 0 CAP 0.1 - include : create-stroke - :.start-from SB top - :.set-width HALFSTROKE HALFSTROKE - :.line-to RIGHTSB [mix top bot 0.5] - :.heads-to RIGHTWARD - :.set-samples 1 - - include : create-stroke - :.start-from RIGHTSB [mix top bot 0.5] - :.set-width HALFSTROKE HALFSTROKE - :.heads-to LEFTWARD - :.line-to SB bot - :.set-samples 1 + include glyphs.less + include : FlipAround MIDDLE parenMid } ### Overmarks diff --git a/glyphs/symbol-extend.patel b/glyphs/symbol-extend.patel index ab822cd61..18197ff1e 100644 --- a/glyphs/symbol-extend.patel +++ b/glyphs/symbol-extend.patel @@ -1,5 +1,10 @@ ### Extended symbols +create-glyph 'nbsp' : glyph-construction { + assign-unicode 0xA0 + include glyphs.space +} + create-glyph 'cent' : glyph-construction { assign-unicode 0xA2 include glyphs.c AS_BASE @@ -79,11 +84,10 @@ create-glyph 'sterling' : glyph-construction { assign-unicode 0xA3 set-width WIDTH include glyphs.'longs.upright' - apply-transform : Translate [-WIDTH * 0.15] 0 - include : fBar [mix SB RIGHTSB 0.05] [[mix SB RIGHTSB 0.65] + HALFSTROKE] [CAP * 0.5 + STROKE] + apply-transform : Translate [-WIDTH * 0.125] 0 + include : fBar [mix SB RIGHTSB 0.05] [mix SB RIGHTSB 0.7] [CAP * 0.5 + STROKE] include glyphs.underscore } - create-glyph 'micro' : glyph-construction { set-width WIDTH assign-unicode 0xB5 @@ -109,7 +113,7 @@ create-glyph 'bullet' : glyph-construction { } create-glyph 'currency' : glyph-construction { assign-unicode 0xA4 - local sw : adviceBlackness 5 + local sw : adviceBlackness 3.5 local radius : [RIGHTSB - SB] / 2 include : smallo [parenMid + radius * 0.9] [parenMid - radius * 0.9] [MIDDLE - radius * 0.9] [MIDDLE + radius * 0.9] sw foreach j [range 0 4] : begin { @@ -125,4 +129,110 @@ create-glyph 'euro' : glyph-construction { include glyphs.C include : hbar [SB - HALFSTROKE] [mix SB RIGHTSB 0.7] [CAP * 0.4] [adviceBlackness 4] include : hbar [SB - HALFSTROKE] [mix SB RIGHTSB 0.7] [CAP * 0.6] [adviceBlackness 4] +} +create-glyph 'multiply' : glyph-construction { + assign-unicode 0xD7 + local radius : [RIGHTSB - SB] / 2 + include : create-stroke + :.start-from [MIDDLE - radius] [parenMid - radius] + :.set-width HALFSTROKE HALFSTROKE + :.line-to [MIDDLE + radius] [parenMid + radius] + + include : create-stroke + :.start-from [MIDDLE + radius] [parenMid - radius] + :.set-width HALFSTROKE HALFSTROKE + :.line-to [MIDDLE - radius] [parenMid + radius] +} +create-glyph 'divide' : glyph-construction { + assign-unicode 0xF7 + include glyphs.hyphen + local radius : [RIGHTSB - SB] / 2 + include : list { + Ring [parenMid + radius + DOTRADIUS] [parenMid + radius - DOTRADIUS] [MIDDLE - DOTRADIUS + O] [MIDDLE + DOTRADIUS - O] + Ring [parenMid - radius + DOTRADIUS] [parenMid - radius - DOTRADIUS] [MIDDLE - DOTRADIUS + O] [MIDDLE + DOTRADIUS - O] + } +} +create-glyph 'brokenbar' : glyph-construction { + assign-unicode 0xA6 + include : vbar MIDDLE [parenMid + HALFSTROKE] parenTop + include : vbar MIDDLE parenBot [parenMid - HALFSTROKE] +} +create-glyph 'singleguillemetleft' : glyph-construction { + set-width WIDTH + assign-unicode 0x2039 + + local top : mix parenMid parenTop 0.5 + local bot : mix parenMid parenBot 0.5 + local extension 0.55 + local extension2x [-0.2] + local extension2y 0.375 + local cor 1 + + local halfsw : 0.5 * [adviceBlackness 3.5] + + include : create-stroke + :.start-from [mix MIDDLE RIGHTSB extension] top + :.set-width halfsw halfsw + :.curve-to [mix MIDDLE SB extension2x] [mix top bot extension2y] [mix MIDDLE SB extension] [mix top bot 0.5] + :.set-width [halfsw * cor] [halfsw * cor] + :.heads-to LEFTWARD + :.set-samples 1 + + include : create-stroke + :.start-from [mix MIDDLE SB extension] [mix top bot 0.5] + :.set-width [halfsw * cor] [halfsw * cor] + :.heads-to RIGHTWARD + :.curve-to [mix MIDDLE SB extension2x] [mix bot top extension2y] [mix MIDDLE RIGHTSB extension] bot + :.set-width halfsw halfsw + :.set-samples 1 + + apply-transform : Translate [-[RIGHTSB - SB] * 0.05] 0 +} +create-glyph 'guillemetleft' : glyph-construction { + set-width WIDTH + assign-unicode 0xAB + + include glyphs.singleguillemetleft + apply-transform : Translate [[RIGHTSB - SB] * 0.5] 0 + include glyphs.singleguillemetleft + apply-transform : Translate [-[RIGHTSB - SB] * 0.25] 0 +} + +create-glyph 'singleguillemetright' : glyph-construction { + set-width WIDTH + assign-unicode 0x203A + + include glyphs.singleguillemetleft + include : FlipAround MIDDLE parenMid +} +create-glyph 'guillemetright' : glyph-construction { + set-width WIDTH + assign-unicode 0xBB + + include glyphs.guillemetleft + include : FlipAround MIDDLE parenMid +} + +create-glyph 'paragraph' : glyph-construction { + set-width WIDTH + assign-unicode 0xB6 + local sw : adviceBlackness 3.6 + + include : vbar [MIDDLE + sw / 4] 0 CAP sw + include : vbar [RIGHTSB - sw / 2] 0 CAP sw + include : create-stroke + :.start-from [MIDDLE - sw / 4] [CAP - sw / 2] + :.set-width [sw / 2] [sw / 2] + :.heads-to LEFTWARD + :.arc-hv-to [SB + sw / 2] [mix [CAP * 0.5] [CAP - sw / 2] 0.5] + :.heads-to DOWNWARD + :.arc-vh-to [MIDDLE - sw / 4] [CAP * 0.5] + :.heads-to RIGHTWARD +} +create-glyph 'negate' : glyph-construction { + assign-unicode 0xAC + + include glyphs.hyphen + + include : vbar [RIGHTSB - HALFSTROKE] [hyphenCenter - [RIGHTSB - SB] * 0.55] [hyphenCenter + HALFSTROKE] } \ No newline at end of file diff --git a/pass1-cleanup.pe b/pass1-cleanup.pe index 6a44146f6..88341648a 100644 --- a/pass1-cleanup.pe +++ b/pass1-cleanup.pe @@ -10,13 +10,13 @@ ClearTable('maxp'); Print("Outline Cleanup..."); Simplify(-1, 0); -ReplaceWithReference(2, 1); +ReplaceWithReference(); RemoveOverlap(); RoundToInt() RemoveOverlap(); UnlinkReference(); RemoveOverlap(); -ReplaceWithReference(5, 1); +ReplaceWithReference(4, 1); CorrectDirection(); CanonicalContours(); CanonicalStart(); diff --git a/support/glyph.patel b/support/glyph.patel index 74790557d..7b422e468 100644 --- a/support/glyph.patel +++ b/support/glyph.patel @@ -1,5 +1,6 @@ define bezierCubic2Q2 [require 'node-sfnt/lib/math/bezierCubic2Q2'] define tp [require './transform'].transformPoint +define utp [require './transform'].untransform define Stroke [require './stroke'].Stroke define id ( @@ -59,10 +60,25 @@ define [Glyph.prototype.curve-to xc yc x y] : begin { this.contours`[this.contours.length - 1].push [tp this.gizmo (.x xc .y yc .onCurve false)] [tp this.gizmo (.x x .y y .onCurve true)] return this } +define [Glyph.prototype.arc-vh-to x y kappa] : begin { + local lastContour this.contours`[this.contours.length - 1] + local lastPoint lastContour`[lastContour.length - 1] + local last : utp this.gizmo lastPoint + this.cubic-to last.x [last.y + [fallback kappa 0.618] * [y - last.y]] [x + [fallback kappa 0.618] * [last.x - x]] y x y + return this +} +define [Glyph.prototype.arc-hv-to x y kappa] : begin { + local lastContour this.contours`[this.contours.length - 1] + local lastPoint lastContour`[lastContour.length - 1] + local last : utp this.gizmo lastPoint + this.cubic-to [last.x + [fallback kappa 0.618] * [x - last.x]] last.y x [y + [fallback kappa 0.618] * [last.y - y]] x y + return this +} define [Glyph.prototype.cubic-to x1 y1 x2 y2 x y] : begin { local lastContour this.contours`[this.contours.length - 1] local lastPoint lastContour`[lastContour.length - 1] - local segments [bezierCubic2Q2 lastPoint (.x x1 .y y1) (.x x2 .y y2) (.x x .y y)] + local last : utp this.gizmo lastPoint + local segments [bezierCubic2Q2 last (.x x1 .y y1) (.x x2 .y y2) (.x x .y y)] foreach (p0 (.x xc .y yc) (.x xf .y yf)) [items-of segments] : this.curve-to xc yc xf yf return this }