GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||
GeezerVison is showing github.com — Bad font hinting / quality with Agg renderer by mdboom · Pull Request #719 · matplotlib/matplotlib Conversation
Member
When using the The below script creates two images that demonstrate the problem. It generates some text in multiple sizes, with both the I have copies of the images, and zoomed-in versions for comparision, available at # Test rendering of different font sizes with Cairo vs. Agg backend import sys, os if "DISPLAY" in os.environ: del os.environ["DISPLAY"] for backend in [ 'cairo', 'agg' ]: # Reload with proper backend print "Rendering with " + backend for module in list(sys.modules): if module.startswith(('matplotlib','pylab')): sys.modules.pop(module) import matplotlib matplotlib.use(backend) import pylab # This has no effect, but try it anyway matplotlib.rcParams['text.hinting'] = True # Make plot fig = pylab.figure(figsize=[2,5]) ax = fig.add_subplot(1,1,1) ax.set_frame_on(False) ax.axes.get_xaxis().set_visible(False) ax.axes.get_yaxis().set_visible(False) ax.set_xlim([0, 1]) ax.set_ylim([15, 0]) pylab.title(backend) for size in range(1,25): ax.text(0.1, (size ** 1.6) / 10, "hello " + str(size), fontdict = { "size" : size, "family" : "arial" }) pylab.savefig("test-" + backend + ".png", format="png") pylab.clf()
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThe hinting factor is the amount of softness in hinting is applied in
the horizontal direction. For years, matplotlib has hinted to 1/8
pixels in the horizontal direction and whole pixels in the vertical
direction. This results in text that is often more
legible (particularly at smaller sizes) than standard 1:1 hinting.
This is based on idea from this paper from the author of Agg:
http://www.antigrain.com/research/font_rasterization/
However, sometimes the user may want full-on hinting, so this value is
now tweakable using the `text.hinting_factor` rcParam.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
mdboom
added a commit
that referenced
this pull request
Bad font hinting / quality with Agg renderer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. | ||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |