Minor shape optimizations
This commit is contained in:
parent
6ecd8679b3
commit
1a6a68f60f
2 changed files with 59 additions and 67 deletions
|
@ -55,20 +55,22 @@ glyph-block Letter-Cyrillic-Zhe : begin
|
|||
corner (df.width - attach1X) (attach1Y + 0.1)
|
||||
corner (df.rightSB - overshoot - 0.1) top
|
||||
|
||||
local rightShape : union
|
||||
local rightHalf : union
|
||||
intersection [MaskRight df.middle]
|
||||
ExtLineRhs 4 fine (df.rightSB - overshoot) top (df.width - attach1X) attach1Y
|
||||
intersection [MaskRight df.middle] : difference
|
||||
ExtLineLhs 4 fine (df.rightSB - overshoot) bot (df.width - attach1X) attach2Y
|
||||
mask
|
||||
|
||||
local fullShape : if fHalf rightShape : union rightShape
|
||||
local leftHalf : union
|
||||
intersection [MaskLeft df.middle]
|
||||
ExtLineLhs 4 fine (df.leftSB + overshoot) top attach1X attach1Y
|
||||
intersection [MaskLeft df.middle] : difference
|
||||
ExtLineRhs 4 fine (df.leftSB + overshoot) bot attach1X attach2Y
|
||||
mask
|
||||
|
||||
local fullShape : if fHalf rightHalf : union rightHalf leftHalf
|
||||
|
||||
return : intersection [MaskBelow top] [MaskAbove bot] fullShape
|
||||
|
||||
export : define [CurlyLegs fSlab fHalf df bot top] : begin
|
||||
|
@ -83,7 +85,7 @@ glyph-block Letter-Cyrillic-Zhe : begin
|
|||
define [upperCurvature] : bezControls 0 0.3 0.5 0.75 8
|
||||
define [lowerCurvature] : quadControls 0 0.3 8
|
||||
|
||||
local rightShape : union
|
||||
local rightHalf : union
|
||||
dispiro
|
||||
g4.down.start (df.rightSB - overshoot) top [widths.rhs.heading fine Downward]
|
||||
upperCurvature
|
||||
|
@ -99,7 +101,7 @@ glyph-block Letter-Cyrillic-Zhe : begin
|
|||
corner (df.width - attach1X) (attach1Y + 0.1)
|
||||
corner df.middle top
|
||||
|
||||
local fullShape : if fHalf rightShape : union rightShape
|
||||
local leftHalf : union
|
||||
dispiro
|
||||
g4.down.start (df.leftSB + overshoot) top [widths.lhs.heading fine Downward]
|
||||
upperCurvature
|
||||
|
@ -115,6 +117,8 @@ glyph-block Letter-Cyrillic-Zhe : begin
|
|||
corner attach1X (attach1Y + 0.1)
|
||||
corner df.middle top
|
||||
|
||||
local fullShape : if fHalf rightHalf : union rightHalf leftHalf
|
||||
|
||||
return : intersection [MaskBelow top] [MaskAbove bot] fullShape
|
||||
|
||||
export : define [TouchingLegs fSlab fHalf df bot top] : ConnectedLegsImpl 1.00 fSlab fHalf df bot top
|
||||
|
@ -126,18 +130,20 @@ glyph-block Letter-Cyrillic-Zhe : begin
|
|||
define midY : mix bot top 0.5
|
||||
define overshoot : Overshoot fSlab df
|
||||
|
||||
local rightShape : union
|
||||
local rightHalf : union
|
||||
intersection [MaskBelow midY] [MaskAbove bot]
|
||||
ExtLineLhs 4 fine (df.rightSB - overshoot) bot (df.width - midX) midY
|
||||
intersection [MaskBelow top] [MaskAbove midY]
|
||||
ExtLineRhs 4 fine (df.rightSB - overshoot) top (df.width - midX) midY
|
||||
|
||||
local fullShape : if fHalf rightShape : union rightShape
|
||||
local leftHalf : union
|
||||
intersection [MaskBelow midY] [MaskAbove bot]
|
||||
ExtLineRhs 4 fine (df.leftSB + overshoot) bot midX midY
|
||||
intersection [MaskBelow top] [MaskAbove midY]
|
||||
ExtLineLhs 4 fine (df.leftSB + overshoot) top midX midY
|
||||
|
||||
local fullShape : if fHalf rightHalf : union rightHalf leftHalf
|
||||
|
||||
return : union fullShape : HBar.m [if fHalf df.middle midX] (df.width - midX) midY fine
|
||||
|
||||
export : define [CursiveLegs fSlab fHalf df bot top] : begin
|
||||
|
@ -147,20 +153,16 @@ glyph-block Letter-Cyrillic-Zhe : begin
|
|||
define midY : mix bot top 0.5
|
||||
define overshoot : Overshoot fSlab df
|
||||
|
||||
local rightShape : dispiro
|
||||
g4.left.start (df.rightSB - overshoot) (top - fine) [widths.rhs.heading fine Leftward]
|
||||
archv
|
||||
g4.down.mid (df.width - midX + OX) midY [widths.rhs.heading fine2 Downward]
|
||||
arcvh
|
||||
g4.right.end (df.rightSB - overshoot) (bot + fine) [widths.rhs.heading fine Rightward]
|
||||
local rightHalf : dispiro
|
||||
straight.left.start (df.rightSB - overshoot) (top - fine) [widths.rhs.heading fine Leftward]
|
||||
archv
|
||||
g4.down.mid (df.width - midX + OX) midY [widths.rhs.heading fine2 Downward]
|
||||
arcvh
|
||||
straight.right.end (df.rightSB - overshoot) (bot + fine) [widths.rhs.heading fine Rightward]
|
||||
|
||||
local fullShape : if fHalf rightShape : union rightShape
|
||||
dispiro
|
||||
g4.right.start (df.leftSB + overshoot) (top - fine) [widths.lhs.heading fine Rightward]
|
||||
archv
|
||||
g4.down.mid (midX - OX) midY [widths.lhs.heading fine2 Downward]
|
||||
arcvh
|
||||
g4.left.end (df.leftSB + overshoot) (bot + fine) [widths.lhs.heading fine Leftward]
|
||||
local leftHalf : with-transform [FlipAround df.middle (0.5 * top)] rightHalf
|
||||
|
||||
local fullShape : if fHalf rightHalf : union rightHalf leftHalf
|
||||
|
||||
return : union fullShape : HBar.m [if fHalf df.middle (midX + 0.5 * fine)] (df.width - (midX + 0.5 * fine)) midY fine
|
||||
|
||||
|
|
|
@ -49,6 +49,42 @@ glyph-block Letter-Latin-X : begin
|
|||
include : HalfXStrand stb slab _leftx lefty middlex middley turn pStraight tension
|
||||
include : HalfXStrand stb slab _rightx righty middlex middley turn pStraight tension
|
||||
|
||||
glyph-block-export XCursiveHalfShape
|
||||
define [XCursiveHalfShape] : with-params [top bottom left right [swEnd : AdviceStroke 2.75] [swMid : AdviceStroke 3] [kThin 0.55] [setMark false]] : glyph-proc
|
||||
local ada : ArchDepthAOf (ArchDepth * 0.8) (Width / 2)
|
||||
local adb : ArchDepthBOf (ArchDepth * 0.8) (Width / 2)
|
||||
|
||||
define xCenterRight : left + [HSwToV swMid] / 2
|
||||
define xCenterLeft : left - [HSwToV swMid] / 2
|
||||
define xTurn : mix (right - [HSwToV swEnd]) xCenterRight 0.5
|
||||
define hook1Depth : Hook + Stroke * 0.125
|
||||
define hook1StraightDepth : Math.min
|
||||
hook1Depth - swEnd * 1.125
|
||||
Math.max 1 : hook1Depth / 5 - swEnd / 4
|
||||
|
||||
define fineMid : swMid * kThin
|
||||
define rIn : Math.max (0.4 * (right - left) - [HSwToV : 0.7 * Stroke]) [AdviceStroke 16]
|
||||
define flatHookDepth : 1.4 * (right - left) - swEnd - 1.5 * rIn
|
||||
|
||||
define upperHalf : include : dispiro
|
||||
flat (xCenterRight - [HSwToV fineMid]) ([mix bottom top 0.5] + O) [widths.rhs.heading fineMid Upward]
|
||||
curl (xCenterRight - [HSwToV fineMid]) (top - ada)
|
||||
arcvh
|
||||
ShoulderMidKnotRhs xTurn (top - O) fineMid swEnd (+1) (-1)
|
||||
archv
|
||||
flat (right - OX) (top - hook1Depth + hook1StraightDepth) [heading Downward]
|
||||
curl (right - OX) (top - hook1Depth) [heading Downward]
|
||||
|
||||
define lowerHalf : include : dispiro
|
||||
flat (xCenterRight - [HSwToV : 0.5 * fineMid]) ([mix bottom top 0.5] - O) [widths.center fineMid]
|
||||
curl (xCenterRight - [HSwToV : 0.5 * fineMid]) (bottom + [Math.min adb (swMid + rIn)])
|
||||
arcvh 16
|
||||
DiagonalTailF 1 [DivFrame 1] (xCenterRight - [HSwToV : 0.5 * Stroke] + TanSlope * rIn) bottom rIn 50 flatHookDepth Stroke
|
||||
|
||||
if setMark : begin
|
||||
define lowerHalfLastKnot lowerHalf.rhsKnots.(lowerHalf.rhsKnots.length - 1)
|
||||
set-base-anchor 'cyrlDescenderAttach' lowerHalfLastKnot.x lowerHalfLastKnot.y
|
||||
|
||||
define Shape : namespace
|
||||
define [XBase fStraight fSlab top bottom turn tension] : composite-proc
|
||||
XStrand fStraight fSlab SB bottom RightSB top turn 0.4 tension
|
||||
|
@ -59,56 +95,10 @@ glyph-block Letter-Latin-X : begin
|
|||
export : define [CurlyBase fSlab top bottom turn tension]
|
||||
XBase false fSlab top bottom turn tension
|
||||
|
||||
define [XCursiveHalfShape top bottom] : glyph-proc
|
||||
local ada : ArchDepthAOf (ArchDepth * 0.8) (Width / 2)
|
||||
local adb : ArchDepthBOf (ArchDepth * 0.8) (Width / 2)
|
||||
|
||||
define kThin 0.550
|
||||
define swEnd : AdviceStroke 2.75
|
||||
define swMid : AdviceStroke 3
|
||||
define xCenterRight : Middle + [HSwToV swMid] / 2
|
||||
define xCenterLeft : Middle - [HSwToV swMid] / 2
|
||||
define xTurn : mix (RightSB - [HSwToV swEnd]) xCenterRight 0.5
|
||||
define hook1Depth : Hook + Stroke * 0.125
|
||||
define hook1StraightDepth : Math.min
|
||||
hook1Depth - swEnd * 1.125
|
||||
Math.max 1 : hook1Depth / 5 - swEnd / 4
|
||||
|
||||
define fineMid : swMid * kThin
|
||||
define rIn : Math.max (0.2 * (RightSB - SB) - [HSwToV : 0.7 * Stroke]) [AdviceStroke 16]
|
||||
define flatHookDepth : 0.7 * (RightSB - SB) - swEnd - 1.5 * rIn
|
||||
|
||||
define upperHalf : include : dispiro
|
||||
flat (xCenterRight - [HSwToV fineMid]) ([mix bottom top 0.5] + O) [widths.rhs.heading fineMid Upward]
|
||||
curl (xCenterRight - [HSwToV fineMid]) (top - ada)
|
||||
arcvh
|
||||
ShoulderMidKnotRhs xTurn (top - O) fineMid swEnd (+1) (-1)
|
||||
archv
|
||||
flat (RightSB - OX) (top - hook1Depth + hook1StraightDepth) [heading Downward]
|
||||
curl (RightSB - OX) (top - hook1Depth) [heading Downward]
|
||||
|
||||
# define upperHalf : include : dispiro
|
||||
# curl (RightSB - OX) (top - hook1Depth) [widths.lhs.heading swEnd Upward]
|
||||
# flat (RightSB - OX) (top - hook1Depth + hook1StraightDepth) [heading Upward]
|
||||
# arcvh 16
|
||||
# ShoulderMidKnotLhsRev (xTurn) (top - O) fineMid swEnd (-1) (-1)
|
||||
# archv 16
|
||||
# flat (xCenterRight - [HSwToV fineMid]) (top - ada) [widths.lhs fineMid]
|
||||
# curl (xCenterRight - [HSwToV fineMid]) ([mix bottom top 0.5] + O)
|
||||
|
||||
define lowerHalf : include : dispiro
|
||||
flat (xCenterRight - [HSwToV : 0.5 * fineMid]) ([mix bottom top 0.5] - O) [widths.center fineMid]
|
||||
curl (xCenterRight - [HSwToV : 0.5 * fineMid]) (bottom + [Math.min adb (swMid + rIn)])
|
||||
arcvh 16
|
||||
DiagonalTailF 1 [DivFrame 1] (xCenterRight - [HSwToV : 0.5 * Stroke] + TanSlope * rIn) bottom rIn 50 flatHookDepth Stroke
|
||||
|
||||
define lowerHalfLastKnot lowerHalf.rhsKnots.(lowerHalf.rhsKnots.length - 1)
|
||||
set-base-anchor 'cyrlDescenderAttach' lowerHalfLastKnot.x lowerHalfLastKnot.y
|
||||
|
||||
export : define [CursiveBase fSerifs top bottom turn tension] : glyph-proc
|
||||
include : XCursiveHalfShape top bottom
|
||||
include : XCursiveHalfShape top bottom Middle RightSB
|
||||
include : FlipAround Middle [mix bottom top 0.5]
|
||||
include : XCursiveHalfShape top bottom
|
||||
include : XCursiveHalfShape top bottom Middle RightSB (setMark -- true)
|
||||
|
||||
# Serifs
|
||||
export : define [FullSerifs top bot] : let [sf : SerifFrame.fromDf [DivFrame 1] top bot]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue