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

Subpixel positioning and antialiasing #3

Closed
grovesNL opened this issue May 10, 2022 · 1 comment · Fixed by #45
Closed

Subpixel positioning and antialiasing #3

grovesNL opened this issue May 10, 2022 · 1 comment · Fixed by #45

Comments

@grovesNL
Copy link
Owner

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.

@hecrj
Copy link
Sponsor Contributor

hecrj commented May 25, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants