Skip to content

Extension of font parameters to accomodate variable fonts for various uses eg. text / textWidth / textToPoints #4992

@karenanndonnachie

Description

@karenanndonnachie

How would this new feature help increase access to p5.js?

Most appropriate sub-area of p5.js?

  • Accessibility (Web Accessibility)
  • Build tools and processes
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Friendly error system
  • Image
  • IO (Input/Output)
  • Localization
  • Math
  • Unit Testing
  • Typography
  • Utilities
  • WebGL
  • Other (specify if possible)

Feature enhancement details:

In-built variable font support. This issue was unfortunately not fully addressed in the closed feature requests #4790 & #4511 , and actually would be a great feature extend text/typography design opportunities in p5js. The previous issue was closed with a nod to textToPoints, but the use of a variable font differs from textToPoints, although it certainly leverages the same principles (ie. the points embedded within the glyphs in .otf font files).
For example, textToPoints is fab for applying an effect, or animation, to a font, and the opportunities are endless, but it is really tricky to keep the font's intrinsic design/shape/typography letter by letter in the same way a variable font is designed to do, for example if we wanted to make text stretch to fit any given container, you can of course do this more or less successfully with textToPoints, but the downside is you are usually affecting all points at once without discretion on any given char/word/para, but this does not truly/necessarily respect the type designer's own built-in glyph-specific 'stretch options' (which can instead be mapped to the glyph's individual settings for width, weight, amount of italics, curvature, and any other number of parameters).
The request is that the parameters of variable fonts become (optionally) accessible either at the moment of font declaration, or (perhaps better yet) at the moment of a text/textwidth/textToPoints function call, as an extended/optional parameter (eg. like we can add fontSize).
Having this opportunity would allow for real-time, data-driven size, weight and shape adjustments which respects any of the pre-mapped kerning, tracking, height adjustments embedded in the font itself.
As a concrete example, with CSS, you can deploy a variable font which may be designed in a way that when it 'stretches vertically', only the ascenders are affected, or they are affected much less, or the characters get 'squarer', or the empties get bigger etc. see font playground. These parameters are often crafted by the type designer at the level of font encoding. From a p5js headspace, it's as if a series of desired textToPoints morphs/shape changes can be built/designed into the font at the level of the geometry of each specific letter.
I teach code to graphic designers, and we often struggle with type control in p5js, I believe professional typographers and graphic designers would really benefit from/enjoy this feature.
For now I have taken control of variable fonts with dom & CSS, but it is less than ideal, if anyone has ideas how this could become seamless within p5js text features, I am more than happy to help where I can.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions