glyphon
glyphon copied to clipboard
Subpixel positioning and antialiasing
Currently we snap to the nearest pixel so kind of avoid this.
We probably want to have a strategy for handling subpixel positioning and AA generally. This can be difficult with glyphs because we might need to generate multiple glyphs for various subpixel positions.
iced
relies on subpixel positioning to properly handle scaling (e.g. DPI) without altering the layout of the application (see High-DPI, Subpixel Text Positioning, Hinting, What happens when an unstoppable bullet hits an impenetrable wall?).
It would be great if we handled subpixel positioning and accepted a scaling factor in the prepare
stage. The scaling factor would be used to scale the glyphs and the layout accordingly. In other words, the layouts would be provided in logical coordinates and the scaling factor would be used to transform them into physical (screen) coordinates.
This would allow iced
to measure text and layout everything using logical coordinates and only worry about DPI and scaling in the rendering stage, without repeating work unnecessarily (i.e. relayouting text).
glyph-brush
handles subpixel positioning and caching of glyphs by exposing configurable tolerances (1) (2). Maybe we could do something similar?