Add derived bold / italic / sans-serif / typewriter letters in Mathematical Alphanumeric Symbols block.
This commit is contained in:
parent
aa033e2802
commit
73619b0d6d
8 changed files with 205 additions and 39 deletions
|
@ -440,6 +440,33 @@ no-ligation = true
|
|||
snapshotFamily = 'iosevka-aile'
|
||||
quasiProportionalDiversity = 2
|
||||
|
||||
[buildPlans.iosevka-aile.derivingVariants.mathtt.design]
|
||||
at = 'threefold'
|
||||
j = 'flat-hook-serifed'
|
||||
capital-i = 'serifed'
|
||||
capital-j = 'serifed'
|
||||
g = 'singlestorey'
|
||||
r = 'straight'
|
||||
a = 'doublestorey'
|
||||
d = 'toothed'
|
||||
u = 'toothed'
|
||||
t = 'flat-hook'
|
||||
|
||||
[buildPlans.iosevka-aile.derivingVariants.mathtt.upright]
|
||||
i = 'serifed'
|
||||
l = 'serifed'
|
||||
f = 'flat-hook'
|
||||
|
||||
[buildPlans.iosevka-aile.derivingVariants.mathtt.oblique]
|
||||
i = 'serifed'
|
||||
l = 'serifed'
|
||||
f = 'flat-hook'
|
||||
|
||||
[buildPlans.iosevka-aile.derivingVariants.mathtt.italic]
|
||||
i = 'italic'
|
||||
l = 'italic'
|
||||
f = 'flat-hook-flat-tailed'
|
||||
|
||||
[buildPlans.iosevka-aile.variants.design]
|
||||
at = 'fourfold'
|
||||
j = 'narrow'
|
||||
|
@ -450,18 +477,10 @@ r = 'narrow'
|
|||
a = 'doublestorey'
|
||||
d = 'toothed'
|
||||
u = 'toothed'
|
||||
|
||||
[buildPlans.iosevka-aile.variants.upright]
|
||||
i = 'line'
|
||||
l = 'line'
|
||||
f = 'narrow'
|
||||
t = 'narrow'
|
||||
|
||||
[buildPlans.iosevka-aile.variants.italic]
|
||||
i = 'line'
|
||||
l = 'line'
|
||||
f = 'narrow'
|
||||
t = 'narrow'
|
||||
|
||||
[buildPlans.iosevka-aile.widths.normal]
|
||||
shape = 576
|
||||
|
@ -486,6 +505,10 @@ j = 'serifed'
|
|||
i = 'serifed'
|
||||
l = 'serifed'
|
||||
|
||||
[buildPlans.iosevka-etoile.variants.oblique]
|
||||
i = 'serifed'
|
||||
l = 'serifed'
|
||||
|
||||
[buildPlans.iosevka-etoile.variants.italic]
|
||||
i = 'italic'
|
||||
l = 'italic'
|
||||
|
@ -514,12 +537,40 @@ l = 'serifed'
|
|||
f = 'serifed'
|
||||
r = 'serifed'
|
||||
|
||||
[buildPlans.iosevka-sparkle.variants.oblique]
|
||||
i = 'serifed'
|
||||
l = 'serifed'
|
||||
f = 'serifed'
|
||||
r = 'serifed'
|
||||
|
||||
[buildPlans.iosevka-sparkle.variants.italic]
|
||||
i = 'italic'
|
||||
l = 'italic'
|
||||
f = 'tailed'
|
||||
r = 'top-serifed'
|
||||
|
||||
[buildPlans.iosevka-sparkle.derivingVariants.mathtt.design]
|
||||
at = 'threefold'
|
||||
j = 'flat-hook-serifed'
|
||||
|
||||
[buildPlans.iosevka-sparkle.derivingVariants.mathtt.upright]
|
||||
i = 'serifed'
|
||||
l = 'serifed'
|
||||
f = 'serifed'
|
||||
r = 'serifed'
|
||||
|
||||
[buildPlans.iosevka-sparkle.derivingVariants.mathtt.oblique]
|
||||
i = 'serifed'
|
||||
l = 'serifed'
|
||||
f = 'serifed'
|
||||
r = 'serifed'
|
||||
|
||||
[buildPlans.iosevka-sparkle.derivingVariants.mathtt.italic]
|
||||
i = 'italic'
|
||||
l = 'italic'
|
||||
f = 'tailed'
|
||||
r = 'top-serifed'
|
||||
|
||||
[buildPlans.iosevka-sparkle.widths.normal]
|
||||
shape = 576
|
||||
menu = 5
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
* Fix broken serif shapes in Italic Cyrillic Small I (#717).
|
||||
* Make variant selectors for `m` and `u` have more effect on Cyrillic letters.
|
||||
* Fix incorrect serifs of Greek Small Rho (#718).
|
||||
* Add derived bold / italic / sans-serif / typewriter letters in Mathematical Alphanumeric Symbols block.
|
|
@ -2,7 +2,7 @@
|
|||
$$include '../../meta/macros.ptl'
|
||||
|
||||
import [mix linreg clamp fallback] from '../../support/utils'
|
||||
import [getGrMesh AnyDerivingCv CvDecompose] from "../../support/gr"
|
||||
import [getGrMesh AnyCv CvDecompose] from "../../support/gr"
|
||||
extern Map
|
||||
extern Set
|
||||
|
||||
|
@ -32,7 +32,7 @@ glyph-block Autobuild-Enclosure-Shared : begin
|
|||
define [EnsureComponentGlyphT gidPart fnBuildup] : begin
|
||||
local rs : new Set
|
||||
local gniPart : fnBuildup gidPart
|
||||
local grs : AnyDerivingCv.query [query-glyph gidPart]
|
||||
local grs : AnyCv.query [query-glyph gidPart]
|
||||
if (para.enableCvSs && grs) : foreach gr [items-of grs] : begin
|
||||
local relatedGidPart : gr.get [query-glyph gidPart]
|
||||
local gniRelated : fnBuildup relatedGidPart
|
||||
|
@ -57,7 +57,7 @@ glyph-block Autobuild-Enclosure-Shared : begin
|
|||
local demandDecomposable : para.enableCvSs && globallyDecomposable
|
||||
foreach part [items-of parts] : if [query-glyph part] : begin
|
||||
local g : query-glyph part
|
||||
local relatedGlyphs : AnyDerivingCv.query g
|
||||
local relatedGlyphs : AnyCv.query g
|
||||
foreach gr [items-of relatedGlyphs] : if [query-glyph : gr.get g] : begin
|
||||
if ([query-glyph : gr.get g].advanceWidth != g.advanceWidth)
|
||||
set demandDecomposable false
|
||||
|
@ -67,7 +67,7 @@ glyph-block Autobuild-Enclosure-Shared : begin
|
|||
|
||||
jobsOrig.push { origJobGlyphGn unicode parts :: restInfo }
|
||||
if para.enableCvSs : begin
|
||||
local mesh : getGrMesh parts AnyDerivingCv query-glyph
|
||||
local mesh : getGrMesh parts AnyCv query-glyph
|
||||
foreach {gr fromParts toParts} [items-of mesh] : do
|
||||
local fromGn : CircNameNoCheck unicode prefix fromParts suffix
|
||||
local toGn : CircName unicode prefix toParts suffix
|
||||
|
|
|
@ -2,16 +2,15 @@
|
|||
$$include '../../meta/macros.ptl'
|
||||
|
||||
import [linreg clamp mix fallback] from '../../support/utils'
|
||||
import [AnyDerivingCv DotlessOrNot getGrTree getGrMesh CvDecompose] from "../../support/gr"
|
||||
import [AnyCv DotlessOrNot getGrTree getGrMesh CvDecompose] from "../../support/gr"
|
||||
extern Map
|
||||
extern Set
|
||||
|
||||
glyph-module
|
||||
|
||||
glyph-block Autobuild-Transformed : begin
|
||||
glyph-block Autobuild-Transformed-Shared : begin
|
||||
glyph-block-import CommonShapes
|
||||
glyph-block-import Common-Derivatives
|
||||
glyph-block-import Recursive-Build : Fork Miniature
|
||||
glyph-block-import Marks : markMiddle aboveMarkBot aboveMarkTop belowMarkBot belowMarkTop
|
||||
|
||||
define [suggestName _name] : begin
|
||||
local name _name
|
||||
|
@ -27,6 +26,7 @@ glyph-block Autobuild-Transformed : begin
|
|||
set map.(key) amended
|
||||
return amended
|
||||
|
||||
glyph-block-export extendRelatedGlyphs
|
||||
define [extendRelatedGlyphs records suffix] : begin
|
||||
local relatedRecords {}
|
||||
local relSets {}
|
||||
|
@ -37,7 +37,7 @@ glyph-block Autobuild-Transformed : begin
|
|||
suggestMappedName targetNameMap srcName (srcName + '+' + suffix)
|
||||
|
||||
local dstName : srcName + '+' + suffix
|
||||
local tree : getGrTree srcName {DotlessOrNot AnyDerivingCv} query-glyph
|
||||
local tree : getGrTree srcName {DotlessOrNot AnyCv} query-glyph
|
||||
foreach [{gr origSrcName relSrcName} : items-of tree] : if [query-glyph relSrcName] : begin
|
||||
local origDstName : suggestMappedName targetNameMap origSrcName (origSrcName + '+' + suffix)
|
||||
local relDstName : suggestMappedName targetNameMap relSrcName (relSrcName + '+' + suffix)
|
||||
|
@ -51,6 +51,7 @@ glyph-block Autobuild-Transformed : begin
|
|||
|
||||
return { [records.concat relatedRecords] relSets targetNameMap }
|
||||
|
||||
glyph-block-export link-relations
|
||||
define [link-relations relSets] : begin
|
||||
local rs : new Set
|
||||
foreach [{gr origDstName relDstName} : items-of relSets]
|
||||
|
@ -59,6 +60,13 @@ glyph-block Autobuild-Transformed : begin
|
|||
if [query-glyph relDstName] : begin
|
||||
[query-glyph origDstName].tryBecomeMirrorOf [query-glyph relDstName] rs
|
||||
|
||||
glyph-block Autobuild-Transformed : begin
|
||||
glyph-block-import CommonShapes
|
||||
glyph-block-import Common-Derivatives
|
||||
glyph-block-import Recursive-Build : Fork Miniature
|
||||
glyph-block-import Marks : markMiddle aboveMarkBot aboveMarkTop belowMarkBot belowMarkTop
|
||||
glyph-block-import Autobuild-Transformed-Shared : extendRelatedGlyphs link-relations
|
||||
|
||||
define [createSuperscripts _records] : begin
|
||||
local {records relSets targetNameMap} : extendRelatedGlyphs _records 'sup'
|
||||
local pendingGlyphs : records.map : [record] => record.1
|
||||
|
@ -480,6 +488,99 @@ glyph-block Autobuild-Transformed : begin
|
|||
list 0x2148 'mathbb/i'
|
||||
list 0x2149 'mathbb/j'
|
||||
|
||||
glyph-block Autobuild-Transformed-Mathematical : begin
|
||||
glyph-block-import CommonShapes
|
||||
glyph-block-import Common-Derivatives
|
||||
glyph-block-import Recursive-Build : Fork Miniature
|
||||
glyph-block-import Autobuild-Transformed-Shared : extendRelatedGlyphs link-relations
|
||||
|
||||
define [createMathDerivedSeriesImpl groupName tfm _records] : begin
|
||||
local { records relSets targetNameMap } : extendRelatedGlyphs _records groupName
|
||||
local pendingGlyphs : records.map : [record] => record.1
|
||||
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
|
||||
include [forked.queryByName glyphid] AS_BASE ALSO_METRICS
|
||||
|
||||
link-relations relSets
|
||||
|
||||
define [boldGrade g] : begin
|
||||
local pGrade : (900 - g) / 100
|
||||
return : 900 - 100 * (2 / 25) * pGrade * pGrade
|
||||
define [tfBold a] : begin [set a.shape.weight : boldGrade a.shape.weight]
|
||||
define [tfItalic a] : begin [set a.shape.slope 'italic']
|
||||
define [tfSans a] : begin [set a.shape.serifs 'sans']
|
||||
define [tfBoldItalic a] : begin [tfBold a] [tfItalic a]
|
||||
define [tfSansBold a] : begin [tfSans a] [tfBold a]
|
||||
define [tfSansItalic a] : begin [tfSans a] [tfItalic a]
|
||||
define [tfSansBoldItalic a] : begin [tfSans a] [tfBold a] [tfItalic a]
|
||||
define [tfTypeWriter a] : begin
|
||||
set a.shape.quasiProportionalDiversity 0
|
||||
if (a.derivingVariants && a.derivingVariants.mathtt)
|
||||
set a.variants a.derivingVariants.mathtt
|
||||
|
||||
define Digits : Array.from '0123456789'
|
||||
define UpperLatin : Array.from 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
define LowerLatin : Array.from 'abcdefghijklmnopqrstuvwxyz'
|
||||
define UpperGreek : Array.from 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡϴΣΤΥΦΧΨΩ∇'
|
||||
define LowerGreek : Array.from 'αβγδεζηθικλμνξοπρςστυφχψω∂ϵϑϰϕϱϖ' # Some are missing though
|
||||
|
||||
define [CreateMathDerivatives groupName tfm base letters overrides] : begin
|
||||
if recursive : return nothing
|
||||
local jobs {}
|
||||
local overrideMap : new Map (overrides || {})
|
||||
foreach j [range 0 letters.length] : begin
|
||||
local letter letters.(j)
|
||||
local source : glyphStore.queryNameOfUnicode : letter.codePointAt 0
|
||||
local dst : base + j
|
||||
if [overrideMap.has letter] : set dst [overrideMap.get letter]
|
||||
if source : jobs.push { dst source }
|
||||
|
||||
createMathDerivedSeriesImpl groupName tfm jobs
|
||||
|
||||
# Math bold
|
||||
CreateMathDerivatives 'mathbf' tfBold 0x1D400 UpperLatin
|
||||
CreateMathDerivatives 'mathbf' tfBold 0x1D41A LowerLatin
|
||||
CreateMathDerivatives 'mathbf' tfBold 0x1D6A8 UpperGreek
|
||||
CreateMathDerivatives 'mathbf' tfBold 0x1D6C2 LowerGreek
|
||||
CreateMathDerivatives 'mathbf' tfBold 0x1D7CE Digits
|
||||
|
||||
# Math Italic
|
||||
CreateMathDerivatives 'mathit' tfItalic 0x1D434 UpperLatin
|
||||
CreateMathDerivatives 'mathit' tfItalic 0x1D44E LowerLatin : list { 'h' 0x210E }
|
||||
CreateMathDerivatives 'mathit' tfItalic 0x1D6E2 UpperGreek
|
||||
CreateMathDerivatives 'mathit' tfItalic 0x1D6FC LowerGreek
|
||||
|
||||
# Math Bold Italic
|
||||
CreateMathDerivatives 'mathbi' tfBoldItalic 0x1D468 UpperLatin
|
||||
CreateMathDerivatives 'mathbi' tfBoldItalic 0x1D482 LowerLatin
|
||||
CreateMathDerivatives 'mathbi' tfBoldItalic 0x1D71C UpperGreek
|
||||
CreateMathDerivatives 'mathbi' tfBoldItalic 0x1D736 LowerGreek
|
||||
|
||||
# Math Sans-serif
|
||||
CreateMathDerivatives 'mathss' tfSans 0x1D5A0 UpperLatin
|
||||
CreateMathDerivatives 'mathss' tfSans 0x1D5BA LowerLatin
|
||||
CreateMathDerivatives 'mathss' tfSans 0x1D7E2 Digits
|
||||
|
||||
CreateMathDerivatives 'mathsi' tfSansItalic 0x1D608 UpperLatin
|
||||
CreateMathDerivatives 'mathsi' tfSansItalic 0x1D622 LowerLatin
|
||||
|
||||
CreateMathDerivatives 'mathsb' tfSansBold 0x1D5D4 UpperLatin
|
||||
CreateMathDerivatives 'mathsb' tfSansBold 0x1D5EE LowerLatin
|
||||
CreateMathDerivatives 'mathsb' tfSansBold 0x1D756 UpperGreek
|
||||
CreateMathDerivatives 'mathsb' tfSansBold 0x1D770 LowerGreek
|
||||
CreateMathDerivatives 'mathsb' tfSansBold 0x1D7EC Digits
|
||||
|
||||
CreateMathDerivatives 'mathsz' tfSansBoldItalic 0x1D63C UpperLatin
|
||||
CreateMathDerivatives 'mathsz' tfSansBoldItalic 0x1D656 LowerLatin
|
||||
CreateMathDerivatives 'mathsz' tfSansBoldItalic 0x1D790 UpperGreek
|
||||
CreateMathDerivatives 'mathsz' tfSansBoldItalic 0x1D7AA LowerGreek
|
||||
|
||||
# Math Typewriter
|
||||
CreateMathDerivatives 'mathtt' tfTypeWriter 0x1D670 UpperLatin
|
||||
CreateMathDerivatives 'mathtt' tfTypeWriter 0x1D68A LowerLatin
|
||||
CreateMathDerivatives 'mathtt' tfTypeWriter 0x1D7F6 Digits
|
||||
|
||||
glyph-block Autobuild-Rhotic : begin
|
||||
glyph-block-import Marks : markFine
|
||||
glyph-block-import CommonShapes
|
||||
|
|
|
@ -16,8 +16,11 @@ glyph-block Common-Derivatives : begin
|
|||
foreach { kPrime prime } para.variants.primes : foreach h [prime.variants.values] : begin
|
||||
local suffix : h.resolveFor para follow
|
||||
if (suffix && transform && transform.(suffix)) : set suffix transform.(suffix)
|
||||
if (suffix && h.tag && h.rank) : begin
|
||||
[Cv h.tag h.rank].set g ([fallback name follow] + '.' + suffix)
|
||||
if suffix : begin
|
||||
local dstName : [fallback name follow] + '.' + suffix
|
||||
local dst : glyphStore.queryByName dstName
|
||||
if dst : g.dependsOn dst
|
||||
if (h.tag && h.rank) : [Cv h.tag h.rank].set g dstName
|
||||
|
||||
define [select-variant] : params [name unicode [to-name name] transform [follow name]] : begin
|
||||
if [not : glyph-is-needed name] : return nothing
|
||||
|
|
|
@ -13,14 +13,14 @@ const ApplyLigationData = require("./support/ligation-data");
|
|||
const { createGrDisplaySheet } = require("./support/gr");
|
||||
|
||||
module.exports = async function main(argv) {
|
||||
const para = await getParameters(argv);
|
||||
const { font, glyphStore } = BuildFont(para);
|
||||
const paraT = await getParameters();
|
||||
const { font, glyphStore } = BuildFont(paraT(argv));
|
||||
if (argv.oCharMap) await saveCharMap(argv, glyphStore);
|
||||
if (argv.o) await saveTTF(argv, font);
|
||||
};
|
||||
|
||||
// Parameter preparation
|
||||
async function getParameters(argv) {
|
||||
async function getParameters() {
|
||||
const PARAMETERS_TOML = path.resolve(__dirname, "../params/parameters.toml");
|
||||
const WEIGHTS_TOML = path.resolve(__dirname, "../params/shape-weight.toml");
|
||||
const WIDTHS_TOML = path.resolve(__dirname, "../params/shape-width.toml");
|
||||
|
@ -38,6 +38,7 @@ async function getParameters(argv) {
|
|||
const rawVariantsData = await tryParseToml(VARIANTS_TOML);
|
||||
const rawLigationData = await tryParseToml(LIGATIONS_TOML);
|
||||
|
||||
function reinit(argv) {
|
||||
let para = Parameters.init(parametersData, argv);
|
||||
VariantData.apply(rawVariantsData, para, argv);
|
||||
ApplyLigationData(rawLigationData, para, argv);
|
||||
|
@ -54,7 +55,15 @@ async function getParameters(argv) {
|
|||
width: argv.menu.width - 0,
|
||||
slope: argv.menu.slope
|
||||
};
|
||||
|
||||
para.reinit = function (tf) {
|
||||
const argv1 = JSON.parse(JSON.stringify(argv));
|
||||
tf(argv1, argv);
|
||||
return reinit(argv1);
|
||||
};
|
||||
return para;
|
||||
}
|
||||
return reinit;
|
||||
}
|
||||
|
||||
async function tryParseToml(str) {
|
||||
|
|
|
@ -24,6 +24,7 @@ function apply(sink, parametersData, styles, blendArgs) {
|
|||
for (const item of styles) intro(parametersData, item, blendArgs, sink);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function intro(source, style, blendArgs, sink) {
|
||||
let hive = source[style];
|
||||
if (!hive) return;
|
||||
|
|
|
@ -166,7 +166,7 @@ const FontInfoOf = computed.group("metadata:font-info-of", async (target, fileNa
|
|||
return {
|
||||
name: fileName,
|
||||
variants: bp.variants || null,
|
||||
ligations: bp["ligations"] || null,
|
||||
derivingVariants: bp.derivingVariants,
|
||||
featureControl: {
|
||||
noCvSs: bp["no-cv-ss"] || false,
|
||||
noLigation: bp["no-ligation"] || false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue