-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Account for character descenders in text-radial-offset #8560
Comments
@tristen Are you proposing that the array takes only 2 values - This would be very confusing to document and explain. For example, when What if instead auto justification took into account the full height of symbols so that it anchors to the bottom of glyhps before adding the |
Good point.
👍 |
Yes this is needed. One way to do this without confusion is to have the 'text-radial-offset' array contain either exactly two or four elements:
This way 'text-variable-anchor' could be changed without any trouble.
I agree this would be a far more elegant and desirable solution if it is possible. |
I believe the underlying problem is that many of the fonts themselves to not seem to be properly vertically centered. While some fonts such as the default DIN Offc Pro and Open Sans seems to be properly centered, others such as Ubuntu and Lato seem to be higher than center. If for example the offset is set based off of either a default top or bottom anchor location, all of the other anchor locations will have incorrect spacing. Perhaps there should be no need for this feature if font centering is fixed? #191 |
At the moment radial offset does not consider if the placed label has symbols with descent or ascent. We (@alexshalamov and myself) believe that the desired behavior shall be the following:
|
Unfortunately, ascent and descent are not available as part of |
Maybe there is no need to account for actually rendered character descenders and ascenders. A person viewing a map might expect for all text to have the same offset, regardless of the presence of descenders or ascenders. It's then just a matter of making sure that font itself is vertically centered so that the different label positions present a uniform offset. #191 However if the label is in all "UPPER CASE" then there might need to be another style option to account for that as that is a different case compared to "Title Case" and "lower case". |
IMO it might affect the rendering of labels that do not have descenders and ascenders. Pls consider
|
Wow those are very helpful illustrations, thank you @pozdnyakov. With whatever you come up with I'm sure it will be very good. I imagine it will just require a bunch of experimentation and tests as you go along to see whatever looks the best, so no point in me trying to imagine potential solutions. For us anyway it's not a major issue, the biggest potential problem we have is that some fonts themselves (including ones I've uploaded) are not vertically centered and so don't work well with text-variable-anchor at the moment. |
@pozdnyakov Thanks for the clear illustrations. I do think that the best way to address this is to consider ascenders and descenders when computing the baseline before applying Looks like there has been recent interest in #191 (comment), which would help solve not only this issue, but many other baseline-alignment related bugs as well. I'd be in favor of helping that effort be pushed along to unblock the fix for this ticket. What do you think? cc @ansis |
Is there an issue for it? My guess is that this problem is caused by missing font meta-data, in particular a more accurate estimation of the glyph offset position, so fixing of #191 looks crucial for solving this problem. |
Sounds to me like #191 is crucial for solving this problem for some fonts, no? If we’re interested in helping unblock this work, we should coordinate with @tristen who would appreciate it. @tristen and @springmeyer have begun pairing on #191. Please note, both @tristen and I consider #8527 higher priority (per the |
Motivation
Like
text-offset
that accepts number or an array of two numbers that adjusts thex
andy
coordinates, it would be great iftext-radial-offset
allowed the same functionality. That would account for the extra distance top positioned labels need for characters with descenders (i.eg, p, q
):Design Alternatives
Not provide
top
as a list of possible positions totext-variable-anchor
but that's a little limiting.Design
The text was updated successfully, but these errors were encountered: