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 = 'low'`, `cv47 = 2`: Lower circumflex `^`.
- 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.
- Styles for `{`, `}`:
+ `brace = 'straight'`, `cv49 = 1`: More straight braces.
+ `brace = 'curly'`, `cv49 = 2`: More curly braces.
+ `brace = 'curly'`, `cv49 = 2`: More curly braces (default).
- Styles for `#`:
+ `number-sign = 'upright'`, `cv50 = 1`: Number sign with vertical bars (default).
+ `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 = 'force-upright'`, `cv55 = 2`: Bar punctuations (`|`) is forced upright under italics and oblique.
- 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.
- Styles for `'`:
+ `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) {
const cDefault = variants.defaultComposite;
const cSlab = variants.composites.get("slab");
return {
sansUpright: buildupComposite(variants, UPRIGHT, variants.defaultComposite).composition,
sansItalic: buildupComposite(variants, ITALIC, variants.defaultComposite).composition,
sansOblique: buildupComposite(variants, OBLIQUE, variants.defaultComposite).composition,
slabUpright: buildupComposite(
variants,
UPRIGHT,
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
sansUpright: buildupComposite(variants, UPRIGHT, cDefault).composition,
sansItalic: buildupComposite(variants, ITALIC, cDefault).composition,
sansOblique: buildupComposite(variants, OBLIQUE, cDefault).composition,
slabUpright: buildupComposite(variants, UPRIGHT, cDefault, cSlab).composition,
slabItalic: buildupComposite(variants, ITALIC, cDefault, cSlab).composition,
slabOblique: buildupComposite(variants, OBLIQUE, cDefault, cSlab).composition
};
}
@ -119,7 +106,7 @@ function buildupComposite(variants, para, ...composites) {
let hotChars = new Map();
for (const composite of composites) {
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);
for (const ch of prime.sampler) hotChars.set(ch, key);
compositionMap.set(prime.key, variant.key);