From f42a571158e1a334b85112cea8be73beea8a2f38 Mon Sep 17 00:00:00 2001 From: Belleve Invis Date: Tue, 28 Jul 2015 01:02:54 +0800 Subject: [PATCH] Start greek support. --- buildglyphs-intro.patel | 6 +- glyphs/common-shapes.patel | 22 ++-- glyphs/greek.patel | 231 +++++++++++++++++++++++++++++++++++++ glyphs/latin-extend.patel | 14 +-- glyphs/overmarks.patel | 38 ++++-- glyphs/symbol-extend.patel | 16 +-- makefile | 2 +- 7 files changed, 282 insertions(+), 47 deletions(-) create mode 100644 glyphs/greek.patel diff --git a/buildglyphs-intro.patel b/buildglyphs-intro.patel index 3b75f1d..5d5a4d0 100644 --- a/buildglyphs-intro.patel +++ b/buildglyphs-intro.patel @@ -110,7 +110,7 @@ define MARKBASE 'markbase' define AS_BASE 'AS-BASE' define [Upright angle] (.xx 1 .yx [-[Math.tan [[fallback angle para.italicangle] / 180 * Math.PI]]] .xy 0 .yy 1 .x 0 .y 0) define [Italify angle] (.xx 1 .yx [Math.tan [[fallback angle para.italicangle] / 180 * Math.PI]] .xy 0 .yy 1 .x 0 .y 0) -define [Scale s] (.xx s .yx 0 .xy 0 .yy s .x 0 .y 0) +define [Scale sx sy] (.xx sx .yx 0 .xy 0 .yy [fallback sy sx] .x 0 .y 0) define [Translate x y] (.xx 1 .yx 0 .xy 0 .yy 1 .x x .y y) define [tm anchor] : return ( @@ -256,6 +256,10 @@ define [select-variant name unicode default] : begin { set unicodeGlyphs.(chosenGlyph.unicode`[chosenGlyph.unicode.length - 1]) chosenGlyph } } +define [alias newid unicode oldid] : create-glyph newid : glyph-construction { + assign-unicode unicode + include glyphs`oldid AS_BASE +} ###### HERE WE GO! diff --git a/glyphs/common-shapes.patel b/glyphs/common-shapes.patel index ae913b5..68d1d5f 100644 --- a/glyphs/common-shapes.patel +++ b/glyphs/common-shapes.patel @@ -206,28 +206,30 @@ define [XSHookLower bottom left middle right smooth hook] : glyph-construction { :.curve-to [mix middle left KAPPA_HOOK] [bottom + O] [left + OXHOOK] [bottom + hook] } -define [smallo u d l r _width] : glyph-construction { +define [smallo u d l r _width _sma _smb] : glyph-construction { local middle : [l + r] / 2 local width : fallback _width STROKE - if [u - d > SMALLSMOOTHA + SMALLSMOOTHB] { + local sma : fallback _sma SMALLSMOOTHA + local smb : fallback _smb SMALLSMOOTHB + if [u - d > sma + smb] { then : begin { include : create-stroke :.set-transform globalTransform :.start-from middle [u - O] :.set-width width 0 :.heads-to LEFTWARD - :.arc-hv-to [l + O] [u - SMALLSMOOTHA] - :.line-to [l + O] [d + SMALLSMOOTHB] + :.arc-hv-to [l + O] [u - sma] + :.line-to [l + O] [d + smb] :.arc-vh-to middle [d + O] :.heads-to RIGHTWARD - :.arc-hv-to [r - O] [d + SMALLSMOOTHA] - :.line-to [r - O] [u - SMALLSMOOTHB] + :.arc-hv-to [r - O] [d + sma] + :.line-to [r - O] [u - smb] :.arc-vh-to middle [u - O] :.heads-to LEFTWARD } else : begin { - local ymiddlea : [u - SMALLSMOOTHA + d + SMALLSMOOTHB] / 2 - local ymiddleb : [u - SMALLSMOOTHB + d + SMALLSMOOTHA] / 2 + local ymiddlea : [u - sma + d + smb] / 2 + local ymiddleb : [u - smb + d + sma] / 2 include : create-stroke :.set-transform globalTransform :.start-from middle [u - O] @@ -266,10 +268,10 @@ define [VBar x ydown yup _fine] : glyph-construction { define [HOverlayBar xleft xright y] : HBar xleft xright y [adviceBlackness 5] # Common transformations -define [FlipAround x y] : glyph-construction { +define [FlipAround x y sx sy] : glyph-construction { apply-transform : Upright apply-transform : Translate [-x] [-y] - apply-transform : Scale [-1] + apply-transform : Scale [fallback sx [-1]] [fallback sy sx [-1]] apply-transform : Translate x y apply-transform : Italify } diff --git a/glyphs/greek.patel b/glyphs/greek.patel new file mode 100644 index 0000000..5820a25 --- /dev/null +++ b/glyphs/greek.patel @@ -0,0 +1,231 @@ +###### Monotonic greek + +# Aliases +alias 'Alpha' 0x391 'A' +alias 'Beta' 0x392 'B' +alias 'Epsilon' 0x395 'E' +alias 'Zeta' 0x396 'Z' +alias 'Eta' 0x397 'H' +alias 'Iota' 0x399 'I' +alias 'Kappa' 0x39A 'K' +alias 'Mu' 0x39C 'M' +alias 'Nu' 0x39D 'N' +alias 'Omicron' 0x39F 'O' +alias 'Rho' 0x3A1 'P' +alias 'Tau' 0x3A4 'T' +alias 'Upsilon' 0x3A5 'Y' +alias 'Chi' 0x3A7 'X' +alias 'omicron' 0x3BF 'o' + +# Capital +create-glyph 'Lambda' : glyph-construction { + assign-unicode 0x39B + include capitalMarks + + local TURN [XH * 0.1] + local curviness 0.1 + include : create-stroke + :.start-from SB 0 + :.heads-to UPWARD + :.set-width 0 STROKE + :.line-to SB TURN + :.heads-to UPWARD + :.curve-to SB [mix TURN CAP curviness] [MIDDLE - STROKE / 2] CAP + :.set-width 0 [STROKE * 0.8] + + include : create-stroke + :.start-from RIGHTSB 0 + :.heads-to UPWARD + :.set-width STROKE 0 + :.line-to RIGHTSB TURN + :.heads-to UPWARD + :.curve-to RIGHTSB [mix TURN CAP curviness] [MIDDLE + STROKE / 2] CAP + :.set-width [STROKE * 0.8] 0 + + start-from [MIDDLE - STROKE / 2] CAP + line-to [MIDDLE + STROKE / 2] CAP + line-to MIDDLE [CAP - STROKE] +} +create-glyph 'Delta' : glyph-construction { + assign-unicode 0x394 + include glyphs.Lambda AS_BASE + include : HBar [SB + HALFSTROKE] [RIGHTSB - HALFSTROKE] HALFSTROKE +} +create-glyph 'Gamma' : glyph-construction { + assign-unicode 0x393 + include glyphs.L AS_BASE + include : FlipAround MIDDLE CAPMIDDLE 1 [-1] +} +create-glyph 'Sigma' : glyph-construction { + set-width WIDTH + assign-unicode 0x3A3 + include capitalMarks + + local cor 1.15 + + include : create-stroke :.start-from SB CAP :.heads-to RIGHTWARD :.set-width 0 STROKE + :.line-to RIGHTSB CAP :.heads-to RIGHTWARD + include : create-stroke :.start-from SB 0 :.heads-to RIGHTWARD :.set-width STROKE 0 + :.line-to RIGHTSB 0 :.heads-to RIGHTWARD + + local midx : mix SB RIGHTSB 0.4 + start-from SB STROKE + line-to [SB + STROKE * cor] STROKE + line-to [midx + STROKE * cor] CAPMIDDLE + line-to [SB + STROKE * cor] [CAP - STROKE] + line-to SB [CAP - STROKE] + line-to midx CAPMIDDLE + reverse-last +} +create-glyph 'Theta' : glyph-construction { + assign-unicode 0x398 + include glyphs.O AS_BASE + include : HBar [SB + STROKE - O * 5] [RIGHTSB - STROKE + O * 5] CAPMIDDLE +} +create-glyph 'Xi' : glyph-construction { + assign-unicode 0x39E + include : HBar [mix SB RIGHTSB 0.15] [mix RIGHTSB SB 0.15] [mix 0 CAP 0.54] + include : HBar SB RIGHTSB [CAP - HALFSTROKE] + include : HBar SB RIGHTSB [0 + HALFSTROKE] +} +create-glyph 'Pi' : glyph-construction { + assign-unicode 0x3A0 + include : HBar SB RIGHTSB [CAP - HALFSTROKE] + include : VBar [[mix SB RIGHTSB 0.1] + HALFSTROKE] 0 CAP + include : VBar [[mix RIGHTSB SB 0.1] - HALFSTROKE] 0 CAP +} +create-glyph 'Phi' : glyph-construction { + assign-unicode 0x3A6 + local fine : adviceBlackness 3.5 + local y1 : CAP * 0.125 + local y2 : CAP * 0.875 + include : VBar MIDDLE 0 [y1 + HALFSTROKE] + include : smallo y2 y1 SB RIGHTSB fine SMOOTHA SMOOTHB + include : VBar MIDDLE y1 y2 fine + include : VBar MIDDLE [y2 - HALFSTROKE] CAP +} +create-glyph 'Psi' : glyph-construction { + assign-unicode 0x3A8 + local fine : adviceBlackness 3.5 + local y : CAP * 0.25 + include : create-stroke + :.start-from SB CAP + :.heads-to DOWNWARD + :.set-width fine 0 + :.line-to SB [y + SMOOTHB] + :.arc-vh-to MIDDLE y + :.heads-to RIGHTWARD + :.arc-hv-to RIGHTSB [y + SMOOTHA] + :.line-to RIGHTSB CAP + :.heads-to UPWARD + include : VBar MIDDLE y CAP fine + include : VBar MIDDLE 0 [y + HALFSTROKE] +} +create-glyph 'Omega' : glyph-construction { + assign-unicode 0x3A9 + include capitalMarks + local fine : STROKE * 0.4 + include : create-stroke + :.start-from [mix SB RIGHTSB 0.4] STROKE + :.set-width fine 0 + :.heads-to LEFTWARD + :.arc-hv-to [SB + STROKE * ITALICCOR] SMALLSMOOTHB + :.set-width STROKE 0 + :.line-to [SB + STROKE * ITALICCOR] [CAP - SMOOTHA] + :.arc-vh-to MIDDLE [CAP - STROKE] + :.heads-to RIGHTWARD + :.arc-hv-to [RIGHTSB - STROKE * ITALICCOR] [CAP - SMOOTHB] + :.line-to [RIGHTSB - STROKE * ITALICCOR] SMALLSMOOTHA + :.arc-vh-to [mix RIGHTSB SB 0.4] STROKE + :.set-width fine 0 + :.heads-to LEFTWARD + + include : HBar SB [mix SB RIGHTSB 0.4] HALFSTROKE + include : HBar [mix RIGHTSB SB 0.4] RIGHTSB HALFSTROKE +} +# Lowercase +create-glyph 'alpha' : glyph-construction { + set-width WIDTH + assign-unicode 0x3B1 + include eMarks + + local middle : mix SB RIGHTSB 0.4 + local cx : mix SB RIGHTSB 0.6 + local cy : mix 0 XH 0.3 + local cx2 : mix SB RIGHTSB 0.5 + local fine : adviceBlackness 3.5 + include : create-stroke + :.start-from [RIGHTSB - fine * ITALICCOR] XH + :.heads-to DOWNWARD + :.set-width fine 0 + :.cubic-to cx cy cx2 [O + STROKE] middle [O + STROKE] + :.set-width STROKE 0 + :.arc-hv-to [SB + STROKE * ITALICCOR] SMALLSMOOTHB + :.line-to [SB + STROKE * ITALICCOR] [XH - SMALLSMOOTHA] + :.arc-vh-to middle [XO - STROKE] + :.set-width STROKE 0 + :.cubic-to cx2 [XO - STROKE] cx [XH - cy] [RIGHTSB - fine * ITALICCOR] 0 + :.set-width fine 0 + :.heads-to DOWNWARD +} +create-glyph 'iota' : glyph-construction { + assign-unicode 0x3B9 + include eMarks + local middle : MIDDLE - JBALANCE + set-anchor 'above' BASE middle XH + + include : create-stroke + :.start-from middle HOOK + :.heads-to UPWARD + :.set-width HALFSTROKE HALFSTROKE + :.line-to middle XH + :.heads-to UPWARD + + include : VerticalHook middle HOOK [HOOK * 1.2] [HOOK * 0.75] +} +create-glyph 'eta' : glyph-construction { + assign-unicode 0x3B7 + include pMarks + + include : nBowl [SB + STROKE] MIDDLE RIGHTSB [STROKE * 0.3] XH DESCENDER SMALLSMOOTHA SMALLSMOOTHB + include : VBar [SB + HALFSTROKE * ITALICCOR] 0 XH +} +create-glyph 'kappa' : glyph-construction { + set-width WIDTH + assign-unicode 0x3BA + include bMarks + include : create-stroke + :.start-from SB 0 + :.set-width 0 STROKE + :.heads-to UPWARD + :.line-to SB XH + :.heads-to UPWARD + include : SmallKShape +} +create-glyph 'lambda' : glyph-construction { + assign-unicode 0x3BB + include bMarks + + local xTop : mix SB RIGHTSB 0.28 + local turnp : XH / [XH - DESCENDER] + local xb : mix SB RIGHTSB 0.51 + local yb : mix XH 0 [0.05 * turnp] + + include : xStrand xTop CAP RIGHTSB 0 0.1 0.6 0.14 + include : halfXStrand SB 0 xb yb [0.1 * turnp] 0.4 [0.14 * turnp] +} +create-glyph 'mu' : glyph-construction { + set-width WIDTH + assign-unicode 0x3BC + include pMarks + include glyphs.u + include : create-stroke + :.start-from SB DESCENDER + :.heads-to UPWARD + :.set-width 0 STROKE + :.line-to SB [DESCENDER / 2] + :.heads-to UPWARD + :.line-to SB SMALLSMOOTHB + :.heads-to UPWARD + :.set-width 0 [adviceBlackness 4] +} \ No newline at end of file diff --git a/glyphs/latin-extend.patel b/glyphs/latin-extend.patel index d4e20b3..d46b2aa 100644 --- a/glyphs/latin-extend.patel +++ b/glyphs/latin-extend.patel @@ -368,19 +368,7 @@ create-glyph 'esh' : glyph-construction { assign-unicode 0x283 include glyphs.'longs.italic' AS_BASE } - -create-glyph 'latinkappa' : glyph-construction { - set-width WIDTH - assign-unicode 0x138 - include bMarks - include : create-stroke - :.start-from SB 0 - :.set-width 0 STROKE - :.heads-to UPWARD - :.line-to SB XH - :.heads-to UPWARD - include : SmallKShape -} +alias 'latinkappa' 0x138 'kappa' create-glyph 'Hbar' : glyph-construction { assign-unicode 0x126 diff --git a/glyphs/overmarks.patel b/glyphs/overmarks.patel index f51159a..2240738 100644 --- a/glyphs/overmarks.patel +++ b/glyphs/overmarks.patel @@ -2,7 +2,7 @@ ### Combining marks local markExtend [ACCENTX * 0.5] -local markStress : 0.5 * [adviceBlackness 3.25] +local markStress : 0.5 * [adviceBlackness 3.5] local markFine : markStress * 0.8 local markHalfStroke : mix markFine markStress 0.5 local markMiddle [-MIDDLE] @@ -241,17 +241,19 @@ create-glyph 'doubleAcuteAbove' : glyph-construction { :.set-width markStress markStress :.set-samples 1 } - create-glyph 'closeApostropheAbove' : glyph-construction { set-width 0 assign-unicode 0x313 - include glyphs.dotAbove set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop - + + local radius : markHalfStroke * 1.5 + include : list { + Ring [XH + ACCENT + radius] [XH + ACCENT - radius] [markMiddle - radius] [markMiddle + radius] + } include : create-stroke - :.start-from [markMiddle + DOTRADIUS] [XH + ACCENT] - :.set-width 0 [markFine * 2] - :.curve-to [markMiddle + DOTRADIUS] [mix [XH + ACCENT] [aboveMarkBot - DOTRADIUS] 0.5] [mix markMiddle [markMiddle - DOTRADIUS] 0.2] [aboveMarkBot - DOTRADIUS] + :.start-from [markMiddle + radius] [XH + ACCENT] + :.set-width 0 [markFine * 1.75] + :.curve-to [markMiddle + radius] [mix [XH + ACCENT] [aboveMarkBot - radius] 0.75] [mix markMiddle [markMiddle - radius] 0.2] [aboveMarkBot - radius] apply-transform : Upright apply-transform : Translate 0 [DOTRADIUS * 0.75] apply-transform : Italify @@ -263,6 +265,28 @@ create-glyph 'openApostropheAbove' : glyph-construction { include : FlipAround markMiddle [XH + ACCENT] set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop } +create-glyph 'invCommaAbove' : glyph-construction { + set-width 0 + assign-unicode 0x314 + set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop + local radius : markHalfStroke * 1.5 + include : list { + Ring [XH + ACCENT + radius] [XH + ACCENT - radius] [markMiddle - radius] [markMiddle + radius] + } + include : create-stroke + :.start-from [markMiddle - radius] [XH + ACCENT] + :.set-width [markFine * 1.75] 0 + :.curve-to [markMiddle - radius] [mix [XH + ACCENT] [aboveMarkBot - radius] 0.75] [mix markMiddle [markMiddle + radius] 0.2] [aboveMarkBot - radius] + apply-transform : Upright + apply-transform : Translate 0 [DOTRADIUS * 0.75] + apply-transform : Italify +} +create-glyph 'greekTwistAbove' : glyph-construction { + set-width 0 + assign-unicode 0x342 + include glyphs.archAbove + set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop +} ### Below marks create-glyph 'cedillaBelow' : glyph-construction { diff --git a/glyphs/symbol-extend.patel b/glyphs/symbol-extend.patel index 4369214..bfce337 100644 --- a/glyphs/symbol-extend.patel +++ b/glyphs/symbol-extend.patel @@ -88,21 +88,7 @@ create-glyph 'sterling' : glyph-construction { 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 - include pMarks - include glyphs.u - include : create-stroke - :.start-from SB DESCENDER - :.heads-to UPWARD - :.set-width 0 STROKE - :.line-to SB [DESCENDER / 2] - :.heads-to UPWARD - :.line-to SB SMALLSMOOTHB - :.heads-to UPWARD - :.set-width 0 [adviceBlackness 4] -} +alias 'micro' 0xB5 'mu' create-glyph 'softhyphen' : glyph-construction { assign-unicode 0xAD include glyphs.hyphen AS_BASE diff --git a/makefile b/makefile index 9cbf9bf..3d86826 100644 --- a/makefile +++ b/makefile @@ -1,5 +1,5 @@ SUPPORT_FILES = support/glyph.js support/stroke.js parameters.js -GLYPH_SEGMENTS = glyphs/common-shapes.patel glyphs/overmarks.patel glyphs/latin-basic-capital.patel glyphs/latin-basic-lower.patel glyphs/latin-extend.patel glyphs/numbers.patel glyphs/symbol-ascii.patel glyphs/symbol-extend.patel glyphs/autobuilds.patel +GLYPH_SEGMENTS = glyphs/common-shapes.patel glyphs/overmarks.patel glyphs/latin-basic-capital.patel glyphs/latin-basic-lower.patel glyphs/greek.patel glyphs/latin-extend.patel glyphs/numbers.patel glyphs/symbol-ascii.patel glyphs/symbol-extend.patel glyphs/autobuilds.patel OBJDIR = build ifeq ($(OS),Windows_NT)