Reduce the quantity of Z-related pre-baked composites.

This commit is contained in:
be5invis 2021-01-30 19:21:21 -08:00
parent 99c8687812
commit a83d3078ea
6 changed files with 64 additions and 41 deletions

View file

@ -1,7 +1,7 @@
###### Automatic builds
$$include '../../meta/macros.ptl'
import [Dotless AnyDerivingCv DotlessOrNot getGrTree CvDecompose] from "../../support/gr"
import [Dotless AnyDerivingCv DotlessOrNot getGrTree CvDecompose ZReduced] from "../../support/gr"
import [fallback] from '../../support/utils'
glyph-module
@ -32,10 +32,14 @@ glyph-block AutoBuild-Accents : begin
set parts.(j) [query-glyph 'ogonekTR']
define [subParts parts] : begin
# Reduce Z variants
if [ZReduced.get parts.0] : begin
local reduced : query-glyph : ZReduced.get parts.0
if reduced : set parts.0 reduced
# Handle dotless
local hasMarkAbove false
foreach p [items-of parts] : if [isAboveMark p] : set hasMarkAbove true
# replace dotted-i and dotted-j with dotless equalivents
if (hasMarkAbove && [Dotless.get parts.0]) : begin
local dotless [query-glyph : Dotless.get parts.0]
if dotless : set parts.0 dotless
@ -117,6 +121,7 @@ glyph-block AutoBuild-Accents : begin
define construction : glyph-proc
include s_parts.0 AS_BASE ALSO_METRICS
local nonTrivial : AnyDerivingCv.hasNonDerivingVariants s_parts.0
if nonTrivial : console.log s_parts.0
foreach part [items-of : s_parts.slice 1] : if part : begin
include part
if (part.markAnchors && part.markAnchors.bottomright) : begin

View file

@ -482,6 +482,7 @@ glyph-block Autobuild-Transformed-Mathematical : begin
local forked : Fork pendingGlyphs [para.reinit tfm]
foreach {unicode glyphid} [items-of records] : if [not : query-glyph targetNameMap.(glyphid)]
create-glyph targetNameMap.(glyphid) unicode : glyph-proc
if [not : forked.queryByName glyphid] : console.log glyphid
include [forked.queryByName glyphid] AS_BASE ALSO_METRICS
link-relations relSets

View file

@ -12,11 +12,11 @@ glyph-module
glyph-block Common-Derivatives : begin
glyph-block-import CommonShapes : FlipAround
define [ApplyCv g follow para name] : begin
define [ApplyCv g shapeFrom follow para] : begin
foreach { kPrime prime } para.variants.primes : foreach h [prime.variants.values] : begin
local suffix : h.resolveFor para follow
if suffix : begin
local dstName : [fallback name follow] + '.' + suffix
local dstName : shapeFrom + '.' + suffix
local dst : glyphStore.queryByName dstName
if dst : g.dependsOn dst
if (h.tag && h.rank) : begin
@ -24,14 +24,14 @@ glyph-block Common-Derivatives : begin
if h.nonDeriving : [Cv h.tag h.rank].setPreventDeriving g
define [select-variant] : params [name unicode [shapeFrom name] [follow name]] : begin
if [not : glyph-is-needed shapeFrom] : return nothing
if [not : glyph-is-needed name] : return nothing
local variant para.variantSelector.(follow)
if [not variant] : throw : new Error "Variant for \(name) is not assigned."
create-glyph name unicode : glyph-proc
include [refer-glyph (shapeFrom + '.' + variant)] AS_BASE ALSO_METRICS
ApplyCv currentGlyph follow para shapeFrom
ApplyCv currentGlyph shapeFrom follow para
set this.autoRefPriority [query-glyph (shapeFrom + '.' + variant)].autoRefPriority
define [orthographic-italic name unicode] : if para.isItalic

View file

