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

Skip to content

Commit 553a395

Browse files
authored
Merge pull request #11615 from tacaswell/revert_glyph_warnings
Revert glyph warnings
2 parents 63d446f + 8256c25 commit 553a395

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

src/ft2font.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,9 @@ FT2Image::draw_rect_filled(unsigned long x0, unsigned long y0, unsigned long x1,
162162

163163
inline double conv(long v)
164164
{
165-
return v / 64.;
165+
return double(v) / 64.0;
166166
}
167167

168-
FT_UInt ft_get_char_index_or_warn(FT_Face face, FT_ULong charcode)
169-
{
170-
FT_UInt glyph_index = FT_Get_Char_Index(face, charcode);
171-
if (charcode && !glyph_index) {
172-
PyErr_WarnEx(NULL, "Required glyph missing from current font.", 1);
173-
}
174-
return glyph_index;
175-
}
176-
177-
178168
int FT2Font::get_path_count()
179169
{
180170
// get the glyph as a path, a list of (COMMAND, *args) as described in matplotlib.path
@@ -621,7 +611,7 @@ void FT2Font::set_text(
621611
FT_BBox glyph_bbox;
622612
FT_Pos last_advance;
623613

624-
glyph_index = ft_get_char_index_or_warn(face, codepoints[n]);
614+
glyph_index = FT_Get_Char_Index(face, codepoints[n]);
625615

626616
// retrieve kerning distance and move pen position
627617
if (use_kerning && previous && glyph_index) {
@@ -674,8 +664,7 @@ void FT2Font::set_text(
674664

675665
void FT2Font::load_char(long charcode, FT_Int32 flags)
676666
{
677-
FT_UInt glyph_index = ft_get_char_index_or_warn(face, (FT_ULong)charcode);
678-
int error = FT_Load_Glyph(face, glyph_index, flags);
667+
int error = FT_Load_Char(face, (unsigned long)charcode, flags);
679668

680669
if (error) {
681670
throw std::runtime_error("Could not load charcode");

src/ft2font_wrapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,8 +998,8 @@ static PyObject *PyFT2Font_get_char_index(PyFT2Font *self, PyObject *args, PyObj
998998
const char *PyFT2Font_get_sfnt__doc__ =
999999
"get_sfnt(name)\n"
10001000
"\n"
1001-
"Get all values from the SFNT names table. Result is a dictionary whose "
1002-
"key is the platform-ID, ISO-encoding-scheme, language-code, and "
1001+
"Get all values from the SFNT names table. Result is a dictionary whose"
1002+
"key is the platform-ID, ISO-encoding-scheme, language-code, and"
10031003
"description.\n";
10041004

10051005
static PyObject *PyFT2Font_get_sfnt(PyFT2Font *self, PyObject *args, PyObject *kwds)

0 commit comments

Comments
 (0)