Draft
Conversation
Fix center of rotation with rotation_mode='anchor'
Glyph indices are specific to each font. It does not make sense to fall back based on glyph index to another font. This could only really be populated by calling `FT2Font.set_text`, but even that was fragile. If a fallback font was used for a character with the same glyph index as a previous character in the main font, then these lookups could be overwritten to the fallback instead of the main font, with a completely different character! Fortunately, nothing actually uses or requires a fallback through glyph indices.
Remove ttconv backwards-compatibility code
Remove fallback code for glyph indices
045897c to
e4be26c
Compare
e4be26c to
2b3f5c5
Compare
Member
Author
|
Also, if you would like to follow along with the figure changes, I've posted a branch that does the changes per merge commit: https://github.com/QuLogic/matplotlib/tree/text-overhaul-figures-per-commit |
1 task
This allows checking that there are no _new_ failures, without committing the new figures to the repo until the branch is complete.
ci: Preload existing test images from text-overhaul-figures branch
Also, check some expected conditions at parse time instead of somewhere during use of the data.
ci: Fix image preload with multiple conflicts
Add typing to AFM parser
2b3f5c5 to
b17bef1
Compare
…x_empty ENH: Ignore empty text for tightbbox
Drop axis_artist tickdir image compat, due to text-overhaul merge.
…latform name A TTF/OTF file can advertise its family name in multiple places in the SFNT name table. FreeType exposes the primary name (usually from the Macintosh-platform Name ID 1 slot), but other entries may carry different (equally valid) names that users reasonably expect to work: - Name ID 1 on the other platform (e.g. Ubuntu Light stores "Ubuntu" in the Mac slot and "Ubuntu Light" in the Microsoft slot) - Name ID 16 — Typographic/Preferred Family - Name ID 21 — WWS Family
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
This is minimally different from the `x` measurement, but technically more correct. We still do the measurement for fonts we don't ship, but that may change with Unicode Math fonts in the future.
This follows from CSS' default for line height. At the moment, the behaviour has not been changed, and still just falls back to 1.2 for 'normal'.
We follow the process from [the CSS Inline Layout module](https://www.w3.org/TR/css-inline-3/), specifically: 1. The default ascent and descent come from the `OS/2` font table, or failing that, the `hhea` table, with final fallback to the measurement we used to do. 2. If `linespacing` (cf line height in CSS) is normal, then we do as before and size each line based on the maximum ascent/descent of its contents. Additionally, apply the line gap from the font metrics as half-leading around each line. 3. If `linespacing` is a float, then scale it by font size of the first available font, and keep it fixed for each line. However, if we are drawing a single line, then we do not add the line gap around the line, to keep them a similar height as before.
text: Use font metrics to determine line heights
TST: Remove redundant font tests
When outputting files using the "core 14 fonts" (e.g., `rcParams['pdf.use14corefonts'] = True`), text will be measured using our internal AFM files instead of any external files. While we don't have a full API decided for how to pass full `Text` objects through backends, add in a small internal helper to allow the PS/PDF backends to override font height metrics with the AFM files.
The tolerances on these were increased in various PRs, with notes to reduce/remove them, so they were removed in matplotlib#30184, but should have been reverted to a smaller value: - `test_floating_axes.py::test_curvelinear4[png]` fails on macOS - `test_grid_helper_curvelinear.py::test_axis_direction[png]` fails on ARM and macOS - `test_grid_helper_curvelinear.py::test_polar_box[png]` fails on Windows, ARM, and macOS These fail on macOS; there's tolerances on them already, they fail by just a small amount, so increase them: - `test_bbox_tight.py::test_bbox_inches_tight_suptile_legend[png]` - `test_patheffects.py::test_collection[png]` - `test_axes3d.py::test_scale3d_artists_log[png]` This fails only on AppVeyor (Windows), but not Azure. There is a tolerance there already, so just add it to the list: - `test_mathtext.py::test_mathtext_rendering`
This is currently causing warnings at runtime in the editable install, which breaks almost all tests.
TST: Restore some tolerances for some arch/platform-specific failures
This incorporates our patch, so we can drop it, and adds `tests` option, which we now disable.
…names ENH: Allow fonts to be addressed by any of their SFNT family names
BLD: Update bundled libraqm to 0.10.4
* BLD: Update bundled FreeType to 2.14.3 These releases mostly consist of security fixes. * BLD: adjust upstream url for freetype to nongnu savanah mirror Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --------- Co-authored-by: Thomas A Caswell <tcaswell@gmail.com> Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
- Port FreeType symbol visibility patch to 2.14.1 - Add test image preloading to wasm CI workflow - Temporarily disable testing `test_complex_shaping`, which triggers some code path that fails somehow
This test requires a subprocess call, so should be skipped like the others.
Unfortunately, this was missed in matplotlib#31407.
These tests had previously kept some code or settings to prevent regenerating the test image, but since they are now going to be regenerated from the text overhaul, we can remove those.
TST: Cleanup back-compat code in tests touched by text overhaul
Fix FreeType runtime version check
Make it clearer that switches are only over 3 possible fonttypes (1, 3, 42). In draw_text, the logic is easier to follow if one directly switches over rcParams['pdf.use14corefonts']; this requires putting the url handling at the end, which doesn't matter.
Clarify fonttype switch in backend_pdf.
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.
PR summary
This PR is intended to hold all font and text PRs from the project Font and text overhaul
In order to not overwhelm the main repo with the churn of test image replacements, this PR comes from my fork and should only ever have 1 commit more than the text-overhaul branch with the changes to test images.
PR checklist