-
Notifications
You must be signed in to change notification settings - Fork 65
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
Expose ascender/descender metadata properties in protobuf #160
base: master
Are you sure you want to change the base?
Conversation
Pull what's applicable from #97 into this commit.
The branch is passing now on travis since I fixed this minor issue (#161) and merged that fix into this branch. The next steps I see for this work are:
|
src/glyphs.cpp
Outdated
@@ -315,6 +315,8 @@ void RangeAsync(uv_work_t* req) { | |||
} | |||
|
|||
mutable_fontstack->set_range(std::to_string(baton->start) + "-" + std::to_string(baton->end)); | |||
mutable_fontstack->set_ascender(ft_face->ascender); | |||
mutable_fontstack->set_descender(ft_face->descender); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I am currently testing the generated glyphs from this pr in MBGL, I am trying to fix the dis-alignment of texts with mixed fonts (Noto Sans CJK and Arial Unicode MS Regular). In order to fix it, I need to shift back the top
value in the metrics in MBGL. Since the top
value was generated from:
double top = static_cast<double>(glyph.top) - glyph.ascender;
In order to do so, I need the ascender
in the metrics to be 26.6 pixel format instead of unscaled font units.
So I think ascender
and descender
are better to be set from ft_face->size->metrics.ascender
and ft_face->size->metrics.descender
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 @zmiao excited to learn you are digging into this work!
So I think
ascender
anddescender
are better to be set fromft_face->size-metrics.ascender
andft_face->size->metrics.descender
.
Feel free to make those modifications to this pull request if that's more accurate!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tristen thanks for the reply, I updated this pr.
Some experimenting rendering results after applying the
Next step for testing would be trying to figure out how to deal with issues in mapbox/mapbox-gl-js#8560 |
@tristen @springmeyer Lines 297 to 310 in d65c204
font-face mean? Does it imply a new font type?
I am confused because that I tried to use the executable |
👋 @zmiao thanks for asking. This was also a confusion for me when I first considered .ttc behavior. My understanding is this:
A little bit of this history is evident in #125 So, overall, to support ttc would need someone to comprehensively test and perhaps fix issues in the entire dependency chain: node-fontnik -> fontmachine -> core-fonts -> api-styles -> mapbox-gl. Because several of those repos are private, if you have questions about them it would make most sense to discuss more in tickets at those repos. |
@springmeyer Thanks for the explanation, it is really helpful. So based on your comments, right now we do not support generating pbf from multi-face ttc, but the weird thing is if I upload the ttc file via MapboxStudio, I could get multiple fonts, how did it work? I assume MapboxStudio uses the same node-fontnik engine, right? |
Interesting @zmiao - I would have assumed you'd get an error due to this line: https://github.com/mapbox/fontmachine/blob/0e5eaab3fd99153083f08278d7a55792d2b6f3ce/index.js#L32
Yes, the backend of Mapbox Studio uses node-fontnik@0.5.3 |
@springmeyer It was my bad. Actually for my case, I uploaded one otf file, but I got two fonts without any error prompt, I am wondering why it works? And also if I use |
Hi all, this has been stalled for a while. Do we have plans to merge it? |
Pull what's applicable from #97 into this commit.