vertical alignment of ttf draw.text() plus fallback alpha 255 where only rgb specified#331
Merged
aclark4life merged 2 commits intopython-pillow:masterfrom Sep 24, 2013
paddywwoof:master
Merged
vertical alignment of ttf draw.text() plus fallback alpha 255 where only rgb specified#331aclark4life merged 2 commits intopython-pillow:masterfrom paddywwoof:master
aclark4life merged 2 commits intopython-pillow:masterfrom
paddywwoof:master
Conversation
radarhere
pushed a commit
to radarhere/Pillow
that referenced
this pull request
Sep 24, 2023
Updated xz to 5.2.7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.