Add name suffix for marks (kovidgoyal/kitty#3716)

This commit is contained in:
be5invis 2021-06-12 22:44:28 -07:00
parent 6af9c2e29e
commit 554375808c
6 changed files with 46 additions and 23 deletions

View file

@ -2,7 +2,7 @@
$$include '../../meta/macros.ptl' $$include '../../meta/macros.ptl'
import [mix linreg clamp fallback] from '../../support/utils' import [mix linreg clamp fallback] from '../../support/utils'
import [getGrMesh AnyCv CvDecompose] from "../../support/gr" import [getGrMesh AnyCv CvDecompose Joining] from "../../support/gr"
extern Map extern Map
extern Set extern Set
@ -128,6 +128,7 @@ glyph-block AutoBuild-Enclosure : begin
enclosureInnerPartActualWidth.set gniPart (subGlyph.advanceWidth * dscale * xCompress) enclosureInnerPartActualWidth.set gniPart (subGlyph.advanceWidth * dscale * xCompress)
create-glyph gniPart : glyph-proc create-glyph gniPart : glyph-proc
set-width 0 set-width 0
Joining.set currentGlyph Joining.Classes.Left
include subGlyph include subGlyph
include : subGlyph.gizmo.inverse include : subGlyph.gizmo.inverse
include : Scale (dscale * xCompress) (dscale * yCompress) include : Scale (dscale * xCompress) (dscale * yCompress)
@ -535,6 +536,7 @@ glyph-block AutoBuild-Enclosure : begin
if [query-glyph gniPart] : return gniPart if [query-glyph gniPart] : return gniPart
create-glyph gniPart : glyph-proc create-glyph gniPart : glyph-proc
set-width 0 set-width 0
Joining.set currentGlyph Joining.Classes.Left
include : miniatureFont.queryByNameEnsured gidPart include : miniatureFont.queryByNameEnsured gidPart
include : Upright include : Upright
include : Translate offset 0 include : Translate offset 0
@ -820,6 +822,7 @@ glyph-block Autobuild-Fractions : begin
define mfNumGlyph : miniatureFont.queryByNameEnsured numid define mfNumGlyph : miniatureFont.queryByNameEnsured numid
set-width 0 set-width 0
Joining.set currentGlyph Joining.Classes.Left
include mfNumGlyph include mfNumGlyph
include : Upright include : Upright
include : Translate (- mfNumGlyph.advanceWidth / 2) 0 include : Translate (- mfNumGlyph.advanceWidth / 2) 0
@ -835,6 +838,7 @@ glyph-block Autobuild-Fractions : begin
define mfDenGlyph : miniatureFont.queryByNameEnsured denid define mfDenGlyph : miniatureFont.queryByNameEnsured denid
set-width 0 set-width 0
Joining.set currentGlyph Joining.Classes.Left
include mfDenGlyph include mfDenGlyph
include : Upright include : Upright
include : Translate offset 0 include : Translate offset 0
@ -929,6 +933,7 @@ glyph-block AutoBuild-Accented-Equal : begin
if [query-glyph gni] : return gni if [query-glyph gni] : return gni
create-glyph gni : glyph-proc create-glyph gni : glyph-proc
set-width 0 set-width 0
Joining.set currentGlyph Joining.Classes.Left
include : dFont.queryByNameEnsured gidPart include : dFont.queryByNameEnsured gidPart
include : Upright include : Upright
include : Translate (-totalWidth / 2 + offset) 0 include : Translate (-totalWidth / 2 + offset) 0
@ -1215,13 +1220,14 @@ glyph-block Autobuild-Grouped-Digits : begin
define [createGroupedDigits shrink crowd numberGlyphIDs] : begin define [createGroupedDigits shrink crowd numberGlyphIDs] : begin
create-glyph '.nd-shade' : glyph-proc create-glyph '.nd-shade' : glyph-proc
set-width 0
Joining.set currentGlyph Joining.Classes.Left
include : intersection include : intersection
HBarBottom 0 Width (Descender * 0.75) [AdviceStroke 4] HBarBottom 0 Width (Descender * 0.75) [AdviceStroke 4]
glyph-proc glyph-proc
include : refer-glyph "denseShade.WWID" include : refer-glyph "denseShade.WWID"
include : Translate (-Width / 2) 0 include : Translate (-Width / 2) 0
include : Translate (-Width) 0 include : Translate (-Width) 0
set-width 0
foreach [gid : items-of numberGlyphIDs] : foreach [nd : items-of {0 1 2 3 4 5 6}] foreach [gid : items-of numberGlyphIDs] : foreach [nd : items-of {0 1 2 3 4 5 6}]
create-glyph (gid + ".nd" + nd) : glyph-proc create-glyph (gid + ".nd" + nd) : glyph-proc

View file

@ -180,6 +180,7 @@ glyph-block Letter-Latin-C : begin
create-glyph "revC.\(suffix)" : glyph-proc create-glyph "revC.\(suffix)" : glyph-proc
include : MarkSet.capital include : MarkSet.capital
set-base-anchor 'cvDecompose' 0 0
include : revCShape [DivFrame 1] CAP 0 SmoothA SmoothB Stroke include : revCShape [DivFrame 1] CAP 0 SmoothA SmoothB Stroke
include : AutoStartSerifL [DivFrame 1] sty CAP include : AutoStartSerifL [DivFrame 1] sty CAP
include : AutoStartSerifLB [DivFrame 1] styBot 0 include : AutoStartSerifLB [DivFrame 1] styBot 0
@ -298,30 +299,32 @@ glyph-block Letter-Latin-C : begin
create-glyph 'currency/centSignBar.open' : glyph-proc create-glyph 'currency/centSignBar.open' : glyph-proc
set-width 0 set-width 0
set-mark-anchor 'cvDecompose' 0 0
include : dispiro include : dispiro
widths.center widths.center
flat (Middle - Width) (XH - HalfStroke) flat Middle (XH - HalfStroke)
curl (Middle - Width) (XH - Descender / 2) [heading Upward] curl Middle (XH - Descender / 2) [heading Upward]
include : dispiro include : dispiro
widths.center widths.center
flat (Middle - Width) (Descender / 2) [heading Upward] flat Middle (Descender / 2) [heading Upward]
curl (Middle - Width) HalfStroke curl Middle HalfStroke
create-glyph 'currency/centSignBar.through' : glyph-proc create-glyph 'currency/centSignBar.through' : glyph-proc
define fine : AdviceStroke 4 define fine : AdviceStroke 4
include [refer-glyph 'currency/centSignBar.open'] AS_BASE ALSO_METRICS include [refer-glyph 'currency/centSignBar.open'] AS_BASE ALSO_METRICS
include : VBar (Middle - Width) (XH - HalfStroke) (0 + HalfStroke) fine include : VBar Middle (XH - HalfStroke) (0 + HalfStroke) fine
create-glyph 'currency/centSignBar.barInterrupted' : glyph-proc create-glyph 'currency/centSignBar.barInterrupted' : glyph-proc
set-width 0 set-width 0
set-mark-anchor 'cvDecompose' 0 0
define fine : AdviceStroke 4 define fine : AdviceStroke 4
define gap : Math.max (XH / 8) [AdviceStroke2 6 6 XH] define gap : Math.max (XH / 8) [AdviceStroke2 6 6 XH]
include : dispiro include : dispiro
flat (Middle - Width) (XH - Descender / 2) [widths.center.heading Stroke Downward] flat Middle (XH - Descender / 2) [widths.center.heading Stroke Downward]
curl (Middle - Width) (XH / 2 + gap / 2) [widths.center.heading fine Downward] curl Middle (XH / 2 + gap / 2) [widths.center.heading fine Downward]
include : dispiro include : dispiro
flat (Middle - Width) (Descender / 2) [widths.center.heading Stroke Upward] flat Middle (Descender / 2) [widths.center.heading Stroke Upward]
curl (Middle - Width) (XH / 2 - gap / 2) [widths.center.heading fine Upward] curl Middle (XH / 2 - gap / 2) [widths.center.heading fine Upward]
select-variant 'currency/centSignBar' (follow -- 'cent') select-variant 'currency/centSignBar' (follow -- 'cent')

View file

@ -235,6 +235,7 @@ glyph-block Letter-Latin-S : begin
define top : CAP * 0.95 define top : CAP * 0.95
define bot : CAP * 0.05 define bot : CAP * 0.05
include : MarkSet.capital include : MarkSet.capital
set-base-anchor 'cvDecompose' 0 0
include : SStrokeImpl top bot doTS doBS [AdviceStroke2 3 3 (top - bot)] Ess include : SStrokeImpl top bot doTS doBS [AdviceStroke2 3 3 (top - bot)] Ess
include : SAutoSlabStart doTS top Stroke Hook include : SAutoSlabStart doTS top Stroke Hook
include : SAutoSlabEnd doBS bot Stroke Hook include : SAutoSlabEnd doBS bot Stroke Hook
@ -244,6 +245,7 @@ glyph-block Letter-Latin-S : begin
define top : CAP * 0.88 define top : CAP * 0.88
define bot : CAP * 0.12 define bot : CAP * 0.12
include : MarkSet.capital include : MarkSet.capital
set-base-anchor 'cvDecompose' 0 0
include : SStrokeImpl top bot doTS doBS [AdviceStroke2 3 3 (top - bot)] Ess include : SStrokeImpl top bot doTS doBS [AdviceStroke2 3 3 (top - bot)] Ess
include : SAutoSlabStart doTS top Stroke Hook include : SAutoSlabStart doTS top Stroke Hook
include : SAutoSlabEnd doBS bot Stroke Hook include : SAutoSlabEnd doBS bot Stroke Hook
@ -434,22 +436,22 @@ glyph-block Letter-Latin-S : begin
foreach { suffix { kTop kBot overflow fillType fShort } } [Object.entries DollarConfig] : do foreach { suffix { kTop kBot overflow fillType fShort } } [Object.entries DollarConfig] : do
create-glyph "dollar/bar.\(suffix)" : glyph-proc create-glyph "dollar/bar.\(suffix)" : glyph-proc
set-width 0 set-width 0
set-mark-anchor 'cvDecompose' 0 0
define top : CAP * kTop define top : CAP * kTop
define bot : CAP * kBot define bot : CAP * kBot
define w : AdviceStroke 3 define w : AdviceStroke 3
define fine : AdviceStroke 4 define fine : AdviceStroke 4
define barMid : Middle - Width
if (fillType === 1) : include : VBar barMid (bot + HalfStroke) (top - HalfStroke) fine if (fillType === 1) : include : VBar Middle (bot + HalfStroke) (top - HalfStroke) fine
if (fillType === 0 || fillType === 1) : begin if (fillType === 0 || fillType === 1) : begin
include : dispiro include : dispiro
widths.center w widths.center w
flat barMid (top - HalfStroke) flat Middle (top - HalfStroke)
curl barMid (CAP - overflow) [heading Upward] curl Middle (CAP - overflow) [heading Upward]
include : dispiro include : dispiro
widths.center w widths.center w
flat barMid overflow [heading Upward] flat Middle overflow [heading Upward]
curl barMid (bot + HalfStroke) curl Middle (bot + HalfStroke)
if (fillType === 2) : begin if (fillType === 2) : begin
local gap : (w / Stroke * Ess) + [Math.max ((top - bot) / 6) [AdviceStroke2 3 3 (top - bot)]] local gap : (w / Stroke * Ess) + [Math.max ((top - bot) / 6) [AdviceStroke2 3 3 (top - bot)]]
local yMid : mix bot top 0.5 local yMid : mix bot top 0.5
@ -458,13 +460,13 @@ glyph-block Letter-Latin-S : begin
include : difference include : difference
union union
dispiro dispiro
flat barMid (CAP - overflow) [widths.center.heading w Downward] flat Middle (CAP - overflow) [widths.center.heading w Downward]
curl barMid [mix bot top 0.5] [widths.center.heading fine Downward] curl Middle [mix bot top 0.5] [widths.center.heading fine Downward]
dispiro dispiro
flat barMid overflow [widths.center.heading w Upward] flat Middle overflow [widths.center.heading w Upward]
curl barMid [mix bot top 0.5] [widths.center.heading fine Upward] curl Middle [mix bot top 0.5] [widths.center.heading fine Upward]
dispiro [corner (-Width) yTermLeft : widths.center gap] [corner 0 yTermRight] dispiro [corner 0 yTermLeft : widths.center gap] [corner Width yTermRight]
if fShort : DollarShorterBar.set currentGlyph 'trigger' if fShort : DollarShorterBar.set currentGlyph 'trigger'

View file

@ -1,6 +1,7 @@
$$include '../../meta/macros.ptl' $$include '../../meta/macros.ptl'
import [mix linreg clamp fallback] from '../../support/utils' import [mix linreg clamp fallback] from '../../support/utils'
import [Joining] from '../../support/gr'
glyph-module glyph-module
@ -38,9 +39,12 @@ glyph-block Symbol-Mosaic-NotDef : begin
set-width 0 set-width 0
alias 'nonmarkingreturn' 0x000D 'zwsp' alias 'nonmarkingreturn' 0x000D 'zwsp'
alias 'cgj' 0x34F 'zwsp'
alias 'nbsp' 0xA0 'space' alias 'nbsp' 0xA0 'space'
create-glyph 'cgj' 0x34F : glyph-proc
set-width 0
Joining.set currentGlyph Joining.Classes.Mid
alias 'enquad' 0x2000 'sp1' alias 'enquad' 0x2000 'sp1'
alias 'ensp' 0x2002 'sp1' alias 'ensp' 0x2002 'sp1'
alias 'brailleBlank' 0x2800 'sp1' alias 'brailleBlank' 0x2800 'sp1'

View file

@ -81,6 +81,10 @@ export : define [buildOtl para glyphStore] : begin
local GDEF : buildGDEF para glyphStore markGlyphs local GDEF : buildGDEF para glyphStore markGlyphs
local GSUB : buildGSUB para glyphStore markGlyphs local GSUB : buildGSUB para glyphStore markGlyphs
# Make all diacritics join-l (Kitty #3716)
foreach gnMark [items-of markGlyphs.all] : begin
Gr.Joining.or [glyphStore.queryByName gnMark] Gr.Joining.Classes.Left
# Build compatibility ligatures # Build compatibility ligatures
if (para.enableLigation && para.compLig) : begin if (para.enableLigation && para.compLig) : begin
BuildCompatLigatures para glyphStore GSUB GDEF para.compLig BuildCompatLigatures para glyphStore GSUB GDEF para.compLig

View file

@ -91,6 +91,7 @@ const TieGlyph = {
set(glyph) { set(glyph) {
if (!glyph.related) glyph.related = {}; if (!glyph.related) glyph.related = {};
glyph.related.TieGlyph = true; glyph.related.TieGlyph = true;
Joining.or(glyph, Joining.Classes.Mid);
} }
}; };
@ -125,6 +126,9 @@ const Joining = {
if (!glyph.related) glyph.related = {}; if (!glyph.related) glyph.related = {};
glyph.related.joining = cls; glyph.related.joining = cls;
}, },
or(glyph, cls) {
Joining.set(glyph, cls | Joining.get(cls));
},
amendOtName(baseName, cl) { amendOtName(baseName, cl) {
switch (cl) { switch (cl) {
case Joining.Classes.Left: case Joining.Classes.Left: