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

Skip to content

Revert glyph warnings #11615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions src/ft2font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions src/ft2font_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down