Support slope-dependent digit form control (#724).

This commit is contained in:
be5invis 2020-11-12 03:47:42 -08:00
parent fa150fba6b
commit 1358f914a5
10 changed files with 32 additions and 19 deletions

View file

@ -324,9 +324,6 @@ Configuration of build plans are organized under `[buildPlans.<plan name>]` sect
- Otherwise the font will be sans-serif.
* `no-cv-ss`: Optional, Boolean, disables `cv##` and `ss##` OpenType features.
* `no-ligation`: Optional, Boolean, disables ligations.
* `digit-form`: Optional, String, configures the default form of digits (figures).
- When set to `old-style`, old-style digit figures will be used.
- When absent or set to `lining`, lining digit figures will be used.
Build plan could have 5 optional subsections: `ligations`, `variants`, `weights`, `widths` and `slopes`.
@ -424,8 +421,15 @@ Subsection `variants` is used to configure character variants in the font. Prope
<!-- BEGIN Section-Cherry-Picking-Styles -->
<!-- THIS SECTION IS AUTOMATICALLY GENERATED. DO NOT EDIT. -->
* `design`, `upright`, `italic`, and `oblique`: Optional, Dictionary, defines styles for individual characters. The choices are organized in key-value pairs, assigning a variant to a character group. Alternatively, you could assign numbers to `cv##` tags, like what you did when using OpenType in CSS. Assignments under `design` will be applied to all the slopes, and `upright`, `italic`, and `oblique` will apply to corresponded slopes. The valid combinations include:
* `design`, `upright`, `italic`, and `oblique`: Optional, Dictionary, defines styles for individual characters. The choices are organized in key-value pairs, assigning a variant to a character group. Alternatively, you could assign numbers to `cv##` tags, like what you did when using OpenType in CSS. Assignments under `design` will be applied to all the slopes, and `upright`, `italic`, and `oblique` will apply to corresponded slopes.
In addition, style selector for default digit form also uses these dictionaries.
The valid combinations include:
- Default digit form:
- `digit-form = 'lining'`: Lining (default).
- `digit-form = 'old-style'`: Old-style.
- Styles for `A`, `Λ`, `Δ`:
+ `turn-v = 'straight'`, `cv01 = 1`: Standard, straight `A`, `Λ`, `Δ` (default).
+ `turn-v = 'curly'`, `cv01 = 2`: Slightly curly `A`, `Λ`, `Δ`, like Iosevka 2.x.

View file

@ -4,3 +4,4 @@
* Fix incorrect serifs of Greek Small Rho (#718).
* Add derived bold / italic / sans-serif / typewriter letters in Mathematical Alphanumeric Symbols block.
* Add shorter-serif variant for capital I (#709).
* Support slope-dependent digit form control (#724).

View file

@ -22,8 +22,8 @@ glyph-block Digits-Shared : begin
p : MarkSet.OfZone {.top OnumHeight .bot (OnumHeight - CAP)}
glyph-block-export CodeLnum CodeOnum
define [CodeLnum u] : if para.defaultToOldStyleFigures null u
define [CodeOnum u] : if para.defaultToOldStyleFigures u null
define [CodeLnum u] : if (para.variantSelector.__defaultDigitForm == 'oldStyle') null u
define [CodeOnum u] : if (para.variantSelector.__defaultDigitForm == 'oldStyle') u null
glyph-block Digits-Zero : begin
glyph-block-import CommonShapes

View file

@ -8,7 +8,6 @@ function initPara(data, argv) {
apply(para, data, ["iosevka"]);
if (argv.shape.serifs) apply(para, data, ["serifs-" + argv.shape.serifs]);
if (argv.shape.spacing) apply(para, data, ["spacing-" + argv.shape.spacing]);
if (argv.shape.digitForm) apply(para, data, ["digit-form-" + argv.shape.digitForm]);
apply(para, data, ["shapeWeight"], { shapeWeight: argv.shape.weight });
apply(para, data, ["shapeWidth"], { shapeWidth: argv.shape.width });
apply(para, data, [`s-${argv.shape.slope}`]);

View file

@ -64,9 +64,6 @@ excludedCharRanges = []
# - 2+ : Full (3.x)
slab = 0
# Enable old-style digits by default?
defaultToOldStyleFigures = false
[verbose]
verbose = true
@ -120,9 +117,3 @@ diversityF = 0.75
diversityI = 0.75
diversityII = 0.5
###### Old-style figures
[digit-form-old-style]
defaultToOldStyleFigures = true
[digit-form-lining]
defaultToOldStyleFigures = false

View file

@ -1644,6 +1644,13 @@ selector.r = "narrow"
selector."turnrrtail" = "narrow"
selector."rflap" = "narrow"
# This is a special variant selector that controls digit form
[prime.digit-form.variants.lining]
selector.__defaultDigitForm = "lining"
[prime.digit-form.variants.old-style]
selector.__defaultDigitForm = "oldStyle"
###################################################################################################
[default.design]
@ -1703,6 +1710,8 @@ ascii-grave = 'straight'
h = 'straight'
m = 'normal'
n = 'straight'
# Digit form
digit-form = 'lining'
[default.upright-oblique]
a = 'doublestorey'

View file

@ -2,7 +2,6 @@
family = "Iosevka Custom" # Font menu family name
spacing = "normal" # Optional; Values: `normal`, `term`, `fontconfig-mono`, or `fixed`
serifs = "sans" # Optional; Values: `sans` or `slab`
digit-form = "lining" # Optional; Values `lining` or `old-style`
###################################################################################################
# Configure variants

View file

@ -1 +1,5 @@
* `design`, `upright`, `italic`, and `oblique`: Optional, Dictionary, defines styles for individual characters. The choices are organized in key-value pairs, assigning a variant to a character group. Alternatively, you could assign numbers to `cv##` tags, like what you did when using OpenType in CSS. Assignments under `design` will be applied to all the slopes, and `upright`, `italic`, and `oblique` will apply to corresponded slopes. The valid combinations include:
* `design`, `upright`, `italic`, and `oblique`: Optional, Dictionary, defines styles for individual characters. The choices are organized in key-value pairs, assigning a variant to a character group. Alternatively, you could assign numbers to `cv##` tags, like what you did when using OpenType in CSS. Assignments under `design` will be applied to all the slopes, and `upright`, `italic`, and `oblique` will apply to corresponded slopes.
In addition, style selector for default digit form also uses these dictionaries.
The valid combinations include:

View file

@ -0,0 +1,3 @@
- Default digit form:
- `digit-form = 'lining'`: Lining (default).
- `digit-form = 'old-style'`: Old-style.

View file

@ -71,6 +71,9 @@ async function processCv() {
const headerPath = path.resolve(__dirname, "fragments/description-cheery-picking-styles.md");
md.log(await fs.readFile(headerPath, "utf-8"));
const cvDigitFormPath = path.resolve(__dirname, "fragments/special-variant-digit-form.md");
md.log(await fs.readFile(cvDigitFormPath, "utf-8"));
for (const gr of variantsData.primes) {
const sampleText = gr.descSampleText
.map(c => (c === "`" ? "`` ` ``" : `\`${c}\``))