Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10bf587

Browse files
committed
Merge pull request #1710 from mdboom/font_with_no_glyph_names
Mixing Arial with mathtext on Windows 8 fails
2 parents 7147317 + d5710a4 commit 10bf587

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/ft2font.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,15 +1616,17 @@ FT2Font::get_glyph_name(const Py::Tuple & args)
16161616
_VERBOSE("FT2Font::get_glyph_name");
16171617
args.verify_length(1);
16181618

1619-
if (!FT_HAS_GLYPH_NAMES(face))
1620-
{
1621-
throw Py::RuntimeError("Face has no glyph names");
1622-
}
1623-
16241619
char buffer[128];
1625-
if (FT_Get_Glyph_Name(face, (FT_UInt) (unsigned long)Py::Int(args[0]), buffer, 128))
1620+
FT_UInt glyph_number = (FT_UInt)(unsigned long long)Py::Int(args[0]);
1621+
1622+
if (!FT_HAS_GLYPH_NAMES(face))
16261623
{
1627-
throw Py::RuntimeError("Could not get glyph names.");
1624+
snprintf(buffer, 128, "uni%04x", glyph_number);
1625+
} else {
1626+
if (FT_Get_Glyph_Name(face, glyph_number, buffer, 128))
1627+
{
1628+
throw Py::RuntimeError("Could not get glyph names.");
1629+
}
16281630
}
16291631
return Py::String(buffer);
16301632
}

0 commit comments

Comments
 (0)