Add latex preamble to texmanager _fontconfig#4895
Merged
WeatherGod merged 3 commits intomatplotlib:masterfrom Aug 12, 2015
Merged
Add latex preamble to texmanager _fontconfig#4895WeatherGod merged 3 commits intomatplotlib:masterfrom
WeatherGod merged 3 commits intomatplotlib:masterfrom
Conversation
Member
|
The explanation makes sense, but some of that should be added to the comments so that future devs will understand why this is being done. Would also be valuable to create a unit test to catch this situation (which, I suspect would have been rare, and thus very important to capture as a test). |
A test comparing images is difficult because the metrics are taken from the tex (which is correctly selected) so that even when the incorrect png is selected, it will be shifted so an image comparison will always fail.
Member
Author
|
@WeatherGod: I added a test on the |
WeatherGod
added a commit
that referenced
this pull request
Aug 12, 2015
Add latex preamble to texmanager _fontconfig
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 contents of
TexManager._fontconfigdetermines whether the png for a given string/dpi/font combination is rendered from TeX or reused from the cache. Right now, there is no information of the custom latex preamble in_fontconfig, so a second string with a different latex preamble will reuse the png from the first call. Note that the tex and dvi files are generated as generating this depends on the_rc_cachewhich includes the latex preamble, so the expensive call to TeX is made but then the png is not used. This PR adds a hash of the latex preamble toTexManager._fontconfigso that a new png is read if preamble changes.A minimal example which should produce two different images: