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

Skip to content

Fix glyph sizing in textpath. #14159

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented May 7, 2019

PR Summary

Scaling by dvifont.size / self.FONT_SCALE resulted in way to small
glyphs for many fonts.

Closes the "bad size" part of #12928 / #14146 (comment).
This goes on top of #14156 even though they are technically independent as both are needed to fix (I think) #14156.

Setting the later scaling of 1 should be equivalent (modulo hinting, which is likely better?) to the solution in #12928 (comment), which increased the font size to compensate for the later scaling.

Closes #8068.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

mpl.rcParams['svg.fonttype'] = 'none'
# Use Computer Modern Sans Serif, not Helvetica (which has no \textwon).
mpl.style.use('default')
plt.figtext(.5, .5, r'\textdegree', usetex=True)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I intentionally chose this character with a simple outline to make the svg as small as possible :))

Scaling by dvifont.size / self.FONT_SCALE resulted in way to small
glyphs for many fonts.
@timhoffm
Copy link
Member

I don't see a clear effect, but that's also because dvifont.size / self.FONT_SCALE = 99.6 / 100 on my system. Can I resonably modify them to check that one should actually use 1 and not this ratio?

Also, is it correct that

size = fontsize / self.FONT_SCALE
still uses the ratio?

@anntzer
Copy link
Contributor Author

anntzer commented Jul 22, 2019

Hum, looks like this depends on some details of your tex install, in particular I can't repro this anymore "as is" with texlive 2019; OTOH one can still see the issue with

import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
plt.figure().text(.5, .5, r'\LARGE ff\textwon')  # force LARGE font
plt.savefig('/tmp/plot.svg')
plt.show()

but this shows that even setting the size to 1 is not sufficient to fix the problem (even though it does improve the situation).

@tacaswell tacaswell modified the milestones: v3.2.0, v3.3.0 Aug 28, 2019
@QuLogic QuLogic modified the milestones: v3.3.0, v3.4.0 May 2, 2020
@QuLogic QuLogic modified the milestones: v3.4.0, v3.5.0 Jan 21, 2021
@jklymak jklymak marked this pull request as draft April 23, 2021 16:35
@QuLogic QuLogic modified the milestones: v3.5.0, v3.6.0 Aug 23, 2021
@timhoffm timhoffm modified the milestones: v3.6.0, unassigned Apr 30, 2022
@story645 story645 modified the milestones: unassigned, needs sorting Oct 6, 2022
@github-actions
Copy link

Since this Pull Request has not been updated in 60 days, it has been marked "inactive." This does not mean that it will be closed, though it may be moved to a "Draft" state. This helps maintainers prioritize their reviewing efforts. You can pick the PR back up anytime - please ping us if you need a review or guidance to move the PR forward! If you do not plan on continuing the work, please let us know so that we can either find someone to take the PR over, or close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

svg backend has limited encoding support with usetex
5 participants