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

Dropped variable fonts should react to global axis sliders #1040

Merged
merged 8 commits into from
Jan 5, 2024
14 changes: 14 additions & 0 deletions src/fontra/views/editor/panel-reference-font.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,20 @@ export default class ReferenceFontPanel extends Panel {
this.requestReferenceFontsPreview();
}
);

editorController.sceneSettingsController.addKeyListener("location", () => {
const fontVariationSettings = [];
for (const axis of this.editorController.fontController.globalAxes) {
fontVariationSettings.push(
`'${axis.tag}' ${this.editorController.sceneSettings.location[axis.tag]}`
justvanrossum marked this conversation as resolved.
Show resolved Hide resolved
);
}
const buildFontVariablesCssString = fontVariationSettings.join(",");
justvanrossum marked this conversation as resolved.
Show resolved Hide resolved
this.contentElement.style.fontVariationSettings = buildFontVariablesCssString;
this.editorController.canvasController.canvas.style.fontVariationSettings =
buildFontVariablesCssString;
this.editorController.canvasController.requestUpdate();
});
}

async requestReferenceFontsPreview() {
Expand Down