* Split variant assignment for Z and z (#789).

* Add motion serif variants for `Z` and `z` (#789).
This commit is contained in:
be5invis 2021-01-03 12:37:26 -08:00
parent d804312f15
commit 71acaa5203
7 changed files with 123 additions and 59 deletions

View file

@ -1,2 +1,3 @@
* Add motion serif variants for `a`, `b`, `d`, `g`, `k`, and `q` (#789). * Add motion serif variants for `a`, `b`, `d`, `g`, `k`, `q`, `Z` and `z` (#789).
* Add vertical-crossing variant for `Q` (#789). * Add vertical-crossing variant for `Q` (#789).
* Split variant assignment for `Z` and `z` (#789).

View file

@ -114,7 +114,7 @@ glyph-block AutoBuild-Accents : begin
define construction : glyph-proc define construction : glyph-proc
include s_parts.0 AS_BASE ALSO_METRICS include s_parts.0 AS_BASE ALSO_METRICS
local nonTrivial false local nonTrivial : AnyDerivingCv.hasNonDerivingVariants s_parts.0
foreach part [items-of : s_parts.slice 1] : if part : begin foreach part [items-of : s_parts.slice 1] : if part : begin
include part include part
if (part.markAnchors && part.markAnchors.bottomright) : begin if (part.markAnchors && part.markAnchors.bottomright) : begin

View file

@ -3,7 +3,7 @@ $$include '../../meta/macros.ptl'
import '../../support/transform' as Transform import '../../support/transform' as Transform
import [mix linreg clamp fallback] from '../../support/utils' import [mix linreg clamp fallback] from '../../support/utils'
import [Cv AnyDerivingCv Dotless] from '../../support/gr' import [Cv AnyCv AnyDerivingCv Dotless] from '../../support/gr'
import [DesignParameters] from '../../meta/aesthetics' import [DesignParameters] from '../../meta/aesthetics'
extern Map extern Map
@ -19,7 +19,9 @@ glyph-block Common-Derivatives : begin
local dstName : [fallback name follow] + '.' + suffix local dstName : [fallback name follow] + '.' + suffix
local dst : glyphStore.queryByName dstName local dst : glyphStore.queryByName dstName
if dst : g.dependsOn dst if dst : g.dependsOn dst
if (h.tag && h.rank) : [Cv h.tag h.rank].set g dstName if (h.tag && h.rank) : begin
[Cv h.tag h.rank].set g dstName
if h.nonDeriving : [Cv h.tag h.rank].setPreventDeriving g
define [select-variant] : params [name unicode [shapeFrom name] [follow name]] : begin define [select-variant] : params [name unicode [shapeFrom name] [follow name]] : begin
if [not : glyph-is-needed shapeFrom] : return nothing if [not : glyph-is-needed shapeFrom] : return nothing
@ -66,8 +68,9 @@ glyph-block Common-Derivatives : begin
include [refer-glyph sourceGid] AS_BASE ALSO_METRICS include [refer-glyph sourceGid] AS_BASE ALSO_METRICS
if glyphDst : begin if glyphDst : begin
foreach [gr : items-of : AnyDerivingCv.query glyphSrc] : begin foreach [gr : items-of : AnyCv.query glyphSrc] : begin
gr.set glyphDst [gr.get glyphSrc] gr.set glyphDst [gr.get glyphSrc]
if [gr.setPreventDeriving glyphSrc] : gr.setPreventDeriving glyphDst
if [Dotless.get glyphSrc] : Dotless.set glyphDst [Dotless.get glyphSrc] if [Dotless.get glyphSrc] : Dotless.set glyphDst [Dotless.get glyphSrc]
define [turned newid unicode id _x _y mark] : begin define [turned newid unicode id _x _y mark] : begin

View file

@ -2,7 +2,7 @@ $$include '../../meta/macros.ptl'
import [mix linreg clamp fallback] from '../../support/utils' import [mix linreg clamp fallback] from '../../support/utils'
import [DesignParameters] from '../../meta/aesthetics' import [DesignParameters] from '../../meta/aesthetics'
import [Dotless DoNotDeriveVariants CvDecompose] from "../../support/gr" import [Dotless CvDecompose] from "../../support/gr"
glyph-module glyph-module
@ -7087,6 +7087,7 @@ glyph-block Letter-Latin-Z : begin
create-derived 'Z.withHorizontalCrossBar' : refer-glyph 'barOver' create-derived 'Z.withHorizontalCrossBar' : refer-glyph 'barOver'
create-derived 'Z.withCrossBar' : refer-glyph 'antiSlashOver' create-derived 'Z.withCrossBar' : refer-glyph 'antiSlashOver'
create-derived 'Z.motionSerifed' : UpwardRightSerif (RightSB - OX) 0 VJut
create-glyph 'z.standard' : glyph-proc create-glyph 'z.standard' : glyph-proc
include : MarkSet.e include : MarkSet.e
@ -7108,6 +7109,7 @@ glyph-block Letter-Latin-Z : begin
create-derived 'z.withHorizontalCrossBar' : refer-glyph 'barOver' create-derived 'z.withHorizontalCrossBar' : refer-glyph 'barOver'
create-derived 'z.withCrossBar' : refer-glyph 'antiSlashOver' create-derived 'z.withCrossBar' : refer-glyph 'antiSlashOver'
create-derived 'z.motionSerifed' : UpwardRightSerif (RightSB - OX) 0 VJut
create-glyph 'Z.curly' : glyph-proc create-glyph 'Z.curly' : glyph-proc
include : MarkSet.capital include : MarkSet.capital
@ -7124,6 +7126,7 @@ glyph-block Letter-Latin-Z : begin
create-derived 'Z.curlyWithHorizontalCrossBar' : refer-glyph 'barOver' create-derived 'Z.curlyWithHorizontalCrossBar' : refer-glyph 'barOver'
create-derived 'Z.curlyWithCrossBar' : refer-glyph 'antiSlashOver' create-derived 'Z.curlyWithCrossBar' : refer-glyph 'antiSlashOver'
create-derived 'Z.curlyMotionSerifed' : UpwardRightSerif (RightSB - OX) 0 VJut
create-glyph 'z.curly' : glyph-proc create-glyph 'z.curly' : glyph-proc
include : MarkSet.e include : MarkSet.e
@ -7140,6 +7143,7 @@ glyph-block Letter-Latin-Z : begin
create-derived 'z.curlyWithHorizontalCrossBar' : refer-glyph 'barOver' create-derived 'z.curlyWithHorizontalCrossBar' : refer-glyph 'barOver'
create-derived 'z.curlyWithCrossBar' : refer-glyph 'antiSlashOver' create-derived 'z.curlyWithCrossBar' : refer-glyph 'antiSlashOver'
create-derived 'z.curlyMotionSerifed' : UpwardRightSerif (RightSB - OX) 0 VJut
select-variant 'Z' 'Z' select-variant 'Z' 'Z'
select-variant 'z' 'z' select-variant 'z' 'z'
@ -7148,9 +7152,6 @@ glyph-block Letter-Latin-Z : begin
alias 'Zbar' 0x1B5 'Z.withHorizontalCrossBar' alias 'Zbar' 0x1B5 'Z.withHorizontalCrossBar'
alias 'zbar' 0x1B6 'z.withHorizontalCrossBar' alias 'zbar' 0x1B6 'z.withHorizontalCrossBar'
if [query-glyph 'Z'] : DoNotDeriveVariants.set [query-glyph 'Z']
if [query-glyph 'z'] : DoNotDeriveVariants.set [query-glyph 'z']
define [BBZShape top] : glyph-proc define [BBZShape top] : glyph-proc
include : HBarTop SB RightSB top BBS include : HBarTop SB RightSB top BBS
include : HBarBottom SB RightSB 0 BBS include : HBarBottom SB RightSB 0 BBS
@ -7179,8 +7180,8 @@ glyph-block Letter-Latin-Z : begin
create-glyph 'mathbb/Z' 0x2124 : composite-proc [MarkSet.capital] [BBZShape CAP] create-glyph 'mathbb/Z' 0x2124 : composite-proc [MarkSet.capital] [BBZShape CAP]
create-glyph 'mathbb/z' 0x1D56B : composite-proc [MarkSet.e] [BBZShape XH] create-glyph 'mathbb/z' 0x1D56B : composite-proc [MarkSet.e] [BBZShape XH]
create-glyph 'Zdtail' 0x224 : glyph-proc define [ZDownTailCtor src sel] : glyph-proc
include [refer-glyph 'Z'] AS_BASE include [refer-glyph src] AS_BASE ALSO_METRICS
eject-contour 'strokeBottom' eject-contour 'strokeBottom'
eject-contour 'serifRB' eject-contour 'serifRB'
include : dispiro include : dispiro
@ -7190,16 +7191,8 @@ glyph-block Letter-Latin-Z : begin
archv archv
straight.down.end RightSB (-Hook) [widths.heading 0 Stroke Downward] straight.down.end RightSB (-Hook) [widths.heading 0 Stroke Downward]
create-glyph 'zdtail' 0x225 : glyph-proc with-related-glyphs 'Z' 'Zdtail' 0x224 ZDownTailCtor
include [refer-glyph 'z'] AS_BASE with-related-glyphs 'z' 'zdtail' 0x225 ZDownTailCtor
eject-contour 'strokeBottom'
eject-contour 'serifRB'
include : dispiro
widths.lhs
flat SB 0 [heading Rightward]
curl (RightSB - HookX) 0
archv
straight.down.end RightSB (-Hook) [widths.heading 0 Stroke Downward]
create-glyph 'Zswash' 0x2C7F : glyph-proc create-glyph 'Zswash' 0x2C7F : glyph-proc
include : MarkSet.if include : MarkSet.if
@ -7243,18 +7236,16 @@ glyph-block Letter-Latin-Z : begin
if SLAB : begin if SLAB : begin
include : DownwardLeftSerif SB XH VJut include : DownwardLeftSerif SB XH VJut
create-glyph 'Zdesc' 0x2C6B : glyph-proc define [ZDescCtor src sel] : glyph-proc
include [refer-glyph 'Z'] AS_BASE include [refer-glyph src] AS_BASE ALSO_METRICS
eject-contour 'serifRB' eject-contour 'serifRB'
include : VBarRight [mix SB RightSB 1.05] (HalfStroke - LongJut) Stroke include : VBarRight [mix SB RightSB 1.05] (HalfStroke - LongJut) Stroke
create-glyph 'zdesc' 0x2C6C : glyph-proc with-related-glyphs 'Z' 'Zdesc' 0x2C6B ZDescCtor
include [refer-glyph 'z'] AS_BASE with-related-glyphs 'z' 'zdesc' 0x2C6C ZDescCtor
eject-contour 'serifRB'
include : VBarRight [mix SB RightSB 1.05] (HalfStroke - LongJut) Stroke
create-glyph 'zcurlytail' 0x291 : glyph-proc with-related-glyphs 'z' 'zcurlytail' 0x291 : lambda [src sel] : glyph-proc
include : MarkSet.e include [refer-glyph src] AS_BASE ALSO_METRICS
local fine : AdviceStroke2 5 4 XH local fine : AdviceStroke2 5 4 XH
local rinner : Math.max (XH * 0.04) (fine * 0.1) local rinner : Math.max (XH * 0.04) (fine * 0.1)
@ -7264,9 +7255,6 @@ glyph-block Letter-Latin-Z : begin
local m1 : RightSB - fine / 2 - rinner * 1.5 + O local m1 : RightSB - fine / 2 - rinner * 1.5 + O
include : HCurlyTail fine Stroke rinner SB m1 (RightSB + fine / 2) x1 x2 y2 include : HCurlyTail fine Stroke rinner SB m1 (RightSB + fine / 2) x1 x2 y2
include : refer-glyph "z"
eject-contour 'strokeBottom'
eject-contour 'serifRB'
glyph-block Letter-Latin-Eszet : begin glyph-block Letter-Latin-Eszet : begin

View file

@ -67,17 +67,6 @@ const TieGlyph = {
} }
}; };
const DoNotDeriveVariants = {
get(glyph) {
if (glyph && glyph.related) return !!glyph.related.DoNotDeriveVariants;
else return false;
},
set(glyph) {
if (!glyph.related) glyph.related = {};
glyph.related.DoNotDeriveVariants = true;
}
};
const Radical = { const Radical = {
get(glyph) { get(glyph) {
if (glyph && glyph.related) return !!glyph.related.radical; if (glyph && glyph.related) return !!glyph.related.radical;
@ -106,6 +95,18 @@ function Cv(tag, rank) {
if (!glyph.related.cv) glyph.related.cv = {}; if (!glyph.related.cv) glyph.related.cv = {};
glyph.related.cv[key] = toGid; glyph.related.cv[key] = toGid;
}, },
getPreventDeriving(glyph) {
return (
glyph.related &&
glyph.related.preventCvDeriving &&
!!glyph.related.preventCvDeriving[key]
);
},
setPreventDeriving(glyph) {
if (!glyph.related) glyph.related = {};
if (!glyph.related.preventCvDeriving) glyph.related.preventCvDeriving = {};
glyph.related.preventCvDeriving[key] = true;
},
amendName(name) { amendName(name) {
return name + "." + key; return name + "." + key;
} }
@ -142,8 +143,10 @@ const AnyDerivingCv = {
optional: false, optional: false,
query(glyph) { query(glyph) {
let ret = []; let ret = [];
if (glyph && !DoNotDeriveVariants.get(glyph) && glyph.related && glyph.related.cv) { if (glyph && glyph.related && glyph.related.cv) {
for (const key in glyph.related.cv) { for (const key in glyph.related.cv) {
if (glyph.related.preventCvDeriving && glyph.related.preventCvDeriving[key])
continue;
const [tag, rankStr] = key.split("#"); const [tag, rankStr] = key.split("#");
const rank = parseInt(rankStr, 10); const rank = parseInt(rankStr, 10);
const rel = Cv(tag, rank); const rel = Cv(tag, rank);
@ -151,6 +154,15 @@ const AnyDerivingCv = {
} }
} }
return ret; return ret;
},
hasNonDerivingVariants(glyph) {
if (glyph && glyph.related && glyph.related.cv) {
for (const key in glyph.related.cv) {
if (glyph.related.preventCvDeriving && glyph.related.preventCvDeriving[key])
return true;
}
}
return false;
} }
}; };
@ -314,7 +326,6 @@ exports.getGrTree = getGrTree;
exports.getGrMesh = getGrMesh; exports.getGrMesh = getGrMesh;
exports.TieMark = TieMark; exports.TieMark = TieMark;
exports.TieGlyph = TieGlyph; exports.TieGlyph = TieGlyph;
exports.DoNotDeriveVariants = DoNotDeriveVariants;
exports.Radical = Radical; exports.Radical = Radical;
exports.AnyDerivingCv = AnyDerivingCv; exports.AnyDerivingCv = AnyDerivingCv;
exports.CcmpDecompose = CcmpDecompose; exports.CcmpDecompose = CcmpDecompose;

View file

@ -121,6 +121,7 @@ class PrimeVariant {
this.description = cfg.description; this.description = cfg.description;
this.rank = cfg.rank; this.rank = cfg.rank;
this.selector = cfg.selector; this.selector = cfg.selector;
this.nonDeriving = cfg.nonDeriving;
} }
resolveFor(para, gn) { resolveFor(para, gn) {
let vs = {}; let vs = {};

View file

@ -209,6 +209,56 @@ selector.Y = "curly"
[prime.capital-z]
sampler = 'Z'
tag = 'cv63'
[prime.capital-z.variants.standard]
rank = 1
description = 'Standard `Z`'
selector.Z = 'standard'
[prime.capital-z.variants.with-crossbar]
rank = 2
nonDeriving = true
description = 'Standard `Z` with a diagonal cross bar for better dsitinction with `2`'
selector.Z = 'withCrossBar'
[prime.capital-z.variants.with-horizontal-crossbar]
rank = 3
nonDeriving = true
description = 'Standard `Z` with a horizontal cross bar for better dsitinction with `2`'
selector.Z = 'withHorizontalCrossBar'
[prime.capital-z.variants.curly]
rank = 4
description = 'Curly `Z`'
selector.Z = 'curly'
[prime.capital-z.variants.curly-with-crossbar]
rank = 5
description = 'Curly `Z` with a diagonal cross bar for better dsitinction with `2`'
selector.Z = 'curlyWithCrossBar'
[prime.capital-z.variants.curly-with-horizontal-crossbar]
rank = 6
nonDeriving = true
description = 'Curly `Z` with a horizontal cross bar for better dsitinction with `2`'
selector.Z = 'curlyWithHorizontalCrossBar'
[prime.capital-z.variants.motion-serifed]
rank = 7
nonDeriving = true
description = 'Standard `Z` with motion serifs'
selector.Z = 'motionSerifed'
[prime.capital-z.variants.curly-motion-serifed]
rank = 8
description = 'Curly `Z` with motion serifs'
selector.Z = 'curlyMotionSerifed'
[prime.a] [prime.a]
sampler = 'a' sampler = 'a'
tag = 'cv12' tag = 'cv12'
@ -1275,44 +1325,52 @@ selector.y = "curlyTurn"
[prime.z] [prime.z]
sampler = 'zZ' sampler = 'z'
tag = 'cv33' tag = 'cv33'
[prime.z.variants.standard] [prime.z.variants.standard]
rank = 1 rank = 1
description = 'Standard `Z` and `z`' description = 'Standard `z`'
selector.z = 'standard' selector.z = 'standard'
selector.Z = 'standard'
[prime.z.variants.with-crossbar] [prime.z.variants.with-crossbar]
rank = 2 rank = 2
description = 'Standard `Z` and `z` with a diagonal cross bar for better dsitinction with `2`' nonDeriving = true
description = 'Standard `z` with a diagonal cross bar for better dsitinction with `2`'
selector.z = 'withCrossBar' selector.z = 'withCrossBar'
selector.Z = 'withCrossBar'
[prime.z.variants.with-horizontal-crossbar] [prime.z.variants.with-horizontal-crossbar]
rank = 3 rank = 3
description = 'Standard `Z` and `z` with a horizontal cross bar for better dsitinction with `2`' nonDeriving = true
description = 'Standard `z` with a horizontal cross bar for better dsitinction with `2`'
selector.z = 'withHorizontalCrossBar' selector.z = 'withHorizontalCrossBar'
selector.Z = 'withHorizontalCrossBar'
[prime.z.variants.curly] [prime.z.variants.curly]
rank = 4 rank = 4
description = 'Curly `Z` and `z`' description = 'Curly `z`'
selector.z = 'curly' selector.z = 'curly'
selector.Z = 'curly'
[prime.z.variants.curly-with-crossbar] [prime.z.variants.curly-with-crossbar]
rank = 5 rank = 5
description = 'Curly `Z` and `z` with a diagonal cross bar for better dsitinction with `2`' description = 'Curly `z` with a diagonal cross bar for better dsitinction with `2`'
selector.z = 'curlyWithCrossBar' selector.z = 'curlyWithCrossBar'
selector.Z = 'curlyWithCrossBar'
[prime.z.variants.curly-with-horizontal-crossbar] [prime.z.variants.curly-with-horizontal-crossbar]
rank = 6 rank = 6
description = 'Curly `Z` and `z` with a horizontal cross bar for better dsitinction with `2`' nonDeriving = true
description = 'Curly `z` with a horizontal cross bar for better dsitinction with `2`'
selector.z = 'curlyWithHorizontalCrossBar' selector.z = 'curlyWithHorizontalCrossBar'
selector.Z = 'curlyWithHorizontalCrossBar'
[prime.z.variants.motion-serifed]
rank = 7
nonDeriving = true
description = 'Standard `z` with motion serifs'
selector.z = 'motionSerifed'
[prime.z.variants.curly-motion-serifed]
rank = 8
description = 'Curly `z` with motion serifs'
selector.z = 'curlyMotionSerifed'
@ -1983,6 +2041,7 @@ capital-m = 'hanging'
capital-q = 'taily' capital-q = 'taily'
capital-r = 'straight' capital-r = 'straight'
capital-y = 'straight' capital-y = 'straight'
capital-z = 'standard'
# Lowers # Lowers
b = 'toothed' b = 'toothed'
g = 'singlestorey' g = 'singlestorey'
@ -2483,6 +2542,7 @@ tag = 'ss20'
description = 'Curly Style' description = 'Curly Style'
[composite.ss20.design] [composite.ss20.design]
capital-z = 'curly'
v = 'curly' v = 'curly'
turn-v = 'curly' turn-v = 'curly'
w = 'curly' w = 'curly'