| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@mdboom asked to do a PR to add DejaVu, but did not have a chance to do that yet. I believe this takes care of that, so I won't duplicate. Also, I agree that STIX should be the fallback for missing fonts, when DejaVu does not have them. There is also a LaTeX math font called arev that I use for presentations (using LaTeXit) that looks nice (http://mirrors.rit.edu/CTAN/info/Free_Math_Font_Survey/en/survey.pdf). However, I am not sure how complicated it would be to use in matplotlib. But that may be yet another option that could be used instead of falling back to computer modern. |
Sorry, something went wrong.
|
Looks good, thanks! |
Sorry, something went wrong.
|
@hetland: No, this PR does not actually add DejaVu or make it default, it only allows to use mathtext.fontset = dejavusans in the configuration (or do plt.rcParams['mathtext.fontset']='dejavusans') and DejaVu Sans will be used in the math sections if usetex = False. Do you want me to do it or will you modify #4636? Note that with this PR the only changes you would need in the mathtext section of rcsetup.py is to set the default of mathtext.fontset to dejavusans. AFAIK, the arev latex package is just a packaging of Arev (with other glyphs from mathdesign), so should be equivalent to using DejaVu. |
Sorry, something went wrong.
|
I think the idea was to make DejaVu (was Arev) the default font for text I agree that the area package is identical to DejaVu (actually, DejaVu may On Thu, Oct 8, 2015 at 3:16 PM, Victor Zabalza notifications@github.com
Prof. Rob Hetland |
Sorry, something went wrong.
|
Ok, I'll close your PR and change the title for this one. I'll take a look at consistency with selecting the font for usetex, but if Mathtext is definitely preferred --it's much faster and portable-- but |
Sorry, something went wrong.
|
Just a comment about TeX fonts: I think http://www.tug.dk/FontCatalogue/mathfonts.html is the most complete list of fonts that have TeX math support. |
Sorry, something went wrong.
There was a problem hiding this comment.
I actually didn't realize this was here. I think this should be updated to use DejaVu rather than just deleted. It sets the default font types if a user is opting for the font-config mode rather than using matplotlib's own font lookup system.
It's not strictly necessary, but removing this will certainly change behavior for those that are relying on it.
Sorry, something went wrong.
There was a problem hiding this comment.
I thought it was part of the Vera release and not being actually used. If it is used I will definitely put it back and modify it.
Sorry, something went wrong.
There was a problem hiding this comment.
Is there any particular reason for removing the old fonts is stead of just adding the new ones and changing the defaults. For all other changes we have made them backwards compatible and added the old default to the classic style
Sorry, something went wrong.
There was a problem hiding this comment.
DejaVu are a superset of Bitstream Vera, so it would be redundant to ship them both. The classic style can still have mathtext.fontset : cm. However, it is true that it might cause problems with matplotlibrc that have been modified to have a single font.sans-serif : Bitstream Vera Sans rather than a list...
Sorry, something went wrong.
There was a problem hiding this comment.
Regarding shipping them both, I just realised that even though the DejaVu fonts are 5.3 MB, the Vera fonts are only 600 KB, so from a distribution size perspective it is not a huge difference shipping them both rather than removing Vera.
Sorry, something went wrong.
There was a problem hiding this comment.
@jenshnielsen: As @zblz said, since DejaVu is a superset of Vera, using DejaVu whenever Vera is requested should have no visible impact other than missing characters now being present, which I'd call a bugfix, not a behavior change. I don't think there's any benefit to keeping the old font, particularly with font subsetting working so well in all backends.
That said, it might be worth adding a built-in mapping from Vera to DejaVu, so that if a user was explicitly setting Vera (rather than just leaving the defaults), and they don't have it installed system wide, they will get DejaVu and things continue to work. This is the kind of thing where some extra release candidate testing may be necessary to catch all of the environmental gotchas about this change.
Sorry, something went wrong.
|
Note to distributors: @sandrotosi, @jspaleta, others: I think Debian and Fedora are removing the fonts vendored with matplotlib and requiring the system packages of those fonts instead. Just a heads up that we are changing our main vendored font from "Bitstream Vera" to "DejaVu" and that package requirement will need to be updated as well. (And this is expected to land in matplotlib 2.0) @zblz: This should get a "What's New" entry. |
Sorry, something went wrong.
|
On Oct 13, 2015 2:36 PM, "Michael Droettboom" notifications@github.com
Is this something they are doing by hand? If so, might this be something |
Sorry, something went wrong.
|
thanks a ton @mdboom for the heads up! we are indeed (trying to) use the debian font files where possible instead of distributed ones, so it's important to know. @toddrjen yes, at least in debian we are doing it by hand, as we inspect the shipped fonts, then we need to match with the currenctly available debian fonts, add the dependencies to the binary package and then create the symlinks in the mpl namespace |
Sorry, something went wrong.
|
I have added the mathtext baseline images, squashed a few commits, rebased with master to fix a doc-building warning, and added a what's new file. I have changed a bit the mathtext fontset classes to reuse code and fix the fallback for alternative sized symbols, which was broken (and one of the main reasons to fallback onto STIX). |
Sorry, something went wrong.
|
The advance of the point glyph in mathtext with this PR is slightly too large. It doesn't happen on regular text. I'll look a bit deeper and try to find the reason. |
Sorry, something went wrong.
|
To support the classic mpl style Vera should not be removed. Btw wonderful work, i really disliked vera. |
Sorry, something went wrong.
|
@Tillsten -- DejaVu is a superset of Vera, so that the only difference between the new and old default (for regular text) will be when Vera falls back to CM. That could be argued to be a bug, so I'm not sure we should retain the option of a small character set in the classic mpl style. |
Sorry, something went wrong.
|
@Tillsten: Deja Vu is the same font as Vera under a new name, with additional glyphs added and bugs fixed (I think historically it was a fork). There is no need to retain the old font for the classic style. |
Sorry, something went wrong.
This should hopefully address the long-reported "Too many open files" error message (Fix matplotlib#3315). To reproduce: On a Mac or Windows box with starvation for file handles (Linux has a much higher file handle limit by default), build the docs, then immediately build again. This will trigger the caching bug. The font cache in the mathtext renderer was broken. It was caching a font file once for every *combination* of font properties, including things like size. Therefore, in a complex math expression containing many different sizes of the same font, the font file was opened once for each of those sizes. Font files are opened and kept open (rather than opened, read, and closed) so that FreeType only needs to load the actual glyphs that are used, rather than the entire font. In an era of cheap memory and fast disk, it probably doesn't matter for our current fonts, but once matplotlib#5214 is merged, we will have larger font files with many more glyphs and this loading time will matter more. The solution here is to do all font file loading in one place and to use `lru_cache` (available since Python 3.2) to do the caching, and to use only the file name and hinting parameters as a cache key. For earlier versions of Python, the functools32 backport package is required. (Or we can discuss whether we want to vendor it).
|
Yes, I was waiting to rebase on #5306 and regenerate the images. |
Sorry, something went wrong.
Add mathtext options to use dejavu use dejavusans as default subsuper metric for custom set dejavusans as default mathtext.fontset fix sized alternatives in dejavu mathtext
Add DejaVu as default font change other mentions to default font to DejaVu modify rcsetup and rc template add DejaVu to seaborn styles and examples
see comments in matplotlib#4873 and matplotlib#4987: Primes in stix and DejaVu are already superscripted, so the TeX way of setting a prime as $f^\prime$ results in doubly-superscripted primes. For consistency with TeX, here we use the CM prime symbol.
|
I rebased, rebuilt with local freetype, and regenerated images, but just realized that there is a problem with some characters in dejavuserif mathtext showing a box rather than falling back to STIX serif. I'll look into it tomorrow. |
Sorry, something went wrong.
|
I think that the problem was that under FreeType 2.6.1 the TrueType font would return a .notdef symbol name and a square glyph when the glyph was not found, rather than the old behaviour of returning a KeyError. Therefore, it was not being caught as a missing glyph. Commit 0ef2cd4 should also fix this for all truetype fonts that fall back onto CM. |
Sorry, something went wrong.
|
Actually I think the relevant change was #5410 #5299, which replaced the cmap dictionary with calls to get_char_index. get_char_index returns 0 when the char doesn't exist -- it doesn't throw a KeyError like a dictionary would. I think you can just check for gind == 0, don't need the additional call to get_glyph_name and don't need the try/except. That should work for all versions of freetype. |
Sorry, something went wrong.
|
@mdboom - that makes more sense, I had not checked your latest font PRs. I changed it as you suggested and now everything should be fine. |
Sorry, something went wrong.
Use DejaVu fonts as default for text and mathtext
Use DejaVu fonts as default for text and mathtext
|
Thanks! |
Sorry, something went wrong.
|
This needs to be backported to 2.0.x? |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
In preparation for #4636 and #5128, this PR adds options to use DejaVu fonts as mathtext fonts. In case glyphs are missing, the fallback is STIX, given that they will have a more similar weight than CM.
DejaVu fonts are not included here, they should be added in a PR that sets DejaVu as default replacing Vera (#4636 or replacement). Do not merge before #4636!
edit: this initial message is outdated, the PR does add the DejaVu fonts and mathtext DejaVu options and sets them as default. See below messages for details.