From db26adf43bf7293d1ced8a220b252d3ffb34ac22 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 9 Jul 2018 22:02:52 -0400 Subject: [PATCH 1/2] Revert "Merge pull request #11605 from anntzer/spurious-ft2font-missing-glyph-warning" This reverts commit 7684f0f5f42c1d1e3c4d1f9d79f98581f7cdb683, reversing changes made to 9324b27097811d467b857f9a6ac94e02457608e5. --- src/ft2font.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ft2font.cpp b/src/ft2font.cpp index 02f6b6ac4686..4e30da77ef46 100644 --- a/src/ft2font.cpp +++ b/src/ft2font.cpp @@ -168,7 +168,7 @@ inline double conv(long v) 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) { + if (!glyph_index) { PyErr_WarnEx(NULL, "Required glyph missing from current font.", 1); } return glyph_index; From 8256c25c3623f3d50dd11d9d7cca35c27c40ad8a Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 9 Jul 2018 22:03:22 -0400 Subject: [PATCH 2/2] Revert "Merge pull request #9175 from anntzer/warn-on-freetype-missing-glyphs" This reverts commit c8a48b8f8e376beb757373e97d1e5406e4730177, reversing changes made to 40cfdae8c4475aac55148c194207ad4997d6a357. --- src/ft2font.cpp | 17 +++-------------- src/ft2font_wrapper.cpp | 4 ++-- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/ft2font.cpp b/src/ft2font.cpp index 4e30da77ef46..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 (!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)