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

Use font-provided metadata to determine glyph baseline position #191

Open
ansis opened this issue Nov 14, 2013 · 18 comments
Open

Use font-provided metadata to determine glyph baseline position #191

ansis opened this issue Nov 14, 2013 · 18 comments

Comments

@ansis
Copy link
Contributor

ansis commented Nov 14, 2013

@kkaefer, is this something harfbuzz can produce?

Otherwise, the median bottom edge would probably be a good approximation.

@ansis ansis closed this as completed Nov 15, 2013
@kkaefer
Copy link
Member

kkaefer commented Nov 15, 2013

Why did you close this?

@ansis
Copy link
Contributor Author

ansis commented Nov 16, 2013

Not sure, reopening

@ansis ansis reopened this Nov 16, 2013
@mourner
Copy link
Member

mourner commented Jun 24, 2014

Should this move to fontserver?

@mourner mourner closed this as completed Jul 24, 2014
@mikemorris
Copy link
Contributor

@ansis Not sure if this ticket is still relevant, but Harfbuzz is not necessary (FreeType is sufficient) for getting ascender (distance from top to baseline) for a font face. I have an open PR at mapbox/node-fontnik#50 for #154 that implements this and adds it to the glyph PBF (note that all glyphs in a face have the same ascender, so the PBF structure could be optimized a bit here)

@ansis
Copy link
Contributor Author

ansis commented Jan 22, 2016

re-opening because this is still hardcoded in -js:

var yOffset = -17;

@ansis ansis reopened this Jan 22, 2016
@ansis ansis self-assigned this Jan 22, 2016
@ansis
Copy link
Contributor Author

ansis commented Jan 22, 2016

@mikemorris https://github.com/mapbox/node-fontnik/pull/50/files got merged into master but master doesn't have the ascender version?

@mikemorris mikemorris assigned mikemorris and unassigned ansis Jan 25, 2016
@mikemorris
Copy link
Contributor

@ansis Looks like we never updated the PBF spec in https://github.com/mapbox/node-fontnik/blob/master/proto/glyphs.proto, I started work on this in mapbox/node-fontnik#97 but it never got merged.

@mikemorris
Copy link
Contributor

@ansis I think there's more detail on our current implementation in #154

@lucaswoj lucaswoj changed the title calculating text baselines Use font-provided metadata to determine glyph baseline position Jul 28, 2016
bensleveritt pushed a commit to bensleveritt/mapbox-gl-js that referenced this issue Oct 24, 2016
@lbud
Copy link
Contributor

lbud commented Feb 1, 2017

Inadvertently closed due to some 🌳 history magic — reopening.

@lbud lbud reopened this Feb 1, 2017
@lucaswoj
Copy link
Contributor

Closing as stale. I haven't seen this become a practical concern yet.

@kkaefer
Copy link
Member

kkaefer commented Feb 21, 2017

Assuming that this will be subsumed by @ChrisLoer's push on fonts + harfbuzz.

@lucaswoj
Copy link
Contributor

Ah! Good point. We can keep this open to track this aspect of our text shaping work.

@nickidlugash
Copy link

@ChrisLoer @ansis @kkaefer Is this something we can move on before switching to Harfbuzz? What would it require to accomplish this? It continues to be a visible issue:

  • Text along lines are often not vertically centered (quite noticeable if the line geometry is also visible, like with road labels along roads).
  • Labels using multiple fonts (due to font fallbacks for different unicode ranges) can have vertically misaligned glyphs.
  • Vertically-oriented text along lines using multiple fonts can have awkward spacing or even overlap between glyphs.

Please let me know if there's anything I can do to help resolve this 🙏

@ChrisLoer
Copy link
Contributor

@nickidlugash I think this is something we can work on without Harfbuzz. It does unfortunately require server-side changes -- i.e. we need to get node-fontnik to send the metadata down to the client. Hopefully we can add that to the glyph PBF is a backward compatible way, and just use the baseline if it's there, otherwise fall back to our hardwired value.

@tristen
Copy link
Member

tristen commented Jul 10, 2019

Unearthing this issue as deriving this from a fonts metadata instead of using a fixed value would greatly improve labels using mixed font families.

Screen Shot 2019-07-10 at 9 44 44 AM

we need to get node-fontnik to send the metadata down to the client.

@springmeyer wanted to put this on your radar. The only related issue I saw in that project was mapbox/node-fontnik#51

@mikemorris
Copy link
Contributor

@tristen There's an abandoned PR in which I started most of the work for this at mapbox/node-fontnik#97

@springmeyer
Copy link
Contributor

👋 @tristen - If someone from @mapbox/map-design-team wants to tackle this I'd be happy to help get them up to speed on node-fontnik development. /cc @jseppi @agentpu1011 @ian29 @brsbl @philogb

@tristen
Copy link
Member

tristen commented Aug 6, 2019

Re-earthing @mikemorris's initial work in a new pr mapbox/node-fontnik#160. That should address the downstream work to enable this.

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