From caf2d632762eb39c917e3aa8258f1d7abdfa88f2 Mon Sep 17 00:00:00 2001 From: be5invis Date: Tue, 1 Sep 2015 22:01:20 +0800 Subject: [PATCH] Added /Hwair, /hwair, /latinEta, etc. --- glyphs/autobuilds.patel | 2 + glyphs/common-shapes.patel | 9 ++-- glyphs/latin-basic-capital.patel | 2 +- glyphs/latin-basic-lower.patel | 39 ++++++++--------- glyphs/latin-extend-basis.patel | 43 ++++++++++++++++++- glyphs/latin-extend-decorated.patel | 65 +++++++++++++++++++++++++++++ glyphs/overmarks.patel | 8 ++++ makefile | 2 +- pass1-cleanup.py | 20 +++++---- 9 files changed, 156 insertions(+), 34 deletions(-) diff --git a/glyphs/autobuilds.patel b/glyphs/autobuilds.patel index 163e9ca..d75aa69 100644 --- a/glyphs/autobuilds.patel +++ b/glyphs/autobuilds.patel @@ -34,10 +34,12 @@ define customDecompositions ( ."\u1D7F" "\u028A\u0336" ."\u0289" "u\u0336" ."\u0244" "U\u0336" + ."\u01E5" "g\u0336" ."\u0290" "z\u0322" ."\u0256" "d\u0322" ."\u0273" "n\u0322" + ."\u01AE" "T\u0322" ."\u1D91" "\u0257\u0322" # Cyrillic composite characters diff --git a/glyphs/common-shapes.patel b/glyphs/common-shapes.patel index c6300bb..6dc13b2 100644 --- a/glyphs/common-shapes.patel +++ b/glyphs/common-shapes.patel @@ -159,12 +159,13 @@ define [xStrand _leftx lefty _rightx righty turn straight tension] : begin { return : halfXStrand _leftx lefty middlex middley turn straight tension :.concat : halfXStrand _rightx righty middlex middley turn straight tension } -define [nShoulderKnots left middle right fine _top _bottom _sma _smb _wide] : begin { +define [nShoulderKnots left _middle right fine _top _bottom _sma _smb _wide] : begin { local top : fallback _top XH local bottom : fallback _bottom 0 local sma : fallback _sma SMALLSMOOTHA local smb : fallback _smb SMALLSMOOTHB local stroke : fallback _wide STROKE + local middle : fallback _middle [mix [left - stroke * CORRECTION_HX] right 0.5] return : list { flat left [top - sma - 2] [widths fine 0] curl left [top - sma] @@ -282,7 +283,7 @@ define [HBar xleft xright y _fine] : glyph-construction { } define [HBarTop xl xr y _fine] : HBar xl xr [y - [fallback _fine STROKE] * 0.5] _fine define [HBarBottom xl xr y _fine] : HBar xl xr [y + [fallback _fine STROKE] * 0.5] _fine -define [HOverlayBar xleft xright y] : HBar xleft xright y [adviceBlackness 4] +define [HOverlayBar xleft xright y] : HBar xleft xright y [adviceBlackness 4.5] define [VBar x ydown yup _fine] : glyph-construction { local fine : [fallback _fine STROKE] / 2 include : create-stroke @@ -314,11 +315,11 @@ define [LegShape xt xb xs top bottom _fine] : glyph-construction { curl xs [bottom + fine] [heading LEFTWARD] } } -define [LeftHook x y] : glyph-construction { +define [LeftHook x y xextend] : glyph-construction { local fine : adviceBlackness 4.25 include : spiro { widths.lhs fine - flat [x + 1] y + flat [fallback xextend : x + 1] y curl x y archv g4 [x - fine * 1.5] [y - HOOKX] diff --git a/glyphs/latin-basic-capital.patel b/glyphs/latin-basic-capital.patel index ecf532e..c71f917 100644 --- a/glyphs/latin-basic-capital.patel +++ b/glyphs/latin-basic-capital.patel @@ -462,7 +462,7 @@ create-glyph 'T' : glyph-construction { set-width WIDTH assign-unicode 'T' include capitalMarks - + set-anchor 'bottomright' BASE [MIDDLE + HALFSTROKE * CORRECTION_HX] 0 include : create-stroke :.start-from MIDDLE 0 :.heads-to UPWARD :.set-width HALFSTROKE HALFSTROKE :.line-to MIDDLE CAP :.heads-to UPWARD include : create-stroke :.start-from SB CAP :.heads-to RIGHTWARD :.set-width 0 STROKE diff --git a/glyphs/latin-basic-lower.patel b/glyphs/latin-basic-lower.patel index bc55717..7cc9887 100644 --- a/glyphs/latin-basic-lower.patel +++ b/glyphs/latin-basic-lower.patel @@ -109,6 +109,8 @@ create-glyph 'g' : glyph-construction { line-to [RIGHTSB + 0.25 * SB] [XH - STROKE] line-to MIDDLE [XH - STROKE - O] line-to MIDDLE XH + + set-anchor 'overlay' BASE MIDDLE [mix [DESCENDER + O] groundy 0.53] } ### c e t @@ -189,22 +191,23 @@ create-glyph 'e' : glyph-construction { } } define [SmallTShape top bot] : glyph-construction { - local center : MIDDLE - TBALANCE + HALFSTROKE - local hookx [center - STROKE * 2 + [WIDTH - SB * 2] * 0.8 - OXHOOK + TAILADJX * globalTransform.yx] - local turn : [mix center hookx 0.5] + CORRECTION_OMIDS - CORRECTION_VS + local center : MIDDLE - TBALANCE - HALFSTROKE + local hookx [center + [WIDTH - SB * 2] * 0.8 - OXHOOK + TAILADJX * globalTransform.yx] + local turn : [mix center hookx 0.5] + CORRECTION_OMIDS local smb : [turn - center] * 1.2 include : spiro { - widths.rhs + widths.lhs flat center top [heading DOWNWARD] - curl center [bot + smb + STROKE] - arcvh - g4 turn [bot + O + STROKE] + curl center [bot + smb] + arcvh 6 + g4 turn [bot + O] quadcontrols [KAPPA_HOOK + 0.75 * globalTransform.yx + 0.1] 0 - g4 hookx [bot + HOOK + STROKE * 0.24] + g4 hookx [bot + HOOK] } + set-anchor 'bottomright' BASE hookx [bot + HOOK] - include : HBarTop [center - HALFSTROKE - LONGJUT + TBALANCE2] [center - HALFSTROKE + LONGJUT + TBALANCE2] [top * XH / CAP] + include : HBarTop [center + HALFSTROKE - LONGJUT + TBALANCE2] [center + HALFSTROKE + LONGJUT + TBALANCE2] XH } create-glyph 't' : glyph-construction { set-width WIDTH @@ -295,21 +298,19 @@ create-glyph 'h' : glyph-construction { :.line-to SB CAP :.heads-to UPWARD } +define [SmallMShape top bot] : glyph-construction { + local m1 : mix [SB + O] [MIDDLE + MVERTSTROKE / 2 * CORRECTION_HX] 0.5 + local m2 : mix [RIGHTSB - O] [MIDDLE - MVERTSTROKE / 2 * CORRECTION_HX] 0.5 + include : mShoulderSpiro [SB + O + MVERTSTROKE * CORRECTION_HX] [MIDDLE + MVERTSTROKE / 2 * CORRECTION_HX] top bot MVERTSTROKE [MVERTSTROKE * 0.4] + include : mShoulderSpiro [MIDDLE + MVERTSTROKE * 0.5 * CORRECTION_HX] [RIGHTSB - O] top bot MVERTSTROKE [MVERTSTROKE * 0.8] + include : VBarLeft [SB + O] bot top MVERTSTROKE +} create-glyph 'm' : glyph-construction { set-width WIDTH assign-unicode 'm' include eMarks - local m1 : mix [SB + O] [MIDDLE + MVERTSTROKE / 2 * CORRECTION_HX] 0.5 - local m2 : mix [RIGHTSB - O] [MIDDLE - MVERTSTROKE / 2 * CORRECTION_HX] 0.5 - include : mShoulderSpiro [SB + O + MVERTSTROKE * CORRECTION_HX] [MIDDLE + MVERTSTROKE / 2 * CORRECTION_HX] XH 0 MVERTSTROKE [MVERTSTROKE * 0.4] - include : mShoulderSpiro [MIDDLE + MVERTSTROKE * 0.5 * CORRECTION_HX] [RIGHTSB - O] XH 0 MVERTSTROKE [MVERTSTROKE * 0.8] - include : create-stroke - :.start-from [SB + O] 0 - :.heads-to UPWARD - :.set-width 0 MVERTSTROKE - :.line-to [SB + O] XH - :.heads-to UPWARD + include : SmallMShape XH 0 } ### i j l diff --git a/glyphs/latin-extend-basis.patel b/glyphs/latin-extend-basis.patel index d1707e7..37b7295 100644 --- a/glyphs/latin-extend-basis.patel +++ b/glyphs/latin-extend-basis.patel @@ -386,6 +386,33 @@ create-glyph 'ij' : glyph-construction { apply-transform : Translate [RIGHTSB - SB * 0.5 - MIDDLE - JBALANCE - HALFSTROKE * CORRECTION_HX] 0 } } +create-glyph 'Hwair' : glyph-construction { + assign-unicode 0x1F6 + include : VBarLeft [SB + O] 0 CAP MVERTSTROKE + include : HBar SB MIDDLE [CAP / 2] + include : spiro { + widths.lhs MVERTSTROKE + flat [MIDDLE - MVERTSTROKE * 0.5 * CORRECTION_HX] CAP [heading DOWNWARD] + curl [MIDDLE - MVERTSTROKE * 0.5 * CORRECTION_HX] [SMALLSMOOTHA * 0.6] + arcvh + g4 [mix [MIDDLE - MVERTSTROKE * 0.5 * CORRECTION_HX] [RIGHTSB - O] 0.5] O [heading RIGHTWARD] + archv + flat [RIGHTSB - O] [SMALLSMOOTHA * 0.6] + curl [RIGHTSB - O] XH [heading UPWARD] + } +} +create-glyph 'hwair' : glyph-construction { + assign-unicode 0x195 + include : VBarLeft [SB + O] 0 CAP MVERTSTROKE + include : spiro { + nShoulderKnots [SB + O + MVERTSTROKE * CORRECTION_HX] nothing [MIDDLE + MVERTSTROKE * 0.5 * CORRECTION_HX] [MVERTSTROKE * 0.4] nothing [SMALLSMOOTHB * 0.6] [SMALLSMOOTHA * 0.6] [SMALLSMOOTHB * 0.6] MVERTSTROKE + arcvh + g4 [mix [MIDDLE - MVERTSTROKE * 0.5 * CORRECTION_HX] [RIGHTSB - O] 0.5] O [widths.heading MVERTSTROKE 0 RIGHTWARD] + archv + flat [RIGHTSB - O] [SMALLSMOOTHA * 0.6] + curl [RIGHTSB - O] XH [heading UPWARD] + } +} create-glyph 'scripta' : glyph-construction { assign-unicode 0x0251 @@ -565,6 +592,15 @@ create-glyph 'closeomega' : glyph-construction { curl [MIDDLE - fine / 2] y4 [heading UPWARD] } } +create-glyph 'latinEta' : glyph-construction { + assign-unicode 0x220 + include ifMarks + set-anchor 'lf' BASE [SB + HALFSTROKE] 0 + + include : nShoulder [SB + STROKE] MIDDLE RIGHTSB [STROKE * 0.3] CAP DESCENDER SMALLSMOOTHA SMALLSMOOTHB + include : VBar [SB + HALFSTROKE * CORRECTION_HX] 0 CAP +} +# create-glyph 'strenchedC' : glyph-construction { set-width WIDTH assign-unicode 0x297 @@ -800,7 +836,12 @@ turned 'turndelta' 0x18D 'delta' MIDDLE [XH / 2] pMarks turned 'latinUpsilon1' 0x1B1 'Omega' MIDDLE [CAP / 2] turned 'closeepsilon' 0x29A 'closeturnepsilon' MIDDLE [XH / 2] turned 'invglottalstop' 0x296 'revglottalstop' MIDDLE [CAP / 2] - +create-glyph 'capitalTurnm' : glyph-construction { + assign-unicode 0x19C + include capitalMarks + include : SmallMShape CAP 0 + include : FlipAround MIDDLE [CAP / 2] +} # compatibility ligatures diff --git a/glyphs/latin-extend-decorated.patel b/glyphs/latin-extend-decorated.patel index cb812e4..05366b9 100644 --- a/glyphs/latin-extend-decorated.patel +++ b/glyphs/latin-extend-decorated.patel @@ -45,7 +45,24 @@ create-glyph 'lslash' : glyph-construction { :.set-width fine fine :.line-to [middlex + LONGJUT * 0.8] [middle + LONGJUT * 0.4] } +create-glyph 'lambdaslash' : glyph-construction { + assign-unicode 0x19B + include glyphs.lambda AS_BASE + local fine : 0.5 * [adviceBlackness 5] + local middle : mix 0 CAP 0.7 + local middlex [tp [Upright] glyphs.l.anchors.above].x + include : create-stroke + :.start-from [middlex - LONGJUT * 0.8] [middle - LONGJUT * 0.4] + :.set-width fine fine + :.line-to [middlex + LONGJUT * 0.8] [middle + LONGJUT * 0.4] +} # Barred +create-glyph 'Gbar' : glyph-construction { + assign-unicode 0x1E4 + + include glyphs.G AS_BASE + include : HOverlayBar [mix SB RIGHTSB 0.5] [mix RIGHTSB WIDTH 0.7] [mix 0 CAPMIDDLE 0.55] +} create-glyph 'Hbar' : glyph-construction { assign-unicode 0x126 @@ -82,6 +99,11 @@ 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 'Lbar' : glyph-construction { + assign-unicode 0x23D + include glyphs.L AS_BASE + include : HOverlayBar [SB * 0.3] [mix [SB + STROKE] [RIGHTSB - STROKE] 0.55] [CAP * BARPOS] +} create-glyph 'Cbar' : glyph-construction { assign-unicode 0xA792 include glyphs.C AS_BASE @@ -176,6 +198,13 @@ create-glyph 'Phookleft' : glyph-construction { include glyphs.P AS_BASE include : LeftHook [SB * 1.25] CAP } +create-glyph 'Thookleft' : glyph-construction { + assign-unicode 0x1AC + include capitalMarks + include : LeftHook [SB + [adviceBlackness 4.25] * 1.5] CAP MIDDLE + include : HBarTop MIDDLE RIGHTSB CAP + include : VBar MIDDLE 0 CAP +} # Hooktop define [HooktopLeftBar stroke bottom] : glyph-construction { include : spiro { @@ -209,12 +238,25 @@ create-glyph 'scriptghooktop' : glyph-construction { include glyphs.scriptg AS_BASE include : VerticalHook [RIGHTSB - HALFSTROKE * CORRECTION_HX] XH HOOKX [-HOOK] } +create-glyph 'thooktop' : glyph-construction { + assign-unicode 0x1AD + include eMarks + include : SmallTShape [XH - HALFSTROKE] 0 + include : VerticalHook [MIDDLE - TBALANCE] XH HOOKX [-HOOK] +} create-glyph 'dhooktop' : glyph-construction { assign-unicode 0x257 include bMarks include glyphs.'a.italic' include : VerticalHook [RIGHTSB - HALFSTROKE * CORRECTION_HX] XH HOOKX [-HOOK] } +create-glyph 'qhooktop' : glyph-construction { + assign-unicode 0x2A0 + include pMarks + include glyphs.'a.italic' + include : VerticalHook [RIGHTSB - HALFSTROKE * CORRECTION_HX] XH HOOKX [-HOOK] + include : VBarRight RIGHTSB DESCENDER 0 +} create-glyph 'Chooktop' : glyph-construction { assign-unicode 0x187 include glyphs.C AS_BASE @@ -341,6 +383,18 @@ create-glyph 'nltail' : glyph-construction { include glyphs.n AS_BASE include : VerticalHook [SB + HALFSTROKE * CORRECTION_HX] 0 [-HOOKX] HOOK } +create-glyph 'tltail' : glyph-construction { + assign-unicode 0x1AB + include ifMarks + include glyphs.t + include : VBarRight glyphs.t.anchors.bottomright.x 0 glyphs.t.anchors.bottomright.y + include : VerticalHook [glyphs.t.anchors.bottomright.x - HALFSTROKE * CORRECTION_HX] 0 [-HOOKX] HOOK +} +create-glyph 'Nltail' : glyph-construction { + assign-unicode 0x19D + include glyphs.N AS_BASE + include : VerticalHook [SB + HALFSTROKE * CORRECTION_HX] 0 [-HOOKX] HOOK +} create-glyph 'mltail' : glyph-construction { assign-unicode 0x271 include pMarks @@ -420,6 +474,17 @@ create-glyph 'ezhtail' : glyph-construction { :.arc-vh-to [mix SB RIGHTSB 0.4] [DESCENDER + STROKE] :.line-to RIGHTSB [DESCENDER + STROKE] } +# Downward tail +create-glyph 'Zdowntail' : glyph-construction { + assign-unicode 0x224 + include glyphs.Z AS_BASE + include : VBarRight [mix SB RIGHTSB 1.05] [HALFSTROKE - LONGJUT] STROKE +} +create-glyph 'zdowntail' : glyph-construction { + assign-unicode 0x225 + include glyphs.z AS_BASE + include : VBarRight [mix SB RIGHTSB 1.05] [HALFSTROKE - LONGJUT] STROKE +} # Curly tail define [CurlyTail fine rinner m1 bottom _right x2 y2] : begin { local right : _right - fine * [if [_right > m1] 1 [-1]] diff --git a/glyphs/overmarks.patel b/glyphs/overmarks.patel index b374582..71f5c5f 100644 --- a/glyphs/overmarks.patel +++ b/glyphs/overmarks.patel @@ -700,6 +700,14 @@ create-glyph 'rtailBR' : glyph-construction { include : VBarRight 0 0 [-O] include : VerticalHook [- HALFSTROKE * CORRECTION_HX] 0 HOOKX HOOK } +create-glyph 'ltailBR' : glyph-construction { + set-width 0 + assign-unicode 0x321 + + set-anchor 'bottomright' MARK 0 0 0 belowMarkBot + include : VBarRight 0 0 [-O] + include : VerticalHook [- HALFSTROKE * CORRECTION_HX] 0 [-HOOKX] HOOK +} # Overlay Marks create-glyph 'tildeOver' : glyph-construction { set-width 0 diff --git a/makefile b/makefile index 76f070b..ae4da65 100644 --- a/makefile +++ b/makefile @@ -47,7 +47,7 @@ $(FEATURE) : $(OBJDIR)/.pass0-%.fea : $(OBJDIR)/.pass0-%.ab.fea features/common. # Pass 1 : Outline cleanup and merge $(PASS1) : $(OBJDIR)/.pass1-%.ttf : pass1-cleanup.py $(OBJDIR)/.pass0-%.ttf - fontforge -quiet -script $^ $@ $(SUPPRESS_ERRORS) + fontforge -quiet -script $^ $@ $(FAST) $(SUPPRESS_ERRORS) $(PASS2) : $(OBJDIR)/.pass2-%.ttf : pass2-smartround.js $(OBJDIR)/.pass1-%.ttf node $^ $@ --upm $(TARGETUPM) $(PASS3) : $(OBJDIR)/.pass3-%.ttf : pass3-features.py $(OBJDIR)/.pass2-%.ttf $(OBJDIR)/.pass0-%.fea diff --git a/pass1-cleanup.py b/pass1-cleanup.py index e4ff78b..233a694 100644 --- a/pass1-cleanup.py +++ b/pass1-cleanup.py @@ -6,13 +6,16 @@ import sys source = sys.argv[1] font = fontforge.open(source) +print sys.argv + # Replace accented characters into references -print "Reference finding: ", font.fontname -font.selection.select(("ranges", "unicode", None), 0x1FCD, 0x1FCF, 0x1FDD, 0x1FDF) -font.replaceWithReference(2) -font.selection.all() -font.selection.select(("less", None), "I.straight", "dotlessi.straight", "l.straight", "rtailBR") -font.replaceWithReference(2) +if len(sys.argv) <= 3: + print "Reference finding: ", font.fontname + font.selection.select(("ranges", "unicode", None), 0x1FCD, 0x1FCF, 0x1FDD, 0x1FDF) + font.replaceWithReference(2) + font.selection.all() + font.selection.select(("less", None), "I.straight", "dotlessi.straight", "l.straight", "ltailBR", "rtailBR") + font.replaceWithReference(2) # Remove overlapped area print "Overlap Removal: ", font.fontname @@ -25,8 +28,9 @@ for i in font: if len(glyph.references) > 0 and len(glyph.layers["Fore"]) > 0: # a mixed glyph glyph.unlinkRef() glyph.removeOverlap() -font.selection.all() -font.replaceWithReference(2) +if len(sys.argv) <= 3: + font.selection.all() + font.replaceWithReference(2) # Outline simplify print "Simplify, pass 1: ", font.fontname