Skip to content

Commit

Permalink
* Fix cv99/VXDD applications on U+0149, U+0310, U+034B, `U…
Browse files Browse the repository at this point in the history
…+0352`, `U+037C`, `U+037D`, `U+03FE`, `U+03FF`, `U+1E0B`, and `U+1EF5` (be5invis#1317).
  • Loading branch information
be5invis authored and xinhaoyuan committed May 22, 2022
1 parent ec5aa5b commit f0926b0
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 77 deletions.
1 change: 1 addition & 0 deletions changes/15.0.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Fix `cv99`/`VXDD` applications on `U+0149`, `U+0310`, `U+034B`, `U+0352`, `U+037C`, `U+037D`, `U+03FE`, `U+03FF`, `U+1E0B`, and `U+1EF5` (#1317).
42 changes: 20 additions & 22 deletions font-src/glyphs/common/derivatives.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,6 @@ glyph-block Common-Derivatives : begin
create-glyph gnDst unicodeDst : Fn gns gr
return gnDst

glyph-block-export derive-composites
define [derive-composites dstGid dstUnicode srcGid] : begin
if [not : glyph-is-needed srcGid] : return nothing

local restComponents : {}.slice.call arguments 3
return : derive-glyphs dstGid dstUnicode srcGid : lambda [src gr] : glyph-proc
include [refer-glyph src] AS_BASE ALSO_METRICS
foreach component [items-of restComponents] : begin
if ([typeof component] === 'string')
: then : include [refer-glyph component]
: else : include component

glyph-block-export alias
define [alias dstGid dstUnicode srcGid] : begin
if [not dstGid] : throw : new Error "Target ID not specified"
Expand Down Expand Up @@ -201,16 +189,26 @@ glyph-block Common-Derivatives : begin
if [not newid] : throw : new Error "Target ID not specified"
return : VCombine newid unicode id id spacing

# Two-part glyphs
glyph-block-export create-two-part-glyph
define [create-two-part-glyph newid unicode id1 id2] : begin
derive-multi-part-glyphs newid unicode { id1 id2 } : function [src] : glyph-proc
local { a b } src
local awA [query-glyph a].advanceWidth
local awB [query-glyph b].advanceWidth
set-width (awA + awB)
include [refer-glyph a] AS_BASE
include [refer-glyph b]
glyph-block-export derive-composites
define [derive-composites dstGid dstUnicode srcGid] : begin
if [not : glyph-is-needed dstGid] : return nothing
local components : {}.slice.call arguments 2
local refs {}
foreach part [items-of components] : if ([typeof part] === 'string')
then : refs.push part

return : derive-multi-part-glyphs dstGid dstUnicode refs : function [srcs] : glyph-proc
local rid 0
foreach j [range 0 components.length] : begin
local asBase : if (j === 0) AS_BASE nothing
local alsoMetrics : if (j === 0) ALSO_METRICS nothing
local part components.(j)

if ([typeof part] === 'string')
: then : begin
include [refer-glyph srcs.(rid)] asBase alsoMetrics
set rid : rid + 1
: else : include part asBase alsoMetrics

glyph-block Recursive-Build : begin
define [Fork gs ps] : begin
Expand Down
2 changes: 1 addition & 1 deletion font-src/glyphs/letter/latin-ext/lower-ae-oe.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ glyph-block Letter-Latin-Lower-AE-OE : begin
select-variant "ue/e"
select-variant "ue/u"

create-two-part-glyph 'ue' 0x1D6B 'ue/u' 'ue/e'
derive-composites 'ue' 0x1D6B 'ue/u' 'ue/e'

create-glyph 'db' 0x238 : glyph-proc
local df : DivFrame para.diversityM 3
Expand Down
35 changes: 22 additions & 13 deletions font-src/glyphs/letter/latin/c.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -350,26 +350,35 @@ glyph-block Letter-Latin-C : begin
alias 'grek/revLunateSigma' 0x3FD 'revC'
alias 'grek/revLunateSmallSigma' 0x37B 'revSmallC.serifless'

define [LunateSigmaShape k] : begin
local halfDotWidth : Math.min DotRadius ((RightSB - SB - HVContrast * Stroke * 2) / 4)
local halfDotHeight : Math.min DotRadius (halfDotWidth * k)
return : OShapeOutline.NoOvershoot
define [LunateSigmaShape k fRound kdr] : begin
local halfDotWidth : kdr * [Math.min DotRadius ((RightSB - SB - HVContrast * Stroke * 2) / 4)]
local halfDotHeight : kdr * [Math.min DotRadius (halfDotWidth * k)]
if fRound
: then : return :OShapeOutline.NoOvershoot
CAP / 2 + halfDotHeight
CAP / 2 - halfDotHeight
0 + halfDotWidth
0 - halfDotWidth
Stroke * halfDotWidth * 2 / Width
ArchDepthAOf halfDotWidth (halfDotWidth * 2)
ArchDepthBOf halfDotWidth (halfDotWidth * 2)

create-glyph 'grek/lunateSigmaDot' : glyph-proc
set-width 0
set-mark-anchor 'slash' 0 (CAP / 2) 0 (CAP / 2)
include : LunateSigmaShape 2
create-glyph 'grek/lunateSigmaDotSmall' : glyph-proc
set-width 0
set-mark-anchor 'slash' 0 (CAP / 2) 0 (CAP / 2)
include : LunateSigmaShape 1.5
: else : return : Rect
CAP / 2 + halfDotHeight
CAP / 2 - halfDotHeight
0 + halfDotWidth
0 - halfDotWidth
foreach { suffix { DrawAt kdr } } [Object.entries DotVariants] : do
create-glyph "grek/lunateSigmaDot.\(suffix)" : glyph-proc
set-width 0
set-mark-anchor 'slash' 0 (CAP / 2) 0 (CAP / 2)
include : LunateSigmaShape 2 (DrawAt === DotAt) kdr
create-glyph "grek/lunateSigmaDotSmall.\(suffix)" : glyph-proc
set-width 0
set-mark-anchor 'slash' 0 (CAP / 2) 0 (CAP / 2)
include : LunateSigmaShape 1.5 (DrawAt === DotAt) kdr

select-variant "grek/lunateSigmaDot" (follow -- 'diacriticDot')
select-variant "grek/lunateSigmaDotSmall" (follow -- 'diacriticDot')

derive-composites 'grek/dotLunateSigma' 0x3FE 'grek/lunateSigma' 'grek/lunateSigmaDot'
derive-composites 'grek/dotRevLunateSigma' 0x3FF 'grek/revLunateSigma' 'grek/lunateSigmaDot'
Expand Down
7 changes: 4 additions & 3 deletions font-src/glyphs/letter/latin/lower-d.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ glyph-block Letter-Latin-Lower-D : begin
derive-composites 'dHookBottom' 0x256 'd/hookBottomBase' 'rtailBR'
derive-composites 'dHookTopBottom' 0x1D91 'dHookTop/hookBottomBase' 'rtailBR'

derive-glyphs 'ddot' 0x1E0B 'd' : lambda [src gr] : glyph-proc
include : refer-glyph "dotAbove"
derive-multi-part-glyphs 'ddot' 0x1E0B {'d' 'dotAbove'} : lambda [srcs gr] : glyph-proc
local { base mark } srcs
include : refer-glyph mark
include : Translate (Width - HalfStroke) 0
include [refer-glyph src] AS_BASE
include [refer-glyph base] AS_BASE

glyph-block-import Letter-Blackboard : BBS BBD BBBarRight
create-glyph 'mathbb/d' 0x1D555 : glyph-proc
Expand Down
6 changes: 2 additions & 4 deletions font-src/glyphs/letter/latin/lower-n.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,11 @@ glyph-block Letter-Latin-Lower-N : begin
derive-composites 'cyrl/peDescender.italic' null 'cyrl/peItalicDescBase' [CyrDescender RightSB]

do "n with Apostrophe"
derive-glyphs 'nApostrophe/comma' null 'commaAbove' : function [src gr] : glyph-proc
set-width 0
Joining.set currentGlyph Joining.Classes.Right
derive-glyphs 'nApostrophe/comma' null 'commaAbove/asPunctuation' : function [src gr] : glyph-proc
include : WithTransform [Translate (Width + SB - Middle) 0]
refer-glyph src

create-two-part-glyph 'nApostrophe' 0x149 'nApostrophe/comma' 'n'
derive-composites 'nApostrophe' 0x149 'n' 'nApostrophe/comma'

derive-glyphs 'nltail' 0x272 'n' : lambda [src srl] : glyph-proc
include [refer-glyph src] AS_BASE
Expand Down
9 changes: 5 additions & 4 deletions font-src/glyphs/letter/latin/lower-y.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,11 @@ glyph-block Letter-Latin-Lower-Y : begin
link-reduced-variant 'y/sansSerif' 'y' MathSansSerif
alias 'cyrl/u' 0x443 'y'

WithDotVariants 'yDotBelowDot1' null : function [DrawAt kdr] : glyph-proc
set-mark-anchor 'yBelowDot' 0 0 0 belowMarkStack
include : DrawAt 0 (-AccentStackOffset) (DotRadius * kdr)

foreach { suffix { DrawAt kdr } } [Object.entries DotVariants] : do
create-glyph "yDotBelowDot1.\(suffix)" : glyph-proc
set-mark-anchor 'yBelowDot' 0 0 0 belowMarkStack
include : DrawAt 0 (-AccentStackOffset) (DotRadius * kdr)
select-variant 'yDotBelowDot1' (follow -- 'diacriticDot')
CreateAccentedComposition 'yDotBelow' 0x1EF5 'y' 'yDotBelowDot1'

create-glyph : glyph-proc
Expand Down
50 changes: 28 additions & 22 deletions font-src/glyphs/marks/above.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,14 @@ glyph-block Mark-Above : begin
flat (markMiddle + markExtend * 0.2) [mix tbot ttop 1.5]
curl (markMiddle - markExtend * 0.2) [mix ttop tbot 1.5]

create-forked-glyph 'tildedotdotAbove' 0x34B : glyph-proc
set-mark-anchor 'above' markMiddle (XH - AccentHeight / 4) markMiddle (aboveMarkStack + AccentHeight / 4)
local r : 0.75 * DotRadius * fine / HalfStroke
include : DotAt markMiddle [mix tbot ttop 1.5] r
include : DotAt markMiddle [mix ttop tbot 1.5] r
foreach { suffix { DrawAt kdr } } [Object.entries DotVariants] : do
create-forked-glyph "tildedotdotAbove.\(suffix)" : glyph-proc
set-mark-anchor 'above' markMiddle (XH - AccentHeight / 4) markMiddle (aboveMarkStack + AccentHeight / 4)
local r : 0.75 * DotRadius * fine / HalfStroke
include : DrawAt markMiddle [mix tbot ttop 1.5] (r * kdr)
include : DrawAt markMiddle [mix ttop tbot 1.5] (r * kdr)

select-variant 'tildedotdotAbove' 0x34B (follow -- 'diacriticDot')

create-glyph 'dblTildeAbove' 0x34C : glyph-proc
set-width 0
Expand Down Expand Up @@ -507,6 +510,7 @@ glyph-block Mark-Above : begin
include : ApparentTranslate 0 (DotRadius * 0.3)

select-variant 'commaAbove' 0x313 (follow -- 'diacriticDot')
select-variant 'commaAbove/asPunctuation' (shapeFrom -- 'commaAbove') (follow -- 'punctuationDot')

derive-glyphs 'commaGrekUpperTonos' null 'commaAbove' : function [src gr] : glyph-proc
set-width 0
Expand Down Expand Up @@ -599,24 +603,26 @@ glyph-block Mark-Above : begin
alsoThruThem {{0.9 0.36} {0.1 0.64}} [heading Upward]
g2 (markMiddle + markFine * 0.5) aboveMarkTop [heading Upward]

create-glyph 'candrabinduAbove' 0x310 : glyph-proc
set-width 0
local fine : AdviceStroke 6.5
local arcSw : Math.min (markHalfStroke * 2) (fine * 1.25)
local radius : Math.max (markExtend - DotRadius) (fine * 1.35)
local yDot : mix aboveMarkBot aboveMarkTop 0.625
include : dispiro
widths.rhs arcSw
g4.down.start (markMiddle - radius) yDot [heading Downward]
arcvh
g4.right.mid markMiddle (yDot - radius)
archv
g4.up.end (markMiddle + radius) yDot [heading Upward]
include : DotAt markMiddle yDot fine
include : ApparentTranslate 0 (fine * 0.5)
set-mark-anchor 'above' markMiddle XH markMiddle aboveMarkStack
set-base-anchor 'aboveBrace' markMiddle aboveMarkMid
foreach { suffix { DrawAt kdr } } [Object.entries DotVariants] : do
create-glyph "candrabinduAbove.\(suffix)" : glyph-proc
set-width 0
local fine : AdviceStroke 6.5
local arcSw : Math.min (markHalfStroke * 2) (fine * 1.25)
local radius : Math.max (markExtend - DotRadius) (fine * 1.35)
local yDot : mix aboveMarkBot aboveMarkTop 0.625
include : dispiro
widths.rhs arcSw
g4.down.start (markMiddle - radius) yDot [heading Downward]
arcvh
g4.right.mid markMiddle (yDot - radius)
archv
g4.up.end (markMiddle + radius) yDot [heading Upward]
include : DrawAt markMiddle yDot (fine * kdr)
include : ApparentTranslate 0 (fine * 0.5)
set-mark-anchor 'above' markMiddle XH markMiddle aboveMarkStack
set-base-anchor 'aboveBrace' markMiddle aboveMarkMid

select-variant 'candrabinduAbove' 0x310 (follow -- 'diacriticDot')
turned 'turncandrabinduAbove' 0x352 'candrabinduAbove' markMiddle aboveMarkMid

create-glyph 'variaAbove' 0x340 : glyph-proc
Expand Down
4 changes: 2 additions & 2 deletions font-src/glyphs/symbol/letter.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,5 @@ glyph-block Symbol-Letter-Punctuation-Composite : begin
include : DrawAt 0 0 (DotRadius * kdr - overshoot)
set-mark-anchor 'cvDecompose' 0 0

create-two-part-glyph 'LDot' 0x13F 'L' 'LDotDot'
create-two-part-glyph 'lDot' 0x140 'lDotBase' 'LDotDot'
derive-composites 'LDot' 0x13F 'L' 'LDotDot'
derive-composites 'lDot' 0x140 'lDotBase' 'LDotDot'
10 changes: 5 additions & 5 deletions font-src/glyphs/symbol/punctuation/emotion.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,16 @@ glyph-block Symbol-Punctuation-Emotion : begin
set-base-anchor 'cvDecompose' 0 0

select-variant 'question/hookPart' (follow -- 'question')
create-two-part-glyph 'question' '?' 'question/hookPart' 'question/dotPart'
derive-composites 'question' '?' 'question/hookPart' 'question/dotPart'

select-variant 'questionDown/hookPart' (follow -- 'question')
create-two-part-glyph 'questionDown' 0xBF 'questionDown/hookPart' 'questionDown/dotPart'
derive-composites 'questionDown' 0xBF 'questionDown/hookPart' 'questionDown/dotPart'

select-variant 'revQuestion/hookPart' (follow -- 'question')
create-two-part-glyph 'revQuestion' 0x2E2E 'revQuestion/hookPart' 'question/dotPart'
derive-composites 'revQuestion' 0x2E2E 'revQuestion/hookPart' 'question/dotPart'

select-variant 'interrobang/bodyPart' (follow -- 'question')
create-two-part-glyph 'interrobang' 0x203D 'interrobang/bodyPart' 'question/dotPart'
derive-composites 'interrobang' 0x203D 'interrobang/bodyPart' 'question/dotPart'

select-variant 'interrobangDown/bodyPart' (follow -- 'question')
create-two-part-glyph 'gnaborretni' 0x2E18 'interrobangDown/bodyPart' 'questionDown/dotPart'
derive-composites 'gnaborretni' 0x2E18 'interrobangDown/bodyPart' 'questionDown/dotPart'
2 changes: 1 addition & 1 deletion font-src/meta/macros.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ define-macro glyph-block-import : syntax-rules
Common-Derivatives `[select-variant orthographic-italic orthographic-slanted
refer-glyph query-glyph alias turned HDual HCombine VDual VCombine derive-glyphs
derive-composites link-reduced-variant alias-reduced-variant glyph-is-needed
HalfAdvance TurnMarks create-two-part-glyph derive-multi-part-glyphs DeriveMeshT]
HalfAdvance TurnMarks derive-multi-part-glyphs DeriveMeshT]

CommonShapes `[Rect SquareAt Ring RingAt DotAt RingStroke RingStrokeAt DotStrokeAt
CircleRing CircleRingAt CircleDotAt OShapeT OShape OShapeOutline OShapeFlatTB
Expand Down

0 comments on commit f0926b0

Please sign in to comment.