Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle 'frac' substitutions globally #294

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/opentype/shapers/DefaultShaper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import {isDigit} from 'unicode-properties';

const VARIATION_FEATURES = ['rvrn'];
const COMMON_FEATURES = ['ccmp', 'locl', 'rlig', 'mark', 'mkmk'];
const FRACTIONAL_FEATURES = ['frac', 'numr', 'dnom'];
// For substitution-based fractions, as often encountered in mono-spaced fonts:
const FRACTIONAL_FEATURES_GLOBAL = ['frac'];
// For contextual-based fractions, as often encountered in proportional fonts:
const FRACTIONAL_FEATURES_LOCAL = ['frac', 'numr', 'dnom'];
const HORIZONTAL_FEATURES = ['calt', 'clig', 'liga', 'rclt', 'curs', 'kern'];
const VERTICAL_FEATURES = ['vert'];
const DIRECTIONAL_FEATURES = {
Expand All @@ -27,8 +30,12 @@ export default class DefaultShaper {

static planPreprocessing(plan) {
plan.add({
global: [...VARIATION_FEATURES, ...DIRECTIONAL_FEATURES[plan.direction]],
local: FRACTIONAL_FEATURES
global: [
...VARIATION_FEATURES,
...DIRECTIONAL_FEATURES[plan.direction],
...FRACTIONAL_FEATURES_GLOBAL
],
local: FRACTIONAL_FEATURES_LOCAL
});
}

Expand Down