SourceForge logo
SourceForge logo
Menu

Re: [matplotlib-devel] New font manager.

From: John H. <jdh...@ac...> - 2004年03月22日 15:17:12
>>>>> "Paul" == Paul Barrett <ba...@st...> writes:
 Paul> I was thinking that we might want to use set_fontname() to
 Paul> find the font family and also add the specified font to the
 Paul> beginning of the list, so that it will all certainly be
 Paul> used. Otherwise, that font may be near the bottom of the
 Paul> list and not actually get used.
Just to summarize then to make sure we're all on the same page
 * family lists will be moved to matplotlibrc and so will be user
 configurable. This list can be overriden on a per-script basis
 using the method in
 http://matplotlib.sourceforge.net/faq.html#CUSTOM
 * text.fontname and the other text.font* attributes in the config
 file and in matplotlib.__init__ are deprecated and should warn.
 The warning should point to the appropriate web page for
 instruction. You should use family lists rather than fontnames for
 general/global preferences. However, Text.set_fontname is
 preserved and moves the named font to the head of the list
 appropriate list using some kind of dictionary that maps names to
 families. 
 This should satisfy Perry's concern about specifying a specific
 font for use in a specific place. If the font is in your system
 path and the finder algorithm is working properly this font will be
 used. There is one significant caveat to this, which is that it
 may be difficult or impossible to specify a complete dictionary
 from names to families. Or, are you reasonably certain you can
 build this on the fly Paul using font properties from FT2Font?
 * font.family must be one of sans-serif, serif, monospace, cursive or
 fantasy. Anything else should raise
 * Paul, I think when you do the documentation, some discussion of
 what the different families look like, what the classic examples of
 each are Eg "Courier is an example of Monospace", and a text
 screenshot along the lines of examples/alignment_test.py showing an
 example from each of the families would be very helpful to users.
 All of this could go into htdocs/fonts.html.template and/or
 tutorial.html.template.
Remaining question:
 * Should we add a fontfile attribute to FontProperties which defaults
 to None but if not None but can be a string like 'somefile.ttf'.
 FontManager.findfont would do something like
 if prop.fontfile is not None:
 for path in fontPaths:
 fullpath = os.path.join(path, prop.fontfile):
 if os.path.exists(fullpath): return fullpath
 raise something # somefile.ttf is not on system
 This would be for users who absolutely positively want a font from
 some ttf file and don't want to mess with the rest. If we really
 trust the mechanisms in set_fontname, the finder algorithm and the
 name->family dictionary, this shouldn't be necessary. But we may
 not fully trust all of these mechanisms and it might be nice for
 people who don't want to mess with understanding fonts, families,
 and the rest. 
Anything else?
JDH

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /