Skip to content

Conversation

@paddywwoof
Copy link
Contributor

the vertical offset value in _imagingft.c font_getsize() was hard coded to 0 however the functionality existed for the image area to be offset by this amount to allow text to be drawn with baselines aligned to the correct value.

font_getsize() returns a tuple ((w, h), (xoffset, yoffset)) so ImageFont line 186 needed a [0] on the end

added a method getoffset() which would need to go in the documentation. (Using docstrings in the code and sphinx would make this much easier)

the existing mechanism in _imagingft.c font_render(), I'm not sure of the circumstances that PIXEL(glyph->metrics.horiBearingY) != glyph->bitmap_top but it seemed to work fine commenting out all the calculation of 'ascender' (surely descender more appropriate) and substituting
int yy = y + im->ysize - (PIXEL(glyph->metrics.horiBearingY) + ascender);
with
int yy = y + im->ysize - glyph->metrics.bitmap.rows;
NB I didn't make this change as I am not sure of the circumstances... maybe someone else can think about this and possibly tidy it up in future.

@aclark4life aclark4life merged commit 02855a8 into python-pillow:master Sep 24, 2013
radarhere pushed a commit to radarhere/Pillow that referenced this pull request Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants