Skip to content

Commit

Permalink
Change configuration properties to camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
be5invis committed Nov 12, 2023
1 parent d47bf92 commit b261aab
Show file tree
Hide file tree
Showing 11 changed files with 225 additions and 176 deletions.
252 changes: 126 additions & 126 deletions build-plans.toml

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions changes/28.0.0-alpha.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
* \[**BREAKING**\] The filenames and package filenames are changed.
- They will now use PascalCase instead of kebab-case.
- To package manager maintainers: Please upgrade your script to make it capable to download and install the fonts under new names, and properly uninstall the fonts under old names.
* \[**BREAKING**\] Certain properties in the build plans are changed to camelCase. Using them will trigger a build failure.
- `no-cv-ss``noCvSs`
- `no-ligation``noLigation`
- `export-glyph-names``exportGlyphNames`
- `build-texture-feature``buildTextureFeature`
- `metric-override``metricOverride`
- `compatibility-ligatures``compatibilityLigatures`
- `exclude-chars``excludeChars`
- `webfont-formats``webfontFormats`
* \[**BREAKING**\] The "SGr" TTC packages for Iosevka Aile and Etoile will no longer be generated, as they are duplicates to the non-SGr TTC packages.
* \[**BREAKING**\] Reorder of glyph variants:
- Influenced characters: `M`, `R`, `f`, `t`, `x`, Long S (`ſ`), Lower Chi (`χ`), Cyrillic Lower Em (`м`), Cyrillic Ya (`Я`, `я`), `5`.
Expand Down
2 changes: 1 addition & 1 deletion changes/archives/27.x/27.3.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* Improve crossbar position of GREEK SMALL LETTER DIGAMMA (`U+03DD`) and add a middle serif under slab.
* Refine Greek Capital Sho (U+03F7) glyph (#2079).
* \[Experimental\] Add a font feature for texture control (#2081).
- Currently only available through custom builds with `build-texture-feature = true`.
- Currently only available through custom builds with `buildTextureFeature = true`.
* Make SYMBOL FOR DELETE FORM TWO (`U+2425`) narrow by default, align with other Control Pictures characters (#2084).
* Make APL FUNCTIONAL SYMBOL CIRCLE STAR (`U+235F`) always be five-pointed and upright, to align its pentagram history (#2083).
2 changes: 1 addition & 1 deletion changes/archives/3.x/3.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* Add reverse-slashed zero (#438).
* Add U+1F8B0 and U+1F8B1 (#459).
* Fixed broken shape around `srtail`, `Sswash` and `sswash`.
* Fix `no-cv-ss` building (#460).
* Fix `noCvSs` building (#460).
* Retrocomputing symbols are now defaults to half-width.
* Made variant selectors work for turned letters.
* Make `ligset-dlig` usable from custom build (#463).
Expand Down
4 changes: 2 additions & 2 deletions changes/archives/9.x/9.0.0.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
* \[**Breaking**\]: Add support for expression-style metric override. The old `[metric-override.multiplies]` and `[metric-override.adds]` are no longer supported (#1181).
* \[**Breaking**\]: Add support for expression-style metric override. The old `[metricOverride.multiplies]` and `[metricOverride.adds]` are no longer supported (#1181).
* Fix motion-serifed N's broken shape (#1170).
* Fix bar-serif overlapping in Latin Small H-bar (`U+0127`) and Cyrillic Small Dje (`U+0452`) in Sans subfamily's with-serif variants (#1171).
* Add flat-boundary brace shape (#1172).
* Apply variants of `I`/`i` and `J`/`j` to Dutch letters `U+0132` and `U+0133` (#1174).
* Make dot size, period size and accent size / placement configurable (#1169, #1176).
* Make variants of `0` apply to APL Functional Symbol Zilde (`U+236C`) and Circled Zero with Slash (`U+1F10D`) (#1178).
* Add enclosed sans-serif digits.
* Fix italic derived letters regression in 8.0.
* Fix italic derived letters regression in 8.0.
39 changes: 28 additions & 11 deletions doc/custom-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,21 @@ Inside the plan, top-level properties include:
* `serifs`: Optional, String, configures style of serifs.
- When set to `slab`, the font will be converted into slab-serif.
- Otherwise the font will be sans-serif.
* `no-cv-ss`: Optional, Boolean, disables `cv##` and `ss##` OpenType features.
* `no-ligation`: Optional, Boolean, disables ligations.
* `export-glyph-names`: Optional, Boolean, whether to export glyph names into the fonts. Setting this to `true` will increase file footprint, however this is necessary for ligature support in [Kitty](https://sw.kovidgoyal.net/kitty/).
* `webfont-formats`: Optional, Array of String. Controls the formats needed to be exported into the webfont CSS. Valid options are `'ttf'` and `'woff2'`, or including both.
* `build-texture-feature`: Optional, Boolean, whether to build the `TXTR` feature for cross-letter texture adjustments. Defaults to false.
Build plan could have 5 optional subsections: `ligations`, `variants`, `weights`, `widths` and `slopes`.
* `noCvSs`: Optional, Boolean, disables `cv##` and `ss##` OpenType features.
* `noLigation`: Optional, Boolean, disables ligations.
* `exportGlyphNames`: Optional, Boolean, whether to export glyph names into the fonts. Setting this to `true` will increase file footprint, however this is necessary for ligature support in [Kitty](https://sw.kovidgoyal.net/kitty/).
* `webfontFormats`: Optional, Array of String. Controls the formats needed to be exported into the webfont CSS. Valid options are `'ttf'` and `'woff2'`, or including both.
* `buildTextureFeature`: Optional, Boolean, whether to build the `TXTR` feature for cross-letter texture adjustments. Defaults to false.
Build plan could have 8 optional subsections:
* `ligations`
* `variants`
* `weights`
* `widths`
* `slopes`
* `compatibilityLigatures`
* `excludeChars`
* `metricOverride`
#### Configuring Ligations
Expand Down Expand Up @@ -521,7 +529,7 @@ Subsection `slopes` is used to change the slope angles and grades that the custo
#### Compatibility Ligatures
Certain software, notably Emacs, relies on pre-encoded ligatures instead of OpenType to provide ligations. Iosevka could be configured with additional subsection `compatibility-ligatures`, being an array of records with following fields:
Certain software, notably Emacs, relies on pre-encoded ligatures instead of OpenType to provide ligations. Iosevka could be configured with additional subsection `compatibilityLigatures`, being an array of records with following fields:
* `unicode`: The PUA code point being assigned to.
* `featureTag`: The feature tag to compute ligations.
Expand All @@ -530,15 +538,24 @@ Certain software, notably Emacs, relies on pre-encoded ligatures instead of Open
A sample of compatibility ligature config is:
```toml
[[buildPlans.IosevkaCustom.compatibility-ligatures]]
[[buildPlans.IosevkaCustom.compatibilityLigatures]]
unicode = 57600 # 0xE100
featureTag = 'calt'
sequence = '<*>'
```

#### Excluding Characters

Use the `excludeChars` configuration to exclude character ranges from the font.

```toml
[buildPlans.iosevkaCustom.excludeChars]
ranges = [[10003, 10008]]
```

#### Metric Override

Subsection `metric-override` provides ability to override certain metric values, if you *reallly* want to. Adding this section is **strongly discouraged** as it may introduce broken geometry or broken shapes.
Subsection `metricOverride` provides ability to override certain metric values, if you *reallly* want to. Adding this section is **strongly discouraged** as it may introduce broken geometry or broken shapes.

| Property | Unit | Default Value | Meaning |
|----------|------|---------|----------|
Expand Down Expand Up @@ -597,7 +614,7 @@ Valid functions include:
For example, the following configuration:

```toml
[buildPlans.IosevkaCustom.metric-override]
[buildPlans.IosevkaCustom.metricOverride]
leading = 1500
sb = 'default_sb * 1.0625 + 15'
dotSize = 'blend(weight, [100, 50], [400, 125], [900, 180])'
Expand Down
2 changes: 1 addition & 1 deletion font-src/glyphs/auto-build/transformed.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ glyph-block Autobuild-Transformed : begin
link-relations relSets

glyph-block Autobuild-Transformed-Texture : begin
if (!(para.buildTexture && !para.isQuasiProportional)) : return nothing
if (!(para.buildTextureFeature && !para.isQuasiProportional)) : return nothing

glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
Expand Down
2 changes: 1 addition & 1 deletion font-src/otl/index.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ define [buildGSUB para glyphStore markGlyphs] : begin
buildLOCL gsub para glyphStore

# TXTR, "texture" feature
if (para.buildTexture && !para.isQuasiProportional) : begin
if (para.buildTextureFeature && !para.isQuasiProportional) : begin
buildGsubTexture gsub glyphStore markGlyphs cvs

gsub.finalize
Expand Down
2 changes: 1 addition & 1 deletion font-src/support/parameters.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function init(data, argv) {
applyAlternatesParam(argv, para, data, "slope", "slope");
if (argv.featureControl.noCvSs) para.enableCvSs = false;
if (argv.featureControl.noLigation) para.enableLigation = false;
if (argv.featureControl.buildTexture) para.buildTexture = true;
if (argv.featureControl.buildTextureFeature) para.buildTextureFeature = true;
return para;
}
function applyBlendingParam(argv, para, data, key, keyArgv) {
Expand Down
38 changes: 19 additions & 19 deletions private-build-plans.sample.toml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
### See https://github.com/be5invis/Iosevka/blob/master/doc/custom-build.md for comprehensive
### documentation of the options in this file

[buildPlans.iosevka-custom] # <iosevka-custom> is your plan name
[buildPlans.IosevkaCustom] # <IosevkaCustom> is your plan name
family = "Iosevka Custom" # Font menu family name
spacing = "normal" # Optional; Values: `normal`, `term`, `fontconfig-mono`, or `fixed`
serifs = "sans" # Optional; Values: `sans` or `slab`
export-glyph-names = false # Set this to true for ligature support in Kitty (increased file size)
exportGlyphNames = false # Set this to true for ligature support in Kitty (increased file size)

webfont-formats = ['ttf', 'woff2']
webfontFormats = ['ttf', 'woff2']

###################################################################################################
# Configure variants

# Optional; Whether to inherit a `ss##` variant
[buildPlans.iosevka-custom.variants]
[buildPlans.IosevkaCustom.variants]
inherits = "ss01"

# Optional; Configure single character's variant
[buildPlans.iosevka-custom.variants.design]
[buildPlans.IosevkaCustom.variants.design]
g = 'single-storey-serifless'

# Optional; Configure single character's variant for Upright and Oblique; Overrides [design]
[buildPlans.iosevka-custom.variants.upright]
[buildPlans.IosevkaCustom.variants.upright]
i = 'zshaped'
l = 'zshaped'

# Optional; Configure single character's variant for Italic only; Overrides [design]
[buildPlans.iosevka-custom.variants.italic]
[buildPlans.IosevkaCustom.variants.italic]
i = 'tailed-serifed'
l = 'tailed-serifed'

Expand All @@ -36,7 +36,7 @@ l = 'tailed-serifed'
###################################################################################################
# Configure ligations

[buildPlans.iosevka-custom.ligations]
[buildPlans.IosevkaCustom.ligations]
inherits = "default-calt" # Optional; inherits an existing ligation set
disables = [] # Optional; disable specific ligation groups, overrides inherited ligation set
enables = [] # Optional; enable specific ligation groups, overrides inherited ligation set
Expand All @@ -53,17 +53,17 @@ enables = [] # Optional; enable specific ligation groups, overrid
# and "shape" properly only supports number between 100 and 900 (inclusive).
# If you decide to use custom weights you have to define all the weights you
# plan to use otherwise they will not be built.
[buildPlans.iosevka-custom.weights.Regular]
[buildPlans.IosevkaCustom.weights.Regular]
shape = 400 # Weight for glyph shapes.
menu = 400 # Weight for the font's names.
css = 400 # Weight for webfont CSS.

[buildPlans.iosevka-custom.weights.Book]
[buildPlans.IosevkaCustom.weights.Book]
shape = 450
menu = 450 # Use 450 here to name the font's weight "Book"
css = 450

[buildPlans.iosevka-custom.weights.Bold]
[buildPlans.IosevkaCustom.weights.Bold]
shape = 700
menu = 700
css = 700
Expand All @@ -75,19 +75,19 @@ css = 700
# Override default building slope sets
# When this section is absent, all slopes would be built.

[buildPlans.iosevka-custom.slopes.Upright]
[buildPlans.IosevkaCustom.slopes.Upright]
angle = 0 # Angle in degrees. Valid range [0, 15]
shape = "upright" # Slope grade used for shape selection. `upright` | `oblique` | `italic`
menu = "upright" # Slope grade used for naming. `upright` | `oblique` | `italic`
css = "normal" # Slope grade used for webfont CSS. `normal` | `oblique` | `italic`

[buildPlans.iosevka-custom.slopes.Oblique]
[buildPlans.IosevkaCustom.slopes.Oblique]
angle = 9.4
shape = "oblique"
menu = "oblique"
css = "oblique"

[buildPlans.iosevka-custom.slopes.Italic]
[buildPlans.IosevkaCustom.slopes.Italic]
angle = 9.4
shape = "italic"
menu = "italic"
Expand All @@ -106,12 +106,12 @@ css = "italic"
# If you decide to use custom widths you have to define all the widths you plan to use,
# otherwise they will not be built.

[buildPlans.iosevka-custom.widths.Normal]
[buildPlans.IosevkaCustom.widths.Normal]
shape = 500 # Unit Width, measured in 1/1000 em.
menu = 5 # Width grade for the font's names.
css = "normal" # "font-stretch' property of webfont CSS.

[buildPlans.iosevka-custom.widths.Extended]
[buildPlans.IosevkaCustom.widths.Extended]
shape = 600
menu = 7
css = "expanded"
Expand All @@ -124,7 +124,7 @@ css = "expanded"
# Specify character ranges in the section below to exclude certain characters from the font being
# built. Remove this section when this feature is not needed.

[buildPlans.iosevka-custom.exclude-chars]
[buildPlans.IosevkaCustom.excludeChars]
ranges = [[10003, 10008]]

# End character exclusion
Expand All @@ -137,7 +137,7 @@ ranges = [[10003, 10008]]
# following section to build PUA characters that are generated from the OpenType ligatures.
# Remove this section when compatibility ligatures are not needed.

[[buildPlans.iosevka-custom.compatibility-ligatures]]
[[buildPlans.IosevkaCustom.compatibilityLigatures]]
unicode = 57600 # 0xE100
featureTag = 'calt'
sequence = '<*>'
Expand All @@ -150,7 +150,7 @@ sequence = '<*>'
# Certain metrics like line height (leading) could be overridden in your build plan file.
# Edit the values to change the metrics. Remove this section when overriding is not needed.

[buildPlans.iosevka-custom.metric-override]
[buildPlans.IosevkaCustom.metricOverride]
leading = 1250
winMetricAscenderPad = 0
winMetricDescenderPad = 0
Expand Down
49 changes: 36 additions & 13 deletions verdafile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ const BuildPlans = computed("metadata:build-plans", async target => {
const returnBuildPlans = {};
for (const prefix in rawBuildPlans) {
const bp = { ...rawBuildPlans[prefix] };
if (!bp.family) fail(`Build plan for ${prefix} does not have a family name. Exit.`);
bp.webfontFormats = bp["webfont-formats"] || defaultWebFontFormats;
validateBuildPlan(prefix, bp);
bp.webfontFormats = bp.webfontFormats || defaultWebFontFormats;
bp.targets = [];
returnBuildPlans[prefix] = bp;
}
Expand Down Expand Up @@ -170,7 +170,7 @@ const BuildPlans = computed("metadata:build-plans", async target => {
function linkSpacingDerivableBuildPlans(bps) {
for (const pfxTo in bps) {
const bpTo = bps[pfxTo];
if (blockSpacingDerivation(bpTo)) continue;
if (blockSpacingDerivationTo(bpTo)) continue;
if (!isDeriveToSpacing(bpTo.spacing)) continue;
for (const pfxFrom in bps) {
const bpFrom = bps[pfxFrom];
Expand All @@ -180,8 +180,8 @@ function linkSpacingDerivableBuildPlans(bps) {
}
}
}
function blockSpacingDerivation(bp) {
return !!bp["compatibility-ligatures"];
function blockSpacingDerivationTo(bp) {
return !!bp.compatibilityLigatures;
}
function isDeriveToSpacing(spacing) {
return spacing === "term" || spacing === "fontconfig-mono" || spacing === "fixed";
Expand Down Expand Up @@ -260,10 +260,10 @@ const FontInfoOf = computed.group("metadata:font-info-of", async (target, fileNa
derivingVariants: bp.derivingVariants,
buildCharMap: bp.buildCharMap,
featureControl: {
noCvSs: bp["no-cv-ss"] || false,
noLigation: bp["no-ligation"] || false,
exportGlyphNames: bp["export-glyph-names"] || false,
buildTexture: bp["build-texture-feature"] || false
noCvSs: bp.noCvSs || false,
noLigation: bp.noLigation || false,
exportGlyphNames: bp.exportGlyphNames || false,
buildTextureFeature: bp.buildTextureFeature || false
},
// Ligations
ligations: bp.ligations || null,
Expand All @@ -290,14 +290,17 @@ const FontInfoOf = computed.group("metadata:font-info-of", async (target, fileNa
stretch: sfi.cssStretch,
style: sfi.cssStyle
},
// Hinting
hintParams: bp.hintParams || [],
hintReference:
!bp["metric-override"] && hintReferenceSuffix !== fi0.suffix
!bp.metricOverride && hintReferenceSuffix !== fi0.suffix
? makeFileName(fi0.prefix, hintReferenceSuffix)
: null,
compatibilityLigatures: bp["compatibility-ligatures"] || null,
metricOverride: bp["metric-override"] || null,
excludedCharRanges: bp["exclude-chars"]?.ranges,

// Other parameters
compatibilityLigatures: bp.compatibilityLigatures || null,
metricOverride: bp.metricOverride || null,
excludedCharRanges: bp.excludeChars?.ranges,

// Spacing derivation -- creating faster build for spacing variants
spacingDerive
Expand Down Expand Up @@ -1198,6 +1201,26 @@ const Parameters = task(`meta:parameters`, async target => {

// Build plan validation

function validateBuildPlan(prefix, bp) {
if (!bp.family) fail(`Build plan for ${prefix} does not have a family name. Exit.`);
failWithLegacyParamName(prefix, bp, `no-cv-ss`, `noCvSs`);
failWithLegacyParamName(prefix, bp, `no-ligation`, `noLigation`);
failWithLegacyParamName(prefix, bp, `export-glyph-names`, `exportGlyphNames`);
failWithLegacyParamName(prefix, bp, `build-texture-feature`, `buildTextureFeature`);
failWithLegacyParamName(prefix, bp, `metric-override`, `metricOverride`);
failWithLegacyParamName(prefix, bp, `compatibility-ligatures`, `compatibilityLigatures`);
failWithLegacyParamName(prefix, bp, `exclude-chars`, `excludeChars`);
}

function failWithLegacyParamName(prefix, bp, legacy, expected) {
if (bp[legacy]) {
fail(
`Build plan for '${prefix}' contains legacy build parameter '${legacy}'. ` +
`Please use '${expected}' instead.`
);
}
}

function resolveWws(bpName, buildPlans, defaultConfig) {
const bp = buildPlans[bpName];
if (!bp) fail(`Build plan ${bpName} not found.`);
Expand Down

0 comments on commit b261aab

Please sign in to comment.