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

Skip to content

Rename/change signature of PyGlyph_new. #23364

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 1 commit into from
Jun 29, 2022
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
10 changes: 5 additions & 5 deletions src/ft2font.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,27 @@ class FT2Font
long get_name_index(char *name);
PyObject* get_path();

FT_Face &get_face()
FT_Face const &get_face() const
{
return face;
}
FT2Image &get_image()
{
return image;
}
FT_Glyph &get_last_glyph()
FT_Glyph const &get_last_glyph() const
{
return glyphs.back();
}
size_t get_last_glyph_index()
size_t get_last_glyph_index() const
{
return glyphs.size() - 1;
}
size_t get_num_glyphs()
size_t get_num_glyphs() const
{
return glyphs.size();
}
long get_hinting_factor()
long get_hinting_factor() const
{
return hinting_factor;
}
Expand Down
17 changes: 8 additions & 9 deletions src/ft2font_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,13 @@ typedef struct
static PyTypeObject PyGlyphType;

static PyObject *
PyGlyph_new(const FT_Face &face, const FT_Glyph &glyph, size_t ind, long hinting_factor)
PyGlyph_from_FT2Font(const FT2Font *font)
{
const FT_Face &face = font->get_face();
const FT_Glyph &glyph = font->get_last_glyph();
size_t ind = font->get_last_glyph_index();
long hinting_factor = font->get_hinting_factor();

PyGlyph *self;
self = (PyGlyph *)PyGlyphType.tp_alloc(&PyGlyphType, 0);

Expand Down Expand Up @@ -625,10 +630,7 @@ static PyObject *PyFT2Font_load_char(PyFT2Font *self, PyObject *args, PyObject *

CALL_CPP("load_char", (self->x->load_char(charcode, flags)));

return PyGlyph_new(self->x->get_face(),
self->x->get_last_glyph(),
self->x->get_last_glyph_index(),
self->x->get_hinting_factor());
return PyGlyph_from_FT2Font(self->x);
}

const char *PyFT2Font_load_glyph__doc__ =
Expand Down Expand Up @@ -664,10 +666,7 @@ static PyObject *PyFT2Font_load_glyph(PyFT2Font *self, PyObject *args, PyObject

CALL_CPP("load_glyph", (self->x->load_glyph(glyph_index, flags)));

return PyGlyph_new(self->x->get_face(),
self->x->get_last_glyph(),
self->x->get_last_glyph_index(),
self->x->get_hinting_factor());
return PyGlyph_from_FT2Font(self->x);
}

const char *PyFT2Font_get_width_height__doc__ =
Expand Down