diff --git a/src/ft2font.cpp b/src/ft2font.cpp index 02f6b6ac4686..ef622b2e9cac 100644 --- a/src/ft2font.cpp +++ b/src/ft2font.cpp @@ -162,19 +162,9 @@ FT2Image::draw_rect_filled(unsigned long x0, unsigned long y0, unsigned long x1, inline double conv(long v) { - return v / 64.; + return double(v) / 64.0; } -FT_UInt ft_get_char_index_or_warn(FT_Face face, FT_ULong charcode) -{ - FT_UInt glyph_index = FT_Get_Char_Index(face, charcode); - if (charcode && !glyph_index) { - PyErr_WarnEx(NULL, "Required glyph missing from current font.", 1); - } - return glyph_index; -} - - int FT2Font::get_path_count() { // get the glyph as a path, a list of (COMMAND, *args) as described in matplotlib.path @@ -621,7 +611,7 @@ void FT2Font::set_text( FT_BBox glyph_bbox; FT_Pos last_advance; - glyph_index = ft_get_char_index_or_warn(face, codepoints[n]); + glyph_index = FT_Get_Char_Index(face, codepoints[n]); // retrieve kerning distance and move pen position if (use_kerning && previous && glyph_index) { @@ -674,8 +664,7 @@ void FT2Font::set_text( void FT2Font::load_char(long charcode, FT_Int32 flags) { - FT_UInt glyph_index = ft_get_char_index_or_warn(face, (FT_ULong)charcode); - int error = FT_Load_Glyph(face, glyph_index, flags); + int error = FT_Load_Char(face, (unsigned long)charcode, flags); if (error) { throw std::runtime_error("Could not load charcode"); diff --git a/src/ft2font_wrapper.cpp b/src/ft2font_wrapper.cpp index 3ebaffffb9d2..a90c7b115e0e 100644 --- a/src/ft2font_wrapper.cpp +++ b/src/ft2font_wrapper.cpp @@ -998,8 +998,8 @@ static PyObject *PyFT2Font_get_char_index(PyFT2Font *self, PyObject *args, PyObj const char *PyFT2Font_get_sfnt__doc__ = "get_sfnt(name)\n" "\n" - "Get all values from the SFNT names table. Result is a dictionary whose " - "key is the platform-ID, ISO-encoding-scheme, language-code, and " + "Get all values from the SFNT names table. Result is a dictionary whose" + "key is the platform-ID, ISO-encoding-scheme, language-code, and" "description.\n"; static PyObject *PyFT2Font_get_sfnt(PyFT2Font *self, PyObject *args, PyObject *kwds)