Add test showing segfault when getting glyph range for Osaka#110
Closed
programmarchy wants to merge 1 commit intomapbox:masterfrom
Closed
Add test showing segfault when getting glyph range for Osaka#110programmarchy wants to merge 1 commit intomapbox:masterfrom
programmarchy wants to merge 1 commit intomapbox:masterfrom
Conversation
Contributor
|
Thanks for the test case @programmarchy, I'll probably get a chance to look at this more closely in a few days. |
Contributor
|
Proposed fix: diff --git a/src/glyphs.cpp b/src/glyphs.cpp
index 0525ff0..10400a3 100644
--- a/src/glyphs.cpp
+++ b/src/glyphs.cpp
@@ -548,10 +548,6 @@ void RenderSDF(glyph_info &glyph,
return;
}
- FT_Glyph ft_glyph = nullptr;
- ft_glyph_guard glyph_guard(&ft_glyph);
- if (FT_Get_Glyph(ft_face->glyph, &ft_glyph)) return;
-
int advance = ft_face->glyph->metrics.horiAdvance / 64;
int ascender = ft_face->size->metrics.ascender / 64;
int descender = ft_face->size->metrics.descender / 64;
@@ -572,16 +568,22 @@ void RenderSDF(glyph_info &glyph,
User user;
- // Decompose outline into bezier curves and line segments
- FT_Outline outline = ((FT_OutlineGlyph)ft_glyph)->outline;
- if (FT_Outline_Decompose(&outline, &func_interface, &user)) return;
+ if (ft_face->glyph->format == FT_GLYPH_FORMAT_OUTLINE) {
+ // Decompose outline into bezier curves and line segments
+ FT_Outline outline = ft_face->glyph->outline;
+ if (FT_Outline_Decompose(&outline, &func_interface, &user)) return;
- if (!user.ring.empty()) {
- CloseRing(user.ring);
- user.rings.push_back(user.ring);
- }
+ if (!user.ring.empty()) {
+ CloseRing(user.ring);
+ user.rings.push_back(user.ring);
+ }
- if (user.rings.empty()) return;
+ if (user.rings.empty()) {
+ return;
+ }
+ } else {
+ return;
+ }
// Calculate the real glyph bbox.
double bbox_xmin = std::numeric_limits<double>::infinity(), |
Merged
Contributor
|
Fixed in #116! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fontnik.rangesegfaults for the Osaka font included on OS XPossibly related #13?