@ -2,7 +2,7 @@ $$include '../../../meta/macros.ptl'
import [mix linreg clamp fallback] from '../../../support/utils'
import [DesignParameters] from '../../../meta/aesthetics'
import [Dotless CvDecompose] from "../../../support/gr"
import [ZReduced] from "../../../support/gr"
glyph-module
@ -132,17 +132,19 @@ glyph-block Letter-Latin-Z : begin
select-variant 'Z' 'Z'
select-variant 'z' 'z'
select-variant 'ZReduced' (shapeFrom -- 'Z')
select-variant 'zReduced' (shapeFrom -- 'z')
select-variant 'grek/Zeta' 0x396 (shapeFrom -- 'Z') (follow -- 'ZReduced')
# if recursive : console.log recursive [query-glyph 'grek/Zeta']
if [query-glyph 'Z'] : ZReduced.set [query-glyph 'Z'] 'ZReduced'
if [query-glyph 'z'] : ZReduced.set [query-glyph 'z'] 'zReduced'
alias 'grek/Zeta.standard' null 'Z.standard'
alias 'grek/Zeta.curly' null 'Z.curly'
alias 'grek/Zeta.motionSerifed' null 'Z.motionSerifed'
alias 'grek/Zeta.curlyMotionSerifed' null 'Z.curlyMotionSerifed'
alias 'grek/Zeta.topMotionSerifed' null 'Z.topMotionSerifed'
alias 'grek/Zeta.curlyTopMotionSerifed' null 'Z.curlyTopMotionSerifed'
select-variant 'grek/Zeta' 0x396
alias 'Zbar' 0x1B5 'Z.withHorizontalCrossBar'
alias 'zbar' 0x1B6 'z.withHorizontalCrossBar'
with-related-glyphs 'ZBar' 0x1B5 'ZReduced' : lambda [src sel] : composite-proc
refer-glyph src
refer-glyph 'barOver'
with-related-glyphs 'zBar' 0x1B6 'zReduced' : lambda [src sel] : composite-proc
refer-glyph src
refer-glyph 'barOver'
define [BBZShape top] : glyph-proc
include : HBarTop SB RightSB top BBS
@ -183,8 +185,8 @@ glyph-block Letter-Latin-Z : begin
archv
straight.down.end RightSB (-Hook) [widths.heading 0 Stroke Downward]
with-related-glyphs 'Zdtail' 0x224 'Z' ZDownTailCtor
with-related-glyphs 'zdtail' 0x225 'z' ZDownTailCtor
with-related-glyphs 'Zdtail' 0x224 'ZReduced' ZDownTailCtor
with-related-glyphs 'zdtail' 0x225 'zReduced' ZDownTailCtor
create-glyph 'Zswash' 0x2C7F : glyph-proc
include : MarkSet.if
@ -233,10 +235,10 @@ glyph-block Letter-Latin-Z : begin
eject-contour 'serifRB'
include : VBarRight [mix SB RightSB 1.05] (HalfStroke - LongJut) Stroke
with-related-glyphs 'Zdesc' 0x2C6B 'Z' ZDescCtor
with-related-glyphs 'zdesc' 0x2C6C 'z' ZDescCtor
with-related-glyphs 'Zdesc' 0x2C6B 'ZReduced' ZDescCtor
with-related-glyphs 'zdesc' 0x2C6C 'zReduced' ZDescCtor
with-related-glyphs 'zCurlyTail' 0x291 'z' : lambda [src sel] : glyph-proc
with-related-glyphs 'zCurlyTail' 0x291 'zReduced' : lambda [src sel] : glyph-proc
include [refer-glyph src] AS_BASE ALSO_METRICS
local fine : AdviceStroke2 5 4 XH

View file

