Work around FreeType issue with bitmap font and autohinter.
If a ttf font is bitmap only and autohinting is used and the no-bitmap flag is used FreeType may return an empty outline glyph instead of producing an error or a non-outline glyph. The way to work around this at the moment is to first check if the face supports outlines. If it does not then assume there is no outline. Bug: skia:7878 Change-Id: I8f5c394f27fb2a55a359f2bdc55f957427f334bd Reviewed-on: https://skia-review.googlesource.com/155362 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
6dcbb90025
commit
d6931bb014
@ -1350,7 +1350,8 @@ bool SkScalerContext_FreeType::generatePath(SkGlyphID glyphID, SkPath* path) {
|
||||
|
||||
SkAutoMutexAcquire ac(gFTMutex);
|
||||
|
||||
if (this->setupSize()) {
|
||||
// FT_IS_SCALABLE is documented to mean the face contains outline glyphs.
|
||||
if (!FT_IS_SCALABLE(fFace) || this->setupSize()) {
|
||||
path->reset();
|
||||
return false;
|
||||
}
|
||||
@ -1360,7 +1361,7 @@ bool SkScalerContext_FreeType::generatePath(SkGlyphID glyphID, SkPath* path) {
|
||||
flags &= ~FT_LOAD_RENDER; // don't scan convert (we just want the outline)
|
||||
|
||||
FT_Error err = FT_Load_Glyph(fFace, glyphID, flags);
|
||||
if (err != 0 || fFace->glyph->format == FT_GLYPH_FORMAT_BITMAP) {
|
||||
if (err != 0 || fFace->glyph->format != FT_GLYPH_FORMAT_OUTLINE) {
|
||||
path->reset();
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user