-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
How are text fields with different font scales aligned? #8484
Comments
Baseline alignment doesn't occur because mapbox-gl-js doesn't receive glyph metrics (#191) and the value is hardcoded so it's not modifiable (#191 (comment)). We're looking at reprioritizing #191 and plan to start working on it soon. Once that's unblocked, it would be valuable to expose a property that enables customization of "text-alignment" within a single formatted expression. |
I think it's ok to close this as essentially a duplicate of #191 so we can keep all comments and work on the feature in that issue |
I'm ok with closing this ticket since the OP wasn't only about controlling the alignment and didn't propose implementation options, but I do think designing a new
I'm thinking inputs would probably be |
This isn't an issue I'm super familiar with yet but wouldn't |
Yeah, #191 is definitely a blocker for this proposed feature. But that ticket is about replacing the hardcoded value mapbox-gl-js/js/symbol/shaping.js Line 33 in ec62ab8
|
Ah got it. I'll open a new ticket to track that |
mapbox-gl-js version: 0.52.0
Question
How does Mapbox align formatted strings?
When using multiple font scales in a text field, I would have hoped that the baselines get aligned but that is not what happens (see images below). I could imagine that the bottoms of the letters get aligned but then the smaller text would always be rendered below the bigger text, which is also not the case. So how does it actually work and how can I control the alignment?
When rendering this formatted text field
I get these outputs:
Helvetica-neue light (smaller text rendered below the baseline):
![Screenshot 2019-07-16 at 11 12 46](https://user-images.githubusercontent.com/9002093/61277918-cf4a8080-a7bb-11e9-8f07-727ea96cf15b.png)
Noto-sans light (smaller text rendered above the baseline):
![Screenshot 2019-07-16 at 11 13 27](https://user-images.githubusercontent.com/9002093/61277919-cfe31700-a7bb-11e9-8f2a-613fee044035.png)
Links to related documentation
https://docs.mapbox.com/mapbox-gl-js/style-spec/#types-formatted
The text was updated successfully, but these errors were encountered: