From 67a79b80ea9dca82b96c2a9f578c7bfc52d6a94e Mon Sep 17 00:00:00 2001 From: be5invis Date: Tue, 13 Dec 2022 20:12:58 -0800 Subject: [PATCH] Mark adjustments --- .../glyphs/letter/greek/lower-epsilon.ptl | 2 ++ font-src/glyphs/letter/latin-ext/long-s.ptl | 5 ++-- font-src/glyphs/letter/latin/c.ptl | 5 +++- font-src/glyphs/letter/latin/lower-e.ptl | 12 ++++++---- font-src/glyphs/letter/latin/lower-g.ptl | 16 +++++-------- font-src/glyphs/letter/latin/lower-il.ptl | 3 ++- font-src/glyphs/letter/latin/lower-p.ptl | 7 +++--- font-src/glyphs/letter/shared.ptl | 23 +++++++++++-------- font-src/glyphs/marks/adjust.ptl | 10 ++++++++ font-src/glyphs/marks/index.ptl | 2 ++ 10 files changed, 53 insertions(+), 32 deletions(-) create mode 100644 font-src/glyphs/marks/adjust.ptl diff --git a/font-src/glyphs/letter/greek/lower-epsilon.ptl b/font-src/glyphs/letter/greek/lower-epsilon.ptl index dcac95fa7..cbd10a361 100644 --- a/font-src/glyphs/letter/greek/lower-epsilon.ptl +++ b/font-src/glyphs/letter/greek/lower-epsilon.ptl @@ -7,6 +7,7 @@ glyph-module glyph-block Letter-Greek-Lower-Epsilon : begin glyph-block-import CommonShapes glyph-block-import Common-Derivatives + glyph-block-import Mark-Adjustment : ExtendBelowBaseAnchors glyph-block-import Letter-Shared : CreateAccentedComposition glyph-block-import Letter-Shared-Shapes : SerifedArcStart_RtlLhs SerifedArcStart_LtrRhs glyph-block-import Letter-Shared-Shapes : InwardSlabArcStart_RtlLhs InwardSlabArcStart_LtrRhs @@ -214,6 +215,7 @@ glyph-block Letter-Greek-Lower-Epsilon : begin RetroflexHook (RightSB - HVContrast * [RetroflexHook.sw Stroke]) 0 derive-composites 'latn/epsilonRevRetroflexHook' 0x1D94 'latn/epsilonRev/descBase' RetroflexHook SB 0 + ExtendBelowBaseAnchors (-Hook) CreateAccentedComposition 'cyrl/Ksi' 0x46E 'cyrl/KsiBase' 'caronAbove' CreateAccentedComposition 'cyrl/ksi' 0x46F 'cyrl/ksiBase' 'caronAbove' diff --git a/font-src/glyphs/letter/latin-ext/long-s.ptl b/font-src/glyphs/letter/latin-ext/long-s.ptl index 1fdd0b980..fd8aeb991 100644 --- a/font-src/glyphs/letter/latin-ext/long-s.ptl +++ b/font-src/glyphs/letter/latin-ext/long-s.ptl @@ -129,9 +129,8 @@ glyph-block Letter-Latin-Long-S : begin alias 'esh' 0x283 'longs.flatHookTailed' derive-composites 'eshPalatalHook' 0x1D8B 'esh' - difference - PalatalHook (x -- RightSB) (y -- 0) (xAttach -- Middle) (refSw -- [AdviceStroke 3]) - intersection [MaskBelow 0] [MaskLeft (Middle + HVContrast * HalfStroke)] + PalatalHook (x -- RightSB) (y -- 0) (xAttach -- Middle) (refSw -- [AdviceStroke 3]) + maskOut -- [intersection [MaskBelow 0] [MaskLeft (Middle + HVContrast * HalfStroke)]] create-glyph 'eshRetroflexHook' 0x1D98 : glyph-proc include : MarkSet.if include : LongSShape Ascender (Descender + Hook) (HookX + 0.25 * Stroke) Hook diff --git a/font-src/glyphs/letter/latin/c.ptl b/font-src/glyphs/letter/latin/c.ptl index 8887fdfb2..1fffef1e3 100644 --- a/font-src/glyphs/letter/latin/c.ptl +++ b/font-src/glyphs/letter/latin/c.ptl @@ -8,6 +8,7 @@ glyph-module glyph-block Letter-Latin-C : begin glyph-block-import CommonShapes glyph-block-import Common-Derivatives + glyph-block-import Mark-Adjustment : ExtendBelowBaseAnchors glyph-block-import Letter-Shared : CreateAccentedComposition glyph-block-import Letter-Shared-Shapes : SerifFrame CurlyTail DToothlessRise ArcStartHookTop glyph-block-import Letter-Shared-Shapes : SerifedArcStart_RtlLhs SerifedArcStart_LtrRhs @@ -365,7 +366,9 @@ glyph-block Letter-Latin-C : begin alias 'grek/revLunateSmallSigma' 0x37B 'revSmallC.serifless' turned 'turnc/turnDescBase' null 'c/turnDescBase' Middle (XH / 2) - derive-composites 'turncRetroflexHook' 0x1D97 'turnc/turnDescBase' : RetroflexHook SB 0 + derive-composites 'turncRetroflexHook' 0x1D97 'turnc/turnDescBase' + RetroflexHook SB 0 + ExtendBelowBaseAnchors (-Hook) define [LunateSigmaShape k fRound kdr] : begin local halfDotWidth : kdr * [Math.min DotRadius ((RightSB - SB - HVContrast * Stroke * 2) / 4)] diff --git a/font-src/glyphs/letter/latin/lower-e.ptl b/font-src/glyphs/letter/latin/lower-e.ptl index 572d12728..372a8db3f 100644 --- a/font-src/glyphs/letter/latin/lower-e.ptl +++ b/font-src/glyphs/letter/latin/lower-e.ptl @@ -9,7 +9,7 @@ glyph-block Letter-Latin-Lower-E : begin glyph-block-import CommonShapes glyph-block-import Common-Derivatives glyph-block-import Letter-Shared-Shapes : FlatHookDepth RetroflexHook - + glyph-block-import Mark-Adjustment : ExtendBelowBaseAnchors glyph-block-import Mark-Shared-Metrics : markExtend markStroke markStress markFine glyph-block-import Mark-Above : aboveMarkTop aboveMarkBot aboveMarkMid aboveMarkStack @@ -217,10 +217,12 @@ glyph-block Letter-Latin-Lower-E : begin select-variant 'schwa' 0x259 alias 'cyrl/schwa' 0x4D9 'turne' - derive-composites 'schwaRetroflexHook' 0x1D95 'schwa' : RetroflexHook.r - x -- [mix (Middle + CorrectionOMidS) RightSB 0.75] - y -- 0 - yAttach -- [mix O SmallArchDepthA : archv.yFromX 0.75] + derive-composites 'schwaRetroflexHook' 0x1D95 'schwa' + RetroflexHook.r + x -- [mix (Middle + CorrectionOMidS) RightSB 0.75] + y -- 0 + yAttach -- [mix O SmallArchDepthA : archv.yFromX 0.75] + ExtendBelowBaseAnchors (-Hook) select-variant 'eRev' 0x258 (follow -- 'e') diff --git a/font-src/glyphs/letter/latin/lower-g.ptl b/font-src/glyphs/letter/latin/lower-g.ptl index 326a91502..48951d8cd 100644 --- a/font-src/glyphs/letter/latin/lower-g.ptl +++ b/font-src/glyphs/letter/latin/lower-g.ptl @@ -150,16 +150,12 @@ glyph-block Letter-Latin-Lower-G : begin define dfSub : DivFrame 0.75 2 include : bodyShape dfSub XH include : hookShape dfSub (XH - hookStart) - include : difference - PalatalHook - x -- RightSB - y -- 0 - xAttach -- dfSub.rightSB - refSw -- dfSub.mvs - intersection - MaskBelow 0 - MaskLeft dfSub.rightSB - + include : PalatalHook + x -- RightSB + y -- 0 + xAttach -- dfSub.rightSB + refSw -- dfSub.mvs + maskOut -- [intersection [MaskBelow 0] [MaskLeft dfSub.rightSB]] select-variant 'g' 'g' link-reduced-variant 'g/sansSerif' 'g' MathSansSerif diff --git a/font-src/glyphs/letter/latin/lower-il.ptl b/font-src/glyphs/letter/latin/lower-il.ptl index 4a1636b45..1f6c9b107 100644 --- a/font-src/glyphs/letter/latin/lower-il.ptl +++ b/font-src/glyphs/letter/latin/lower-il.ptl @@ -272,11 +272,12 @@ glyph-block Letter-Latin-Lower-I : begin create-glyph "lPalatalHook.\(suffix)" : glyph-proc include [refer-glyph "l.\(suffix)"] AS_BASE ALSO_METRICS local { attach posX maskY } : calcPhoneticHookPos currentGlyph - include : intersection [MaskBelow maskY] : PalatalHook + include : PalatalHook x -- posX y -- 0 xAttach -- attach.x yOverflow -- Stroke + maskOut -- [MaskAbove maskY] do "i glyphs" select-variant 'dotlessi' 0x131 diff --git a/font-src/glyphs/letter/latin/lower-p.ptl b/font-src/glyphs/letter/latin/lower-p.ptl index 116616f7d..4bf3a427e 100644 --- a/font-src/glyphs/letter/latin/lower-p.ptl +++ b/font-src/glyphs/letter/latin/lower-p.ptl @@ -65,9 +65,10 @@ glyph-block Letter-Latin-Lower-P : begin x -- [mix (Middle + CorrectionOMidS) RightSB 0.75] y -- 0 yAttach -- [mix O SmallArchDepthA : archv.yFromX 0.75] - intersection - MaskBelow 0 - MaskLeft (SB + HVContrast * Stroke + [Math.max (Width / 16) [AdviceStroke 12]]) + maskOut -- [intersection + [MaskBelow 0] + [MaskLeft (SB + HVContrast * Stroke + [Math.max (Width / 16) [AdviceStroke 12]])] + ] CreateAccentedComposition 'pTildeOver' 0x1D71 'p' 'tildeOverOnBar' diff --git a/font-src/glyphs/letter/shared.ptl b/font-src/glyphs/letter/shared.ptl index a441f4152..d689c818e 100644 --- a/font-src/glyphs/letter/shared.ptl +++ b/font-src/glyphs/letter/shared.ptl @@ -112,6 +112,7 @@ glyph-block Letter-Shared-Metrics : begin glyph-block Letter-Shared-Shapes : begin glyph-block-import CommonShapes glyph-block-import Common-Derivatives + glyph-block-import Mark-Adjustment : ExtendBelowBaseAnchors glyph-block-export RightwardTailedBar define [RightwardTailedBar] : params [x low high [sw Stroke]] : begin @@ -530,17 +531,21 @@ glyph-block Letter-Shared-Shapes : begin glyph-proc glyph-block-export PalatalHook - define [PalatalHook] : params [x y [xAttach x] [yAttach y] [yOverflow 0] [refSw Stroke]] : glyph-proc + define [PalatalHook] : params [x y [xAttach x] [yAttach y] [yOverflow 0] [refSw Stroke] [maskOut null]] : glyph-proc local sw : PalatalHook.sw refSw local hd : FlatHookDepth [DivFrame 1] - if (xAttach < x) : include : HBarBottom xAttach x yAttach - include : dispiro - widths.rhs sw - flat x (yAttach + yOverflow) [heading Downward] - curl x (y + hd.y - Hook - 0.25 * sw) - arcvh - flat (x - hd.x + 0.25 * sw * HVContrast) (y - Hook) - curl (x - HookX - 0.5 * sw * HVContrast) (y - Hook) + include : ExtendBelowBaseAnchors (y - Hook) + include : difference + union + if (xAttach < x) [HBarBottom xAttach x yAttach] [no-shape] + dispiro + widths.rhs sw + flat x (yAttach + yOverflow) [heading Downward] + curl x (y + hd.y - Hook - 0.25 * sw) + arcvh + flat (x - hd.x + 0.25 * sw * HVContrast) (y - Hook) + curl (x - HookX - 0.5 * sw * HVContrast) (y - Hook) + if maskOut maskOut [no-shape] set PalatalHook.adviceGap : function [refSw] HVContrast * [PalatalHook.sw refSw] + [Math.max (Width / 16) [AdviceStroke 12]] diff --git a/font-src/glyphs/marks/adjust.ptl b/font-src/glyphs/marks/adjust.ptl new file mode 100644 index 000000000..65836bb8a --- /dev/null +++ b/font-src/glyphs/marks/adjust.ptl @@ -0,0 +1,10 @@ +$$include '../../meta/macros.ptl' + +glyph-module + +glyph-block Mark-Adjustment : begin + glyph-block-export ExtendBelowBaseAnchors + define [ExtendBelowBaseAnchors y] : glyph-proc + if currentGlyph.baseAnchors.below : begin + local a : currentGlyph.gizmo.unapply currentGlyph.baseAnchors.below + if (a.y > y) : set-base-anchor 'below' a.x y diff --git a/font-src/glyphs/marks/index.ptl b/font-src/glyphs/marks/index.ptl index 0b4c51330..49c864c97 100644 --- a/font-src/glyphs/marks/index.ptl +++ b/font-src/glyphs/marks/index.ptl @@ -12,3 +12,5 @@ export : define [apply] : begin run-glyph-module "./tie.mjs" run-glyph-module "./composite.mjs" run-glyph-module "./doppelganger.mjs" + + run-glyph-module "./adjust.mjs"