mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.23k stars 2.23k forks source link

Use font-provided metadata to determine glyph height #154

Open kkaefer opened 11 years ago

kkaefer commented 11 years ago

We currently hardcode the glyph height so that we place the line centrally on the line. We should someone deduce the offset from the font metrics (or the shaped text bbox?)

kkaefer commented 10 years ago

This needs to happen when shaping the text, and we need to include that information into the shaping result.

mikemorris commented 10 years ago

@kkaefer @ansis The glyph ascender is now added to glyph_info structs at https://github.com/mapbox/node-fontnik/blob/master/src/mapnik/text/face.cpp#L84-85 and used to offset glyph.top at https://github.com/mapbox/node-fontnik/blob/master/src/fontnik/glyphs.cpp#L87 - should this offset be removed in favor of shipping the ascender value in the protobuf?

ansis commented 10 years ago

I think so, but lets see what @kkaefer says. This would be a breaking change, right?

mikemorris commented 10 years ago

Yea, it would unfortunately be a breaking change @ansis.

kkaefer commented 10 years ago

We could do this without a breaking change; just add the ascender property as well. When reading the metrics and we don't have an ascender, we use the current algorithm, if we do have the ascender, we use to to position the font.

mikemorris commented 10 years ago

Opened a pull request enabling this with a few questions at https://github.com/mapbox/node-fontnik/pull/50 @kkaefer @ansis

mikemorris commented 10 years ago

Could this be causing https://github.com/mapbox/mapbox-gl-style-spec/issues/61 @nickidlugash?

lbud commented 7 years ago

Inadvertently closed due to some 🌳 history magic — reopening.

lucaswoj commented 7 years ago

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

kkaefer commented 7 years ago

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

lucaswoj commented 7 years ago

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