From 522395405962fb6c33191097afc628cb5c0a77a5 Mon Sep 17 00:00:00 2001 From: Belleve Invis Date: Fri, 10 Apr 2020 18:23:16 -0700 Subject: [PATCH] Fix phonetic ligatures' shape. Now they are connected more closely (#488). --- changes/3.0.0-z.md | 1 + glyphs/autobuild-transformed.ptl | 64 +++++++++++++++++++---- glyphs/letters-unified-basic.ptl | 87 ++++++++++++++++++++++++++------ 3 files changed, 126 insertions(+), 26 deletions(-) create mode 100644 changes/3.0.0-z.md diff --git a/changes/3.0.0-z.md b/changes/3.0.0-z.md new file mode 100644 index 0000000000..4445feb6b2 --- /dev/null +++ b/changes/3.0.0-z.md @@ -0,0 +1 @@ + * Fixed phonetic ligatures' shape. Now they are connected more closely (#488). diff --git a/glyphs/autobuild-transformed.ptl b/glyphs/autobuild-transformed.ptl index c79f6dacbe..a08c675fb4 100644 --- a/glyphs/autobuild-transformed.ptl +++ b/glyphs/autobuild-transformed.ptl @@ -1,7 +1,7 @@ ###### Automatic builds $$include '../meta/macros.ptl' -import [linreg clamp fallback] from '../support/utils' +import [linreg clamp mix fallback] from '../support/utils' glyph-module @@ -517,18 +517,9 @@ glyph-block Autobuild-Transformed : begin list 0x1CA 'N' 'J' list 0x1CB 'N' 'j' list 0x1CC 'n' 'j' - list 0x2A3 'd' 'z' list 0x1F1 'D' 'Z' list 0x1F2 'D' 'z' list 0x1F3 'd' 'z' - list 0x2A4 'd' 'ezh' - list 0x2A5 'd' 'zcurlytail' - list 0x2A6 't' 's' - list 0x2A7 't' 'esh' - list 0x2A8 't' 'ccurlytail' - list 0x2A9 'f' 'eng' - list 0x2AA 'l' 's' - list 0x2AB 'l' 'z' list 0x478 'O' 'y' 'if' list 0x479 'o' 'y' 'p' list 0x20A7 'P' 's' @@ -542,6 +533,59 @@ glyph-block Autobuild-Transformed : begin list 0x2103 'degree' 'C' list 0x2109 'degree' 'F' + define [createPhoneticLigatures _shrink1 _shrink2 wadj1 wadj2 records] : begin + local pendingGlyphs1 : records.map : [record] => record.1 + local pendingGlyphs2 : records.map : [record] => record.2 + local shrink1 : clamp 0 1 _shrink1 + local shrink2 : clamp 0 1 _shrink2 + local kern : SB * shrink1 + SB * shrink2 + 0.5 * STROKE * [mix shrink1 shrink2 0.5] - OX * 2 + local antiScale : (WIDTH * shrink1 + WIDTH * shrink2 - kern) / WIDTH + foreach [cycle : range 0 4] : begin + set kern : SB * shrink1 + SB * shrink2 + 0.5 * STROKE * [mix shrink1 shrink2 0.5] - OX * 2 + local tmp-shrink1 : (shrink1 * WIDTH + kern * shrink1 / (shrink1 + shrink2)) / (WIDTH * shrink1 + WIDTH * shrink2 - kern) * antiScale + local tmp-shrink2 : (shrink2 * WIDTH + kern * shrink2 / (shrink1 + shrink2)) / (WIDTH * shrink1 + WIDTH * shrink2 - kern) * antiScale + set shrink1 : clamp 0 1 tmp-shrink1 + set shrink2 : clamp 0 1 tmp-shrink2 + + console.log cycle kern shrink1 shrink2 + + local df1 : Thinner pendingGlyphs1 shrink1 + local df2 : Thinner pendingGlyphs2 shrink2 + + foreach [{unicode c1 c2 desiredWidth} : items-of records] : begin + local glyphName "\(c1)_\(c2)" + if [query-glyph glyphName] : begin + local j 2 + while [query-glyph (glyphName + j)] : inc j + set glyphName (glyphName + j) + + sketch + local sumChildrenWidth : df1.(c1).advanceWidth * wadj1 + df2.(c2).advanceWidth * wadj2 + local refW : sumChildrenWidth - kern + include df2.(c2) + include : Translate (df1.(c1).advanceWidth * wadj1 - kern) 0 + include : intersection + Rect (CAP * 2) (DESCENDER * 2) (-WIDTH) (df1.(c1).advanceWidth * wadj1 - kern + df2.(c2).advanceWidth * wadj2 / 2) + glyph-construction : include df1.(c1) + # include : Translate (-df1.(c1).advanceWidth * (1 - wadj1) / 2) 0 + include : Upright + include : Translate (-refW / 2) 0 + include : Scale [clamp 0 1 ((WIDTH - SB * 1.25) / (WIDTH - SB * 2) * WIDTH / refW)] 1 + include : Translate (WIDTH / 2) 0 + include : Italify + save glyphName unicode + + if [not recursive] : createPhoneticLigatures stdShrink stdShrink 1 1 : list + list 0x2A3 'd' 'z' + list 0x2A4 'd' 'ezh' + list 0x2A5 'd' 'zcurlytail' + list 0x2A6 't.phoneticLeft' 's.phoneticRight' + list 0x2A7 't.phoneticLeft.extended' 'esh' + list 0x2A8 't.phoneticLeft' 'ccurlytail' + list 0x2A9 'f.straight' 'eng' + list 0x2AA 'l.phoneticLeft' 's.phoneticRight' + list 0x2AB 'l.phoneticLeft' 'z' + define [createAccentedEquals crowd scale records] : begin local pendingGlyphs : records.map : [record] => record.2 diff --git a/glyphs/letters-unified-basic.ptl b/glyphs/letters-unified-basic.ptl index 3747db745c..071b5793ca 100644 --- a/glyphs/letters-unified-basic.ptl +++ b/glyphs/letters-unified-basic.ptl @@ -492,6 +492,21 @@ glyph-block LetterUnified-Basic : begin set-anchor 'topright' BASE (df.middle + RIGHTSB - MIDDLE) CAP save 'l.italic' + sketch # l.phoneticLeft + local df : DivFrame 1 + set-width df.width + include df.markSet.b + define middle : SB + STROKE * HVCONTRAST + include : dispiro + widths.center + flat middle CAP [heading DOWNWARD] + curl middle HOOK + arcvh + flat (middle + HOOK - HALFSTROKE) HALFSTROKE + curl [Math.max RIGHTSB (middle + [Math.max HOOKX (LONGJUT * 1.05 * df.div)])] HALFSTROKE [heading RIGHTWARD] + set-anchor 'topright' BASE (df.middle + RIGHTSB - MIDDLE) CAP + save 'l.phoneticLeft' + sketch # l.tailed local df : DivFrame para.diversityI set-width df.width @@ -4194,27 +4209,46 @@ glyph-block LetterUnified-Basic : begin include MarkSet.b include : SmallTShape CAP 0 save 't.standard' + + define [TFlatShape df m ext] : glyph-construction + local crossLeft : mix 0 SB m + local crossRight : mix df.width df.rightSB m + local barleft : [mix crossLeft crossRight 0.42] - STROKE * 0.375 * HVCONTRAST + local tTurn : Math.max (HOOK * 0.9) (STROKE * 1.375) : Math.min HOOK (STROKE * 1.75) + include : union + dispiro + widths.rhs + flat (crossRight + ext) 0 + curl [Math.min (barleft + tTurn) (crossRight - 1)] 0 + archv + flat barleft tTurn + curl barleft CAP [heading UPWARD] + dispiro + widths.rhs + flat (crossLeft - HALFSTROKE * TANSLANT) XH + curl (crossRight - HALFSTROKE * TANSLANT) XH + set-anchor 'topright' BASE crossRight CAP + sketch # t.narrow local df : DivFrame para.diversityF set-width df.width include df.markSet.b - local crossLeft : mix 0 SB (1 / 2) - local crossRight : mix df.width df.rightSB (1 / 2) - local barleft : [mix crossLeft crossRight 0.42] - STROKE * 0.375 * HVCONTRAST - local tTurn : Math.max (HOOK * 0.9) (STROKE * 1.375) : Math.min HOOK (STROKE * 1.75) - include : dispiro - widths.rhs - flat crossRight 0 - curl [Math.min (barleft + tTurn) (crossRight - 1)] 0 - archv - flat barleft tTurn - curl barleft CAP [heading UPWARD] - include : dispiro - widths.rhs - flat (crossLeft - HALFSTROKE * TANSLANT) XH - curl (crossRight - HALFSTROKE * TANSLANT) XH - set-anchor 'topright' BASE crossRight CAP + include : TFlatShape df 0.5 0 save 't.narrow' + sketch # t.phoneticLeft + local df : DivFrame 1 + set-width df.width + include df.markSet.b + include : TFlatShape df 1 0 + save 't.phoneticLeft' + sketch # t.phoneticLeft.extended + local df : DivFrame 1 + set-width df.width + include df.markSet.b + include : intersection + TFlatShape df 1 WIDTH + Rect CAP 0 SB (MIDDLE + WIDTH) + save 't.phoneticLeft.extended' sketch # t.cross set-width WIDTH include MarkSet.b @@ -4317,6 +4351,22 @@ glyph-block LetterUnified-Basic : begin hookend O (sw -- stroke) (swItalicAdj -- STROKE) g4 (SB - OX / 4) SHOOK + define [sStrokePhoneticRight] : begin + define stroke : adviceBlackness2 2.875 2 XH + define ess : mix stroke (ESS * stroke / STROKE) 0.5 + define strokeCoeff : linreg 18 0 126 1 stroke + define smooth : adviceSSmooth XH (-1) stroke + return : dispiro + widths.lhs stroke + g4 (RIGHTSB + OX / 4) (XH - SHOOK) + hookstart XO (sw -- stroke) (swItalicAdj -- STROKE) + g4 (SB + OX / 8) (XH - smooth) + SNeck stroke (slantCoeff -- -0.01) + g4 (RIGHTSB - OX / 8) (smooth) [widths 0 stroke] + arcvh + flat (MIDDLE - CORRECTION_OMIDS) 0 [widths 0 STROKE] + curl SB 0 + define [RevsStroke] : begin define stroke : adviceBlackness2 2.875 2 XH define ess : ESS * stroke / STROKE @@ -4344,6 +4394,11 @@ glyph-block LetterUnified-Basic : begin save 's' 's' save 'cyrdze' 0x455 + sketch # s + include MarkSet.e + include : sStrokePhoneticRight + save 's.phoneticRight' + sketch # revS include MarkSet.capital include : RevSStroke