Honor more OpenType features

This commit is contained in:
Antonio Scandurra 2023-03-17 13:29:58 +01:00
parent 9181ac9872
commit f9d793cb4a
4 changed files with 500 additions and 134 deletions

View file

@ -98,11 +98,78 @@ export interface TextProperties {
weight?: FontWeight
underline?: boolean
color?: string,
features?: TextFeatures,
features?: FontFeatures,
}
interface TextFeatures {
calt?: boolean
interface FontFeatures {
/** Contextual Alternates: Applies a second substitution feature based on a match of a character pattern within a context of surrounding patterns */
calt?: boolean;
/** Case-Sensitive Forms: Shifts various punctuation marks up to a position that works better with all-capital sequences */
case?: boolean;
/** Capital Spacing: Adjusts inter-glyph spacing for all-capital text */
cpsp?: boolean;
/** Fractions: Replaces figures separated by a slash with diagonal fractions */
frac?: boolean;
/** Standard Ligatures: Replaces a sequence of glyphs with a single glyph which is preferred for typographic purposes */
liga?: boolean;
/** Oldstyle Figures: Changes selected figures from the default or lining style to oldstyle form. */
onum?: boolean;
/** Ordinals: Replaces default alphabetic glyphs with the corresponding ordinal forms for use after figures */
ordn?: boolean;
/** Proportional Figures: Replaces figure glyphs set on uniform (tabular) widths with corresponding glyphs set on proportional widths */
pnum?: boolean;
/** Stylistic set 01 */
ss01?: boolean;
/** Stylistic set 02 */
ss02?: boolean;
/** Stylistic set 03 */
ss03?: boolean;
/** Stylistic set 04 */
ss04?: boolean;
/** Stylistic set 05 */
ss05?: boolean;
/** Stylistic set 06 */
ss06?: boolean;
/** Stylistic set 07 */
ss07?: boolean;
/** Stylistic set 08 */
ss08?: boolean;
/** Stylistic set 09 */
ss09?: boolean;
/** Stylistic set 10 */
ss10?: boolean;
/** Stylistic set 11 */
ss11?: boolean;
/** Stylistic set 12 */
ss12?: boolean;
/** Stylistic set 13 */
ss13?: boolean;
/** Stylistic set 14 */
ss14?: boolean;
/** Stylistic set 15 */
ss15?: boolean;
/** Stylistic set 16 */
ss16?: boolean;
/** Stylistic set 17 */
ss17?: boolean;
/** Stylistic set 18 */
ss18?: boolean;
/** Stylistic set 19 */
ss19?: boolean;
/** Stylistic set 20 */
ss20?: boolean;
/** Subscript: Replaces default glyphs with subscript glyphs */
subs?: boolean;
/** Superscript: Replaces default glyphs with superscript glyphs */
sups?: boolean;
/** Swash: Replaces default glyphs with swash glyphs for stylistic purposes */
swsh?: boolean;
/** Titling: Replaces default glyphs with titling glyphs for use in large-size settings */
titl?: boolean;
/** Tabular Figures: Replaces figure glyphs set on proportional widths with corresponding glyphs set on uniform (tabular) widths */
tnum?: boolean;
/** Slashed Zero: Replaces default zero with a slashed zero for better distinction between "0" and "O" */
zero?: boolean;
}
export function text(