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

Respect accessibility font scale #3057

Open
westnordost opened this issue Nov 28, 2024 · 2 comments
Open

Respect accessibility font scale #3057

westnordost opened this issue Nov 28, 2024 · 2 comments

Comments

@westnordost
Copy link
Collaborator

westnordost commented Nov 28, 2024

Operating systems generally offer a system-wide font-scaling setting for accessibility.
MapLibre should respect this setting and scale fonts with this value, just as it respects the device's display density.

UI.mp4

Use case

When I have bad eyes or generally just a display that displays text too small, I want the accessibility setting to apply to all text in all apps.

Solution I'd like

  • multiply the resulting font size by the system font-scaling
  • update documentation

Alternatives I've considered

It is possible to implement this oneself as a developer by iterating through all symbol layers with text and change the font size by multiplying it oneself. But this is awkward and complex especially when the font size is an expression and needs to be done by developers of every app that uses MapLibre, so support for this, at best, would forever be spotty.

Additional context

The Google Maps SDK does correctly scale all text by the system-wide font-scaling setting.

The MapBox SDK does not.

For Android, the setting can be found in Configuration::fontScale

For iOS, the information seems to be in UIFontMetrics.

@louwers
Copy link
Collaborator

louwers commented Nov 28, 2024

I think it's a good idea to implement this, but we should probably make it opt-in to be backwards compatible.

Note: Please do not use this to hardcode font size equations. The equation for font scaling is now non-linear; this coefficient is no longer used as a direct multiplier to determine font size. It exists for informational purposes only.

@sargunv
Copy link
Collaborator

sargunv commented Dec 18, 2024

Thinking about how it should be implemented:

There are probably use cases where one would want a particular symbol or other layer to scale with text (for example: rendering text on top of a symbol). And perhaps cases where I want some text (labels) to respect the setting but other text (decorative) to not. So perhaps ["system-font-scale"] should be available to use in expressions? and then a "text-font-scale" parameter in SymbolLayer that is multiplied with "text-size" to determine the scaled text size. It would default to 1 initially and to ["system-font-scale"] after a major version bump.

Unsure how the JS SDK could/should handle these style spec changes.

I think it's a good idea to implement this, but we should probably make it opt-in to be backwards compatible.

Longer term (after a major version bump) I think making it opt-out is preferable, so apps using MapLibre are more accessible by default.

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

No branches or pull requests

3 participants