From 2abffb0e697620ba0d7837fde36635cfa3bb7843 Mon Sep 17 00:00:00 2001 From: be5invis Date: Sun, 12 Nov 2023 16:16:17 -0800 Subject: [PATCH] Bugfixes for LHA (#2018, #2088) --- .../glyphs/letter/latin-ext/lower-ae-oe.ptl | 32 ++++++++++++------- font-src/glyphs/letter/latin/x.ptl | 27 +++++++++------- font-src/glyphs/letter/shared.ptl | 2 +- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/font-src/glyphs/letter/latin-ext/lower-ae-oe.ptl b/font-src/glyphs/letter/latin-ext/lower-ae-oe.ptl index 9dafe2452..00c7bc20e 100644 --- a/font-src/glyphs/letter/latin-ext/lower-ae-oe.ptl +++ b/font-src/glyphs/letter/latin-ext/lower-ae-oe.ptl @@ -18,6 +18,13 @@ glyph-block Letter-Latin-Lower-AE-OE : begin local shift : pShift * subDfFullShift return { subDf shift } + glyph-block-export SubDfAndShiftEx + define [SubDfAndShiftEx p q pShift df _o] : begin + local subDf : df.slice p q _o + local subDfFullShift : df.rightSB - subDf.rightSB + local shift : pShift * subDfFullShift + return { subDf shift } + do "a subglyphs" define [AAShape body hookStyle pShift df o] : begin local { subDf shift } : SubDfAndShift pShift df o @@ -247,9 +254,12 @@ glyph-block Letter-Latin-Lower-AE-OE : begin [Just XSerifs.BilateralMotion] : composite-proc sf.rb.outer __ : glyph-proc - define [letterShape df top bot turn tension] : glyph-proc + define [LhaRightLetterShape df top bot turn tension] : glyph-proc local stroke1f : if (stroke1 == 3) 4 stroke1 local lf : XLetterForm df top bot stroke1f stroke2 turn tension + sw -- df.mvs + swCursiveEnd -- [AdviceStroke 3 df.div] + swCursiveMid -- df.mvs include : WithSerifOverflowMask fMaskBase top bot df.leftSB df.rightSB : lf.base fMaskBase if serifShape : begin local sf : SerifFrame.fromDf df top bot @@ -265,20 +275,20 @@ glyph-block Letter-Latin-Lower-AE-OE : begin include : halfLetterShape df XH 0 0.1 0.20 create-glyph "cyrl/lha/right.\(suffix)" : glyph-proc - local df : DivFrame para.diversityM 3 + local df : DivFrame para.diversityM 3.5 set-width 0 set-mark-anchor 'cvDecompose' 0 0 - local { subDf shift } : SubDfAndShift 1 df - include : with-transform [ApparentTranslate shift 0] : letterShape subDf XH 0 0.1 0.20 + local { subDf shift } : SubDfAndShiftEx 6 4 1 df + include : with-transform [ApparentTranslate shift 0] : LhaRightLetterShape subDf XH 0 0.1 0.20 create-glyph "cyrl/Lha/right.\(suffix)" : glyph-proc - local df : DivFrame para.diversityM 3 + local df : DivFrame para.diversityM 3.5 set-width 0 set-mark-anchor 'cvDecompose' 0 0 - local { subDf shift } : SubDfAndShift 1 df - include : with-transform [ApparentTranslate shift 0] : letterShape subDf CAP 0 0.1 0.28 + local { subDf shift } : SubDfAndShiftEx 6 4 1 df + include : with-transform [ApparentTranslate shift 0] : LhaRightLetterShape subDf CAP 0 0.1 0.28 do "other subglyphs" # Te @@ -314,16 +324,16 @@ glyph-block Letter-Latin-Lower-AE-OE : begin # El glyph-block-import Letter-Cyrillic-El : CyrElShape create-glyph 'cyrl/Lha/left' : glyph-proc - local df : include : DivFrame para.diversityM 3 + local df : include : DivFrame para.diversityM 3.5 include : df.markSet.capital - local { subDf } : SubDfAndShift 0 df + local { subDf } : SubDfAndShiftEx 6 3 0 df set-base-anchor 'cvDecompose' 0 0 include : CyrElShape subDf.leftSB (subDf.rightSB - [HSwToV : 0.5 * df.mvs]) CAP 0 [if SLAB 4 0] df.mvs create-glyph 'cyrl/lha/left' : glyph-proc - local df : include : DivFrame para.diversityM 3 + local df : include : DivFrame para.diversityM 3.5 include : df.markSet.e - local { subDf } : SubDfAndShift 0 df + local { subDf } : SubDfAndShiftEx 6 3 0 df set-base-anchor 'cvDecompose' 0 0 include : CyrElShape subDf.leftSB (subDf.rightSB - [HSwToV : 0.5 * df.mvs]) XH 0 [if SLAB 4 0] df.mvs diff --git a/font-src/glyphs/letter/latin/x.ptl b/font-src/glyphs/letter/latin/x.ptl index 94114880d..3cead6a3b 100644 --- a/font-src/glyphs/letter/latin/x.ptl +++ b/font-src/glyphs/letter/latin/x.ptl @@ -34,7 +34,7 @@ glyph-block Letter-Latin-X : begin local straightxleft : mix leftx rightx pStraight local straightyleft : mix cyleft righty pStraight include : dispiro - widths.center + widths.center sw flat leftx lefty [heading [if (lefty < righty) Upward Downward]] curl leftx turnyleft [heading [if (lefty < righty) Upward Downward]] quadControls 0 ((cyleft - turnyleft) / (straightyleft - turnyleft)) 24 @@ -75,8 +75,8 @@ glyph-block Letter-Latin-X : begin glyph-block-export XCursiveHalfShape define [XCursiveHalfShape] : with-params [ - top bottom left right - [sw Stroke] [swEnd : AdviceStroke 2.75] [swMid : AdviceStroke 3] + top bottom left right + [sw Stroke] [swEnd : AdviceStroke 2.75] [swMid : AdviceStroke 3] [kThin 0.55] [setMark false] [flatTail false] ] : glyph-proc local ada : ArchDepthAOf (ArchDepth * 0.8) (Width / 2) @@ -85,7 +85,7 @@ glyph-block Letter-Latin-X : begin define xCenterRight : left + [HSwToV swMid] / 2 define xTurn : mix (right - [HSwToV swEnd]) xCenterRight 0.5 - define hook1Depth : Hook + sw * 0.125 + define hook1Depth : Math.max (sw * 2) (div * (Hook + sw * 0.125)) define hook1StraightDepth : Math.min hook1Depth - swEnd * 1.125 Math.max 1 : hook1Depth / 5 - swEnd / 4 @@ -108,7 +108,7 @@ glyph-block Letter-Latin-X : begin flat (xCenterRight - [HSwToV fineMid]) ([mix bottom top 0.5] - O) [widths.lhs fineMid] curl (xCenterRight - [HSwToV fineMid]) (bottom + [Math.min adb (swMid + rIn)]) arcvh - flat (xCenterRight + div * rIn + 0.25 * TanSlope * rIn) bottom [widths.lhs.heading sw Rightward] + flat (xCenterRight + div * (0.5 * swMid + rIn) + 0.25 * TanSlope * (0.5 * swMid + rIn)) bottom [widths.lhs.heading sw Rightward] curl right bottom dispiro flat (xCenterRight - [HSwToV : 0.5 * fineMid]) ([mix bottom top 0.5] - O) [widths.center fineMid] @@ -132,7 +132,10 @@ glyph-block Letter-Latin-X : begin stroke1 stroke2 turn tension [sw df.mvs] + [swCursiveEnd : (sw / Stroke) * [AdviceStroke 2.75]] + [swCursiveMid : (sw / Stroke) * [AdviceStroke 3]] ] : namespace + local sw df.mvs export : define [base fSlab] : union match stroke1 [Just STROKE-STRAIGHT] : XStrand true fSlab df.leftSB bot df.rightSB top turn 0.4 tension sw @@ -141,8 +144,8 @@ glyph-block Letter-Latin-X : begin ([Just STROKE-CURSIVE] || [Just STROKE-CURSIVE-FLAT]) : composite-proc XCursiveHalfShape top bot df.middle df.rightSB sw -- sw - swEnd -- (sw / Stroke) * [AdviceStroke 2.75] - swMid -- (sw / Stroke) * [AdviceStroke 3] + swEnd -- swCursiveEnd + swMid -- swCursiveMid flatTail -- (stroke1 === STROKE-CURSIVE-FLAT) FlipAround df.middle [mix bot top 0.5] __ : glyph-proc @@ -152,8 +155,8 @@ glyph-block Letter-Latin-X : begin [Just STROKE-CHANCERY] : XChanceryStrand (+1) df.leftSB top df.rightSB bot false sw [Just STROKE-CURSIVE] : XCursiveHalfShape top bot df.middle df.rightSB sw -- sw - swEnd -- (sw / Stroke) * [AdviceStroke 2.75] - swMid -- (sw / Stroke) * [AdviceStroke 3] + swEnd -- swCursiveEnd + swMid -- swCursiveMid setMark -- true __ : glyph-proc @@ -172,8 +175,8 @@ glyph-block Letter-Latin-X : begin [Just STROKE-CHANCERY] : XChanceryStrand (+1) df.leftSB top df.rightSB bot true sw [Just STROKE-CURSIVE] : XCursiveHalfShape top bot df.middle df.rightSB sw -- sw - swEnd -- (sw / Stroke) * [AdviceStroke 2.75] - swMid -- (sw / Stroke) * [AdviceStroke 3] + swEnd -- swCursiveEnd + swMid -- swCursiveMid setMark -- true __ : glyph-proc @@ -200,7 +203,7 @@ glyph-block Letter-Latin-X : begin foreach { suffix {stroke1 stroke2 serifShape fMaskBase} } [Object.entries XConfig] : do define [letterShape top bot turn tension] : glyph-proc - local df : DivFrame 1 + local df : DivFrame 1 2 local lf : XLetterForm df top bot stroke1 stroke2 turn tension include : WithSerifOverflowMask fMaskBase top bot df.leftSB df.rightSB : lf.base fMaskBase if serifShape : begin diff --git a/font-src/glyphs/letter/shared.ptl b/font-src/glyphs/letter/shared.ptl index b9f3a2135..1b7c8ef63 100644 --- a/font-src/glyphs/letter/shared.ptl +++ b/font-src/glyphs/letter/shared.ptl @@ -788,7 +788,7 @@ glyph-block Letter-Shared-Shapes : begin widths.lhs fine flat ztop.x ztop.y [heading Downward] curl xb [mix (zbot.y + LongJut) ztop.y 0.25] - alsoThruThem {{0.5 0.94}} + alsoThruThem {{0.2 0.76} {0.3 0.85} {0.5 0.94}} straight.left.end zbot.x (zbot.y + fine) [heading Leftward] glyph-block-export UpwardHookShape