Fix composition item of ligations

This commit is contained in:
be5invis 2020-10-28 21:57:59 -07:00
parent 13bfc1ccbf
commit e952c58cdc
2 changed files with 12 additions and 25 deletions

View file

@ -458,11 +458,11 @@ Subsection `variants` is used to configure character variants in the font. Prope
+ `caret = 'high'`, `cv47 = 1`: Higher circumflex `^` (default). + `caret = 'high'`, `cv47 = 1`: Higher circumflex `^` (default).
+ `caret = 'low'`, `cv47 = 2`: Lower circumflex `^`. + `caret = 'low'`, `cv47 = 2`: Lower circumflex `^`.
- Styles for `(`, `)`: - Styles for `(`, `)`:
+ `paren = 'normal'`, `cv48 = 1`: Parenthesis with normal contour. + `paren = 'normal'`, `cv48 = 1`: Parenthesis with normal contour (default).
+ `paren = 'large-contour'`, `cv48 = 2`: Parenthesis with larger contour, like that in Monaco. + `paren = 'large-contour'`, `cv48 = 2`: Parenthesis with larger contour, like that in Monaco.
- Styles for `{`, `}`: - Styles for `{`, `}`:
+ `brace = 'straight'`, `cv49 = 1`: More straight braces. + `brace = 'straight'`, `cv49 = 1`: More straight braces.
+ `brace = 'curly'`, `cv49 = 2`: More curly braces. + `brace = 'curly'`, `cv49 = 2`: More curly braces (default).
- Styles for `#`: - Styles for `#`:
+ `number-sign = 'upright'`, `cv50 = 1`: Number sign with vertical bars (default). + `number-sign = 'upright'`, `cv50 = 1`: Number sign with vertical bars (default).
+ `number-sign = 'slanted'`, `cv50 = 2`: Number sign with slanted bars. + `number-sign = 'slanted'`, `cv50 = 2`: Number sign with slanted bars.
@ -492,7 +492,7 @@ Subsection `variants` is used to configure character variants in the font. Prope
+ `bar = 'natural-slope'`, `cv55 = 1`: Bar punctuations (`|`) has a natural slope under italics and oblique (default). + `bar = 'natural-slope'`, `cv55 = 1`: Bar punctuations (`|`) has a natural slope under italics and oblique (default).
+ `bar = 'force-upright'`, `cv55 = 2`: Bar punctuations (`|`) is forced upright under italics and oblique. + `bar = 'force-upright'`, `cv55 = 2`: Bar punctuations (`|`) is forced upright under italics and oblique.
- Styles for `<=`, `>=`: - Styles for `<=`, `>=`:
+ `lig-ltgteq = 'flat'`, `cv56 = 1`: The lower bar of `<=` and `>=` ligation is flat. + `lig-ltgteq = 'flat'`, `cv56 = 1`: The lower bar of `<=` and `>=` ligation is flat (default).
+ `lig-ltgteq = 'slanted'`, `cv56 = 2`: The lower bar of `<=` and `>=` ligation is slanted. + `lig-ltgteq = 'slanted'`, `cv56 = 2`: The lower bar of `<=` and `>=` ligation is slanted.
- Styles for `'`: - Styles for `'`:
+ `ascii-single-quote = 'straight'`, `cv57 = 1`: Show ASCII quote (`'`) as short vertical straight bar. (default). + `ascii-single-quote = 'straight'`, `cv57 = 1`: Show ASCII quote (`'`) as short vertical straight bar. (default).

View file

@ -81,28 +81,15 @@ function getSsData(variants) {
} }
function getDefaultCompData(variants) { function getDefaultCompData(variants) {
const cDefault = variants.defaultComposite;
const cSlab = variants.composites.get("slab");
return { return {
sansUpright: buildupComposite(variants, UPRIGHT, variants.defaultComposite).composition, sansUpright: buildupComposite(variants, UPRIGHT, cDefault).composition,
sansItalic: buildupComposite(variants, ITALIC, variants.defaultComposite).composition, sansItalic: buildupComposite(variants, ITALIC, cDefault).composition,
sansOblique: buildupComposite(variants, OBLIQUE, variants.defaultComposite).composition, sansOblique: buildupComposite(variants, OBLIQUE, cDefault).composition,
slabUpright: buildupComposite( slabUpright: buildupComposite(variants, UPRIGHT, cDefault, cSlab).composition,
variants, slabItalic: buildupComposite(variants, ITALIC, cDefault, cSlab).composition,
UPRIGHT, slabOblique: buildupComposite(variants, OBLIQUE, cDefault, cSlab).composition
variants.defaultComposite,
variants.composites.get("slab")
).composition,
slabItalic: buildupComposite(
variants,
ITALIC,
variants.defaultComposite,
variants.composites.get("slab")
).composition,
slabOblique: buildupComposite(
variants,
OBLIQUE,
variants.defaultComposite,
variants.composites.get("slab")
).composition
}; };
} }
@ -119,7 +106,7 @@ function buildupComposite(variants, para, ...composites) {
let hotChars = new Map(); let hotChars = new Map();
for (const composite of composites) { for (const composite of composites) {
for (const [prime, variant] of composite.decompose(para, variants.selectorTree)) { for (const [prime, variant] of composite.decompose(para, variants.selectorTree)) {
if (!prime.sampler || isLigatureSampler(prime)) continue; if (!prime.sampler) continue;
const key = getSelectorKey(prime, variant); const key = getSelectorKey(prime, variant);
for (const ch of prime.sampler) hotChars.set(ch, key); for (const ch of prime.sampler) hotChars.set(ch, key);
compositionMap.set(prime.key, variant.key); compositionMap.set(prime.key, variant.key);