Implement anchor for TrueType fonts#4930
Merged
hugovk merged 8 commits intopython-pillow:masterfrom Oct 5, 2020
Merged
Conversation
6 tasks
Co-authored-by: Hugo van Kemenade <[email protected]>
hugovk
approved these changes
Oct 1, 2020
| Horizontal anchor alignment | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| ``l`` --- left |
Member
There was a problem hiding this comment.
Nit: and for these triple dashes?
Contributor
Author
There was a problem hiding this comment.
- A colon or shorter dash made the description too close and a little harder to read.
- According to most style guides, the em-dash is an alternative to the colon, see https://en.wikipedia.org/wiki/Dash#Usage_2
(side note: -- is an en-dash and --- is an em-dash with Sphinx by default: https://www.sphinx-doc.org/en/master/usage/configuration.html?highlight=em-dash#confval-smartquotes_action)
Co-authored-by: Hugo van Kemenade <[email protected]>
nulano
commented
Oct 4, 2020
Comment on lines
+378
to
+379
| if direction == "ttb": | ||
| raise ValueError("ttb direction is unsupported for multiline text") |
Contributor
Author
There was a problem hiding this comment.
Forgot to mention: I didn't implement anchor handling for vertical multiline text due to #4945, so instead this raises an error to avoid confusion due to unexpected anchor values.
hugovk
approved these changes
Oct 4, 2020
Merged
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.
Second part of #4724, implementing anchor parameter to fix #4511.
Changes proposed in this pull request:
Implement
anchorparameter for text positioning.See proposed documentation for details: https://pillow--4930.org.readthedocs.build/en/4930/handbook/text-anchors.html
Add tests for Vertical text alignment ignores yOffset #4553 and related issues (fixed in Refactor font_getsize and font_render #4910). Closes Vertical text alignment ignores yOffset #4553.
Remove the additional offset caused by stroking text.
This was incompatible with the anchor implementation and I believe it to be a bug; I don't think users should need to offset text just to stroke a single word in the middle of a line.