Increasing access
The proposed change would make variable fonts in p5.js easier to learn and teach by making the feature more idiomatic, and reducing the prerequisite knowledge (see Context section below)
Most appropriate sub-area of p5.js?
Feature request details
Context
Controlling font variations currently requires manually constructing a fontVariationSettings string through textProperty().
Example today:
textProperty(
"fontVariationSettings",
`"wdth" ${wdth}, "slnt" ${slnt}, ` +
`"YOPQ" ${yopq}, "YTLC" ${ytlc}`
);
This works, but it gets verbose, and requires prior knowledge of template literals and string concatenation.
Proposal
Would it make sense to expand textProperty() so it can also set individual variable font properties directly?
For example:
textProperty("slnt", slnt);
textProperty("wdth", wdth);
textProperty("YOPQ", yopq);
Or to avoid overloading textProperty(), introduce a dedicated method:
textVariation("slnt", slnt);
textVariation("wdth", wdth);
textVariation("YOPQ", yopq);
The later might make it easier to handle non-existent axes and offer feedback like "The selected font fontName doesn't have a slant axis".
If technically feasible, it could also be useful to expose available variation settings (axes and ranges) via textProperties().
Increasing access
The proposed change would make variable fonts in p5.js easier to learn and teach by making the feature more idiomatic, and reducing the prerequisite knowledge (see Context section below)
Most appropriate sub-area of p5.js?
Feature request details
Context
Controlling font variations currently requires manually constructing a
fontVariationSettingsstring throughtextProperty().Example today:
This works, but it gets verbose, and requires prior knowledge of template literals and string concatenation.
Proposal
Would it make sense to expand
textProperty()so it can also set individual variable font properties directly?For example:
Or to avoid overloading
textProperty(), introduce a dedicated method:The later might make it easier to handle non-existent axes and offer feedback like "The selected font fontName doesn't have a slant axis".
If technically feasible, it could also be useful to expose available variation settings (axes and ranges) via
textProperties().