@ -16,6 +16,18 @@ const Dotless = {
}
};
const ZReduced = {
get(glyph) {
if (glyph && glyph.related) return glyph.related.zReduced;
else return null;
},
set(glyph, toGid) {
if (typeof toGid !== "string") throw new Error("Must supply a GID instead of a glyph");
if (!glyph.related) glyph.related = {};
glyph.related.zReduced = toGid;
}
};
const CvDecompose = {
get(glyph) {
if (glyph && glyph.related) return glyph.related.CvDecompose;
@ -319,6 +331,7 @@ function queryCvFeatureTagsOf(gid, glyph, variantAssignmentSet) {
}
exports.Dotless = Dotless;
exports.ZReduced = ZReduced;
exports.Cv = Cv;
exports.AnyCv = AnyCv;
exports.DotlessOrNot = DotlessOrNot;

View file

@ -949,65 +949,61 @@ tag = "cv25"
rank = 1
description = "Standard `Z`"
selector.Z = "standard"
selector."grek/Zeta" = "standard"
selector."ZReduced" = "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"
selector."grek/Zeta" = "standard"
selector."ZReduced" = "standard"
[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"
selector."grek/Zeta" = "standard"
selector."ZReduced" = "standard"
[prime.capital-z.variants.curly]
rank = 4
description = "Curly `Z`"
selector.Z = "curly"
selector."grek/Zeta" = "curly"
selector."ZReduced" = "curly"
[prime.capital-z.variants.curly-with-crossbar]
rank = 5
nonDeriving = true
description = "Curly `Z` with a diagonal cross bar for better dsitinction with `2`"
selector.Z = "curlyWithCrossBar"
selector."grek/Zeta" = "curly"
selector."ZReduced" = "curly"
[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"
selector."grek/Zeta" = "curly"
selector."ZReduced" = "curly"
[prime.capital-z.variants.motion-serifed]
rank = 7
description = "Standard `Z` with motion serifs at bottom"
selector.Z = "motionSerifed"
selector."grek/Zeta" = "motionSerifed"
selector."ZReduced" = "motionSerifed"
[prime.capital-z.variants.curly-motion-serifed]
rank = 8
description = "Curly `Z` with motion serifs at bottom"
selector.Z = "curlyMotionSerifed"
selector."grek/Zeta" = "curlyMotionSerifed"
selector."ZReduced" = "curlyMotionSerifed"
[prime.capital-z.variants.top-motion-serifed]
rank = 9
description = "Standard `Z` with motion serifs at top"
selector.Z = "topMotionSerifed"
selector."grek/Zeta" = "topMotionSerifed"
selector."ZReduced" = "topMotionSerifed"
[prime.capital-z.variants.curly-top-motion-serifed]
rank = 10
description = "Curly `Z` with motion serifs at top"
selector.Z = "curlyTopMotionSerifed"
selector."grek/Zeta" = "curlyTopMotionSerifed"
selector."ZReduced" = "curlyTopMotionSerifed"
@ -2448,55 +2444,61 @@ tag = "cv50"
rank = 1
description = "Standard `z`"
selector.z = "standard"
selector."zReduced" = "standard"
[prime.z.variants.with-crossbar]
rank = 2
nonDeriving = true
description = "Standard `z` with a diagonal cross bar for better dsitinction with `2`"
selector.z = "withCrossBar"
selector."zReduced" = "standard"
[prime.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"
selector."zReduced" = "standard"
[prime.z.variants.curly]
rank = 4
description = "Curly `z`"
selector.z = "curly"
selector."zReduced" = "curly"
[prime.z.variants.curly-with-crossbar]
rank = 5
nonDeriving = true
description = "Curly `z` with a diagonal cross bar for better dsitinction with `2`"
selector.z = "curlyWithCrossBar"
selector."zReduced" = "curly"
[prime.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"
selector."zReduced" = "curly"
[prime.z.variants.motion-serifed]
rank = 7
description = "Standard `z` with motion serifs at bottom"
selector.z = "motionSerifed"
selector."zReduced" = "motionSerifed"
[prime.z.variants.curly-motion-serifed]
rank = 8
description = "Curly `z` with motion serifs at bottom"
selector.z = "curlyMotionSerifed"
selector."zReduced" = "curlyMotionSerifed"
[prime.z.variants.top-motion-serifed]
rank = 9
description = "Standard `z` with motion serifs at top"
selector.z = "topMotionSerifed"
selector."zReduced" = "topMotionSerifed"
[prime.z.variants.curly-top-motion-serifed]
rank = 10
description = "Curly `z` with motion serifs at top"
selector.z = "curlyTopMotionSerifed"
selector."zReduced" = "curlyTopMotionSerifed"