From: Paulo C. P. de A. <pau...@gm...> - 2012-12-08 18:00:35
|
Hi, Recently I asked to become comaintainer of matplotlib in Fedora and did update to 1.2.0 for the upcoming f18 and rawhide. I am also working on an experimental sagemath package that I hope to get in f19 and make a backport to f18. One example of the font problem is: --%<---%<--%<---%<--%<---%<--%<---%<--%<---%<--%<---%<--%<---%<--%<---%<--%<--- $ sage -t -force_lib "devel/sage/sage/geometry/cone.py" sage -t -force_lib "devel/sage/sage/geometry/cone.py" ********************************************************************** File "/usr/lib64/sagemath/devel/sage/sage/geometry/cone.py", line 930: sage: quadrant.plot() Expected nothing Got: doctest:1214: UserWarning: findfont: Font family ['STIXGeneral'] not found. Falling back to Bitstream Vera Sans doctest:1214: UserWarning: findfont: Font family ['STIXSizeOneSym'] not found. Falling back to Bitstream Vera Sans doctest:1214: UserWarning: findfont: Font family ['STIXSizeThreeSym'] not found. Falling back to Bitstream Vera Sans doctest:1214: UserWarning: findfont: Font family ['STIXSizeFourSym'] not found. Falling back to Bitstream Vera Sans doctest:1214: UserWarning: findfont: Font family ['STIXSizeFiveSym'] not found. Falling back to Bitstream Vera Sans doctest:1214: UserWarning: findfont: Font family ['STIXSizeTwoSym'] not found. Falling back to Bitstream Vera Sans doctest:1214: UserWarning: findfont: Font family ['STIXNonUnicode'] not found. Falling back to Bitstream Vera Sans doctest:1214: UserWarning: findfont: Font family ['cmb10'] not found. Falling back to Bitstream Vera Sans doctest:1214: UserWarning: findfont: Font family ['cmtt10'] not found. Falling back to Bitstream Vera Sans doctest:1214: UserWarning: findfont: Font family ['cmss10'] not found. Falling back to Bitstream Vera Sans <BLANKLINE> ********************************************************************** 1 items had failures: 1 of 5 in __main__.example_17 ***Test Failed*** 1 failures. For whitespace errors, see the file /home/pcpa/.sage/tmp/cone_4295.py [5.8 s] ---------------------------------------------------------------------- The following tests failed: sage -t -force_lib "devel/sage/sage/geometry/cone.py" Total time for all tests: 5.9 seconds --%<---%<--%<---%<--%<---%<--%<---%<--%<---%<--%<---%<--%<---%<--%<---%<--%<--- I opened two bug reports about it at: https://bugzilla.redhat.com/show_bug.cgi?id=885307 and https://bugzilla.redhat.com/show_bug.cgi?id=885312 It "works", that is, is silent in f17, but it should be because f17 has stix fonts 1.0.0 and f18+ has stix-fonts 1.1.0. I am not sure how to correct it, so, an experimental hack patch "to make it silent" is: ---%<--- --- /usr/lib64/python2.7/site-packages/matplotlib/mathtext.py.orig 2012-12-08 15:16:23.959250860 -0200 +++ /usr/lib64/python2.7/site-packages/matplotlib/mathtext.py 2012-12-08 15:31:51.404286375 -0200 @@ -670,10 +670,7 @@ """ _fontmap = { 'cal' : 'cmsy10', 'rm' : 'cmr10', - 'tt' : 'cmtt10', 'it' : 'cmmi10', - 'bf' : 'cmb10', - 'sf' : 'cmss10', 'ex' : 'cmex10' } @@ -902,19 +899,9 @@ - handles sized alternative characters for the STIXSizeX fonts. """ - _fontmap = { 'rm' : 'STIXGeneral', - 'it' : 'STIXGeneral:italic', - 'bf' : 'STIXGeneral:weight=bold', - 'nonunirm' : 'STIXNonUnicode', - 'nonuniit' : 'STIXNonUnicode:italic', - 'nonunibf' : 'STIXNonUnicode:weight=bold', - - 0 : 'STIXGeneral', - 1 : 'STIXSizeOneSym', - 2 : 'STIXSizeTwoSym', - 3 : 'STIXSizeThreeSym', - 4 : 'STIXSizeFourSym', - 5 : 'STIXSizeFiveSym' + _fontmap = { 'rm' : 'STIX:regular', + 'it' : 'STIX:italic', + 'bf' : 'STIX:weight=bold' } use_cmex = False cm_fallback = False ---%<--- but this absolutely does not look right and proper to add to the f18+ matplotlib package. Any suggestion on how to properly correct it is welcome. Thanks, Paulo |
From: Paulo C. P. de A. <pau...@gm...> - 2013-01-16 15:38:46
|
2012/12/8 Paulo César Pereira de Andrade <pau...@gm...>: > Hi, > > Recently I asked to become comaintainer of matplotlib in Fedora and > did update to 1.2.0 [...] > doctest:1214: UserWarning: findfont: Font family ['STIXGeneral'] > not found. Falling back to Bitstream Vera Sans [...] > I opened two bug reports about it at: > https://bugzilla.redhat.com/show_bug.cgi?id=885307 and > https://bugzilla.redhat.com/show_bug.cgi?id=885312 [...] I just did look at it again a bit more, and found that the solution is quite simple. Just need the pseudo patch: ---%<--- $ diff -u /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py{.orig,} --- /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py.orig 2013-01-16 13:25:07.922646400 -0200 +++ /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py 2013-01-16 13:25:10.931646515 -0200 @@ -62,7 +62,7 @@ except ImportError: import pickle -USE_FONTCONFIG = False +USE_FONTCONFIG = True verbose = matplotlib.verbose ---%<--- I think this is safe to be made a patch for Linux distros. I believe this could be the default for *Linux and *BSD in matplotlib. Thanks, Paulo |
From: Michael D. <md...@st...> - 2013-01-16 16:23:51
|
On 01/16/2013 10:38 AM, Paulo César Pereira de Andrade wrote: > 2012/12/8 Paulo César Pereira de Andrade > <pau...@gm...>: >> Hi, >> >> Recently I asked to become comaintainer of matplotlib in Fedora and >> did update to 1.2.0 > [...] > >> doctest:1214: UserWarning: findfont: Font family ['STIXGeneral'] >> not found. Falling back to Bitstream Vera Sans > [...] > >> I opened two bug reports about it at: >> https://bugzilla.redhat.com/show_bug.cgi?id=885307 and >> https://bugzilla.redhat.com/show_bug.cgi?id=885312 > [...] > > I just did look at it again a bit more, and found that the solution is quite > simple. Just need the pseudo patch: > > ---%<--- > $ diff -u /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py{.orig,} > --- /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py.orig > 2013-01-16 13:25:07.922646400 -0200 > +++ /usr/lib64/python2.7/site-packages/matplotlib/font_manager.py > 2013-01-16 13:25:10.931646515 -0200 > @@ -62,7 +62,7 @@ > except ImportError: > import pickle > > -USE_FONTCONFIG = False > +USE_FONTCONFIG = True > > verbose = matplotlib.verbose > > ---%<--- > > I think this is safe to be made a patch for Linux distros. I believe this could > be the default for *Linux and *BSD in matplotlib. > This will silence things, and I agree it probably should be the default on Linux, but I'm not sure if it's correct. If F18 really does have STIX 1.1, then it's not going to work since the layout of the fonts has changed so much. That's going to require a great deal of effort. Can you successfully run the test suite with this change? That should catch any glyph mismatch problems. Is there a way to have the package depend on 1.0 version of the fonts until matplotlib has a chance to update its tables? Mike |
From: Paulo C. P. de A. <pau...@gm...> - 2013-01-16 17:22:22
|
2013/1/16 Michael Droettboom <md...@st...>: >> -USE_FONTCONFIG = False >> +USE_FONTCONFIG = True [...] >> I think this is safe to be made a patch for Linux distros. I believe this could >> be the default for *Linux and *BSD in matplotlib. >> > This will silence things, and I agree it probably should be the default > on Linux, but I'm not sure if it's correct. If F18 really does have So far I managed to "apparently" solve my issues with my work in progress sagemath package for fedora. > STIX 1.1, then it's not going to work since the layout of the fonts has > changed so much. That's going to require a great deal of effort. Can Yes, it has STIX 1.1. > you successfully run the test suite with this change? That should catch Sorry that I am not much experienced with matplotlib, but I am willing to help in whatever I can, given that now I can modify/update the matplotlib package in Fedora. After running it for the first time, and not looking much at the sources, it appears to have way too many test failures... $ nosetests-2.7 -v matplotlib.tests 2>&1 | tee ~/matplotlib-2.7.txt http://pcpa.fedorapeople.org/matplotlib-2.7.txt $ nosetests-3.3 -v matplotlib.tests 2>&1 | tee ~/matplotlib-3.3.txt http://pcpa.fedorapeople.org/matplotlib-3.3.txt > any glyph mismatch problems. Is there a way to have the package depend > on 1.0 version of the fonts until matplotlib has a chance to update its > tables? I am afraid this may not be an option (using stix fonts 1.0). > Mike Thanks, Paulo |
From: Michael D. <md...@st...> - 2013-01-16 17:55:41
|
On 01/16/2013 12:22 PM, Paulo César Pereira de Andrade wrote: > 2013/1/16 Michael Droettboom <md...@st...>: > >>> -USE_FONTCONFIG = False >>> +USE_FONTCONFIG = True > [...] >>> I think this is safe to be made a patch for Linux distros. I believe this could >>> be the default for *Linux and *BSD in matplotlib. >>> >> This will silence things, and I agree it probably should be the default >> on Linux, but I'm not sure if it's correct. If F18 really does have > So far I managed to "apparently" solve my issues with my work in > progress sagemath package for fedora. > >> STIX 1.1, then it's not going to work since the layout of the fonts has >> changed so much. That's going to require a great deal of effort. Can > Yes, it has STIX 1.1. > >> you successfully run the test suite with this change? That should catch > Sorry that I am not much experienced with matplotlib, but I am willing to > help in whatever I can, given that now I can modify/update the matplotlib > package in Fedora. After running it for the first time, and not looking > much at the sources, it appears to have way too many test failures... > > $ nosetests-2.7 -v matplotlib.tests 2>&1 | tee ~/matplotlib-2.7.txt > http://pcpa.fedorapeople.org/matplotlib-2.7.txt > > $ nosetests-3.3 -v matplotlib.tests 2>&1 | tee ~/matplotlib-3.3.txt > http://pcpa.fedorapeople.org/matplotlib-3.3.txt > >> any glyph mismatch problems. Is there a way to have the package depend >> on 1.0 version of the fonts until matplotlib has a chance to update its >> tables? > I am afraid this may not be an option (using stix fonts 1.0). > > There was a very silly bug lurking in USE_FONTCONFIG=True mode, and I've made a PR with a fix here: https://github.com/matplotlib/matplotlib/pull/1666 However, I thought I'd investigate the issue with the STIX fonts -- I actually just upgraded to F18 yesterday, so I thought I'd try what you suggest and get matplotlib to use them. Thanks for taking on packaging for matplotlib, and thanks for understanding the importance of running the test suite. It seems that the stix fonts packages in Fedora only come in .otf format -- I believe this is how they are shipped upstream as well. Unfortunately, matplotlib has no support for reading .otf files, so these are simply unusable to matplotlib. There are some options: 1) Include the STIX ttf fonts included with matplotlib in the matplotlib package and install them in `matplotlib/mpl-data/fonts/ttf` (as a vanilla install would do) so as not to conflict with the stix-fonts package. Maybe these go in a python-matplotlib-stix-fonts package. 2) Include a version of the STIX fonts converted to ttf. This will still have the problem that the glyph tables in matplotlib need to be updated to use them. 3) Update matplotlib's freetype wrapper to support .otf fonts. Doable, but considerable work. 4) Leave it as is but warn that STIX font support is broken with the Fedora matplotlib package. Mike |
From: Paulo C. P. de A. <pau...@gm...> - 2013-01-16 18:32:28
|
2013/1/16 Michael Droettboom <md...@st...>: > There was a very silly bug lurking in USE_FONTCONFIG=True mode, and I've > made a PR with a fix here: > > https://github.com/matplotlib/matplotlib/pull/1666 Updated test case with that patch: http://pcpa.fedorapeople.org/matplotlib-2.7+pull-1666.txt > However, I thought I'd investigate the issue with the STIX fonts -- I > actually just upgraded to F18 yesterday, so I thought I'd try what you > suggest and get matplotlib to use them. > > Thanks for taking on packaging for matplotlib, and thanks for understanding > the importance of running the test suite. > > It seems that the stix fonts packages in Fedora only come in .otf format -- > I believe this is how they are shipped upstream as well. Unfortunately, > matplotlib has no support for reading .otf files, so these are simply > unusable to matplotlib. > > There are some options: > > 1) Include the STIX ttf fonts included with matplotlib in the matplotlib > package and install them in `matplotlib/mpl-data/fonts/ttf` (as a vanilla > install would do) so as not to conflict with the stix-fonts package. Maybe > these go in a python-matplotlib-stix-fonts package. For the sake of correctness, I believe this should be the better option. I did: $ sudo mkdir /usr/lib64/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf $ sudo cp -a matplotlib-1.2.0/lib/matplotlib/mpl-data/fonts/ttf/*STIX* /usr/lib64/python2.7/site-packages/matplotlib/mpl-data/fontsSave: No changes need to be saved, save again to override -- nothing saved. $ ls /usr/lib64/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/ LICENSE_STIX STIXNonUniBol.ttf STIXSizOneSymBol.ttf STIXGeneralBolIta.ttf STIXNonUniIta.ttf STIXSizOneSymReg.ttf STIXGeneralBol.ttf STIXNonUni.ttf STIXSizThreeSymBol.ttf STIXGeneralItalic.ttf STIXSizFiveSymReg.ttf STIXSizThreeSymReg.ttf STIXGeneral.ttf STIXSizFourSymBol.ttf STIXSizTwoSymBol.ttf STIXNonUniBolIta.ttf STIXSizFourSymReg.ttf STIXSizTwoSymReg.ttf This should require asking permission for bundling, but not duplicating as ttf stix font are not installed. Before asking for it, you may want to look at the test results: http://pcpa.fedorapeople.org/matplotlib-2.7-mpl-data-with-bundled-stix-ttf.txt Because I did not see any difference on the results, so I probably missed some step... > 2) Include a version of the STIX fonts converted to ttf. This will still > have the problem that the glyph tables in matplotlib need to be updated to > use them. > > 3) Update matplotlib's freetype wrapper to support .otf fonts. Doable, but > considerable work. > > 4) Leave it as is but warn that STIX font support is broken with the Fedora > matplotlib package. > > Mike I actually did submit an update https://admin.fedoraproject.org/updates/python-matplotlib-1.2.0-7.fc18 before you posted about https://github.com/matplotlib/matplotlib/pull/1666 So would prefer a more complete review before overriding it. The update should be in queue for a week before going to mirrors, so it can be revoked and a better update submitted. Thanks, Paulo |
From: Michael D. <md...@st...> - 2013-01-16 19:09:12
|
On 01/16/2013 01:32 PM, Paulo César Pereira de Andrade wrote: > 2013/1/16 Michael Droettboom <md...@st...>: > >> There was a very silly bug lurking in USE_FONTCONFIG=True mode, and I've >> made a PR with a fix here: >> >> https://github.com/matplotlib/matplotlib/pull/1666 > Updated test case with that patch: > http://pcpa.fedorapeople.org/matplotlib-2.7+pull-1666.txt > >> However, I thought I'd investigate the issue with the STIX fonts -- I >> actually just upgraded to F18 yesterday, so I thought I'd try what you >> suggest and get matplotlib to use them. >> >> Thanks for taking on packaging for matplotlib, and thanks for understanding >> the importance of running the test suite. >> >> It seems that the stix fonts packages in Fedora only come in .otf format -- >> I believe this is how they are shipped upstream as well. Unfortunately, >> matplotlib has no support for reading .otf files, so these are simply >> unusable to matplotlib. >> >> There are some options: >> >> 1) Include the STIX ttf fonts included with matplotlib in the matplotlib >> package and install them in `matplotlib/mpl-data/fonts/ttf` (as a vanilla >> install would do) so as not to conflict with the stix-fonts package. Maybe >> these go in a python-matplotlib-stix-fonts package. > For the sake of correctness, I believe this should be the better option. > I did: > $ sudo mkdir /usr/lib64/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf > $ sudo cp -a matplotlib-1.2.0/lib/matplotlib/mpl-data/fonts/ttf/*STIX* > /usr/lib64/python2.7/site-packages/matplotlib/mpl-data/fontsSave: No > changes need to be saved, save again to override -- nothing saved. > $ ls /usr/lib64/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/ > LICENSE_STIX STIXNonUniBol.ttf STIXSizOneSymBol.ttf > STIXGeneralBolIta.ttf STIXNonUniIta.ttf STIXSizOneSymReg.ttf > STIXGeneralBol.ttf STIXNonUni.ttf STIXSizThreeSymBol.ttf > STIXGeneralItalic.ttf STIXSizFiveSymReg.ttf STIXSizThreeSymReg.ttf > STIXGeneral.ttf STIXSizFourSymBol.ttf STIXSizTwoSymBol.ttf > STIXNonUniBolIta.ttf STIXSizFourSymReg.ttf STIXSizTwoSymReg.ttf > > This should require asking permission for bundling, but not duplicating > as ttf stix font are not installed. Before asking for it, you may want to > look at the test results: > http://pcpa.fedorapeople.org/matplotlib-2.7-mpl-data-with-bundled-stix-ttf.txt > Because I did not see any difference on the results, so I probably missed > some step... Did you turn USE_FONTCONFIG back to False? font-config won't find fonts here, but matplotlib's built-in font lookup mechanism will. Mike > >> 2) Include a version of the STIX fonts converted to ttf. This will still >> have the problem that the glyph tables in matplotlib need to be updated to >> use them. >> >> 3) Update matplotlib's freetype wrapper to support .otf fonts. Doable, but >> considerable work. >> >> 4) Leave it as is but warn that STIX font support is broken with the Fedora >> matplotlib package. >> >> Mike > I actually did submit an update > https://admin.fedoraproject.org/updates/python-matplotlib-1.2.0-7.fc18 > before you posted about > https://github.com/matplotlib/matplotlib/pull/1666 > So would prefer a more complete review before overriding it. > The update should be in queue for a week before going to > mirrors, so it can be revoked and a better update submitted. > > Thanks, > Paulo |
From: Paulo C. P. de A. <pau...@gm...> - 2013-01-16 19:24:53
|
2013/1/16 Michael Droettboom <md...@st...>: [...] >> $ ls /usr/lib64/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/ >> LICENSE_STIX STIXNonUniBol.ttf STIXSizOneSymBol.ttf >> STIXGeneralBolIta.ttf STIXNonUniIta.ttf STIXSizOneSymReg.ttf >> STIXGeneralBol.ttf STIXNonUni.ttf STIXSizThreeSymBol.ttf >> STIXGeneralItalic.ttf STIXSizFiveSymReg.ttf STIXSizThreeSymReg.ttf >> STIXGeneral.ttf STIXSizFourSymBol.ttf STIXSizTwoSymBol.ttf >> STIXNonUniBolIta.ttf STIXSizFourSymReg.ttf STIXSizTwoSymReg.ttf >> >> This should require asking permission for bundling, but not duplicating >> as ttf stix font are not installed. Before asking for it, you may want to >> look at the test results: BTW, note that asking for such permissions may take a very long time, and may be "denied" unless there is a very convincing reason to bundle it... >> http://pcpa.fedorapeople.org/matplotlib-2.7-mpl-data-with-bundled-stix-ttf.txt >> Because I did not see any difference on the results, so I probably missed >> some step... > > > Did you turn USE_FONTCONFIG back to False? font-config won't find fonts > here, but matplotlib's built-in font lookup mechanism will. Ops :-) but I think something is still messed, maybe it is getting confused by finding system STIX 1.1 before the bundled ones somehow: http://pcpa.fedorapeople.org/matplotlib-2.7-bundled-stix-ttf+fontconfig=false.txt > Mike Paulo |