From: Michael D. <md...@st...> - 2014-01-27 18:11:53
|
Thanks for the report. Indeed, you are correct in that the root of this problem is that "Bitstream Vera Sans" does not contain these characters, yet it is being selected erroneously. It does appear that there is a bug in the font selection algorithm, that "Bitstream Vera Sans" gets selected as a perfect match even when it is not the first font in the requested list. Vera Sans ships with matplotlib and is the "default fallback font", even though it is not installed as a system font on your computer. I have a fix here: https://github.com/matplotlib/matplotlib/pull/2771 In the meantime, the solution you arrived at is the probably the best we can do for now. Mike On 01/27/2014 11:21 AM, Phil Elson wrote: > Thanks for this Vlastimil, looks like there is either a subtlety > beyond my font knowledge or a bug here - mdboom, did you have any > ideas? Otherwise I think we need a github issue for this. > > Cheers, > > > On 4 January 2014 19:37, Vlastimil Brom <vla...@gm... > <mailto:vla...@gm...>> wrote: > > Hi all, > after upgrading to matplotlib 1.3.1, I noticed some display errors on > the plots with regard to accented characters (such as carons etc.). > As I recall, I had similar problem in the past and could work around > them by modifying rcParams, however, this fix doesn't work as expected > in 1.3.1. (with python 2.7.6, 32bit on Win 7, Czech - with both WXAgg > and TKAgg backends). > >From the usual Czech diacritics ác(d(ée(ín(ór(s(t(úu*ýz( some > are not > displayed (d(e(n(r(t(u*) - replacement squares are shown instead. > > Simply prepending a suitable font at the beginning of the list > rcParams['font.sans-serif'] doesn't help in 1.3.1. > I eventually found out, that "Bitstream Vera Sans" (which is not > installed on this computer) is somehow offending - as long as this > item is in the list (even at the end), the mentioned characters aren't > displayed. > > The problem can be observed in the following simple pylab script: > ============== > #! Python > # -*- coding: utf-8 -*- > > # with implicit fonts "d(e(n(r(t(u*" are not displayed properly in > the plot title > from matplotlib import rcParams > rcParams['font.family'] = 'sans-serif' > if "Bitstream Vera Sans" in rcParams['font.sans-serif']: > rcParams['font.sans-serif'].remove("Bitstream Vera Sans") > > # after appending the "offending" font even at the end of the list (by > uncommenting the following line), d(e(n(r(t(u* are not displayed again > # rcParams['font.sans-serif'].append("Bitstream Vera Sans") > > import pylab > pylab.title(u"abcd ác(d(ée(ín(ór(s(t(úu*ýz( äöüß ê xyz") > pylab.show() > ============== > > Is there something special in the resolution of the font items in > rcParams? > This individual issue seems to be fixed with removing the single font, > but I'd like to understand this more generally, as the installed fonts > on different computers differ. > > Thanks in advance > Vlastimil Brom > > ------------------------------------------------------------------------------ > Rapidly troubleshoot problems before they affect your business. > Most IT > organizations don't have a clear picture of how application > performance > affects their revenue. With AppDynamics, you get 100% visibility > into your > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of > AppDynamics Pro! > http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > <mailto:Mat...@li...> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- _ |\/|o _|_ _. _ | | \.__ __|__|_|_ _ _ ._ _ | ||(_| |(_|(/_| |_/|(_)(/_|_ |_|_)(_)(_)| | | http://www.droettboom.com |