Re: [matplotlib-devel] Font installation stuff
Done and committed. It seems a recent commit has severely broken my font loading. When I start MPL now, I get an infinite stream of messages similar to: Found an unknown keyword in AFM header (was ) Found an unknown keyword in AFM header (was !% ##2*3*9*:*[EMAIL PROTECTED]@;;C#C)*=AB879(') **7'6'7#5#3#327#'#5##53'#7/75'7535#35#35#'3'#' ) Found an unknown keyword in AFM header (was ?)52 Je) !_)nd an unknown keyword in AFM header (wasSS.,?+%5??0 Found an unknown keyword in AFM header (was g Perhaps this is related to the recent commit? -r Rob Hetland, Associate Professor Dept. of Oceanography, Texas AM University http://pong.tamu.edu/~rob phone: 979-458-0096, fax: 979-845-6331 - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Font installation stuff
Hmm... I'm not readily able to reproduce this here. What are you setting in matplotlibrc (or in your plot?) Also, if you delete the font cache (which is now ~/.matplotlib/fontManager.cache), does that help? (Might be a useful data point -- not suggesting it as a solution.) Cheers, Mike Rob Hetland wrote: Done and committed. It seems a recent commit has severely broken my font loading. When I start MPL now, I get an infinite stream of messages similar to: Found an unknown keyword in AFM header (was ) Found an unknown keyword in AFM header (was !% ##2*3*9*:*[EMAIL PROTECTED]@;;C#C)*=AB879(') **7'6'7#5#3#327#'#5##53'#7/75'7535#35#35#'3'#' ) Found an unknown keyword in AFM header (was ?)52 Je) !_)nd an unknown keyword in AFM header (wasSS.,?+%5??0 Found an unknown keyword in AFM header (was g Perhaps this is related to the recent commit? -r Rob Hetland, Associate Professor Dept. of Oceanography, Texas AM University http://pong.tamu.edu/~rob phone: 979-458-0096, fax: 979-845-6331 - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Font installation stuff
What are you setting in matplotlibrc (or in your plot?) Also, if you delete the font cache (which is now ~/.matplotlib/fontManager.cache), does that help? (Might be a useful data point -- not suggesting it as a solution.) Well, I've been trying out the Arev fonts, as you know, so I changed those back to Bitstream Vera Sans. I deleted the cache. I took out the mathtext stuff. All that is left is pretty vanilla rc. Perhaps it's a Mac thing? Also, revision 3700 works, so that can at least frame the initiation of the bug. I can whittle this down to the exact revision (there are only nine since 3700), if that is needed, -r Rob Hetland, Associate Professor Dept. of Oceanography, Texas AM University http://pong.tamu.edu/~rob phone: 979-458-0096, fax: 979-845-6331 - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Font installation stuff
Mike, Rob, One of the changes I made was to cause the afmdict to be generated automatically at the start rather than on demand. The problem you are having seems related to afm fonts, so I suspect this is it. What is your rcParams['pdf.use14corefonts'] setting? Please try reversing it, and see if that changes the result. This is looking for a clue, not a solution. (I knew I should have left the font stuff alone...) Thanks. Eric Michael Droettboom wrote: Hmm... I'm not readily able to reproduce this here. What are you setting in matplotlibrc (or in your plot?) Also, if you delete the font cache (which is now ~/.matplotlib/fontManager.cache), does that help? (Might be a useful data point -- not suggesting it as a solution.) Cheers, Mike Rob Hetland wrote: Done and committed. It seems a recent commit has severely broken my font loading. When I start MPL now, I get an infinite stream of messages similar to: Found an unknown keyword in AFM header (was ) Found an unknown keyword in AFM header (was !% ##2*3*9*:*[EMAIL PROTECTED]@;;C#C)*=AB879(') **7'6'7#5#3#327#'#5##53'#7/75'7535#35#35#'3'#' ) Found an unknown keyword in AFM header (was ?)52 Je) !_)nd an unknown keyword in AFM header (wasSS.,?+%5??0 Found an unknown keyword in AFM header (was g Perhaps this is related to the recent commit? -r Rob Hetland, Associate Professor Dept. of Oceanography, Texas AM University http://pong.tamu.edu/~rob phone: 979-458-0096, fax: 979-845-6331 - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Font installation stuff
Rob, Mike, What this implies to me is that either there is a problem with the code that is generating afmdict (and I did not change that code, I just caused it to be invoked when the fontManager instance is created.), or there is a problem with some .afm files on Rob's machine. I really don't know how to troubleshoot it beyond this. (As a separate issue, I probably I should change font_manager.py so that if the rcParams value below was changed since the cache was made, it will be rebuilt with the new value.) Eric Rob Hetland wrote: On Aug 14, 2007, at 1:55 PM, Eric Firing wrote: rcParams['pdf.use14corefonts'] Indeed, reversing this value fixes the problem. My value had been set to False. pdf.use14corefonts : True in the mplrc file works with the latest revision. -r Rob Hetland, Associate Professor Dept. of Oceanography, Texas AM University http://pong.tamu.edu/~rob phone: 979-458-0096, fax: 979-845-6331 - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Font installation stuff
Quick status update -- I've committed code to font_manager that will retrieve the list of all installed fonts from fontconfig if available (using making a shell call to fc-list). This will handle the cases where users want to use fonts that have been installed in non-standard places or their distributions do something different. I've decided to put off making other improvements to font_manager for the time being. I'm somewhat torn between adding a dependency on fontconfig and having all those issues taken care of by others, or adding incremental fixes to font_manager, but maintaining easy Python-level portability. A new thing that makes fontconfig particularly compelling is looking up fonts based on the character sets they contain. This would be very useful for mathtext when using non-Computer Modern (Bakoma) fonts, for instance. It could all be done without fontconfig, of course, but it would be reinventing a rather large wheel. My original impetus to support fontconfig, to help the Cairo backend behave more like our other backends, is less important, IMHO. It seems unlikely, from my response on the cairo mailing list, that pycairo will grow an API to load fonts directly from a file. Some more information -- - I've successfully built it on Mac and Windows (with Mingw32) and it seems to be doing the right things there, without any post-install configuration work. - The API allows applications to add their own font directories on the fly, so everything could continue work the way it does now (by looking in the mpl-data directory for fonts). - The Python wrappers for the parts we need would be quite minimal. (Probably only two functions FcFontMatch and FcConfigAppFontAddDir.) - fontconfig depends on expat for XML reading. - It appears that both the fontconfig and expat licenses would permit us to distribute them with matplotlib if we chose to. We would probably only want to use the embedded versions when the OS doesn't provide it (OS-X and Windows). In any case, I'm just putting this on the table. It's always hard to weigh those tradeoffs. Cheers, Mike Michael Droettboom wrote: Just wanted to link up this thread with a question I posed on the cairo mailing list. http://lists.cairographics.org/archives/cairo/2007-August/011201.html Cheers, Mike Eric Firing wrote: Michael Droettboom wrote: [...] One middle ground I thought of since my first message is to use fc-list to get a list of all the fonts on the system, and continue to use font_manager.py for the font matching. If fc-list is not available, it could fall back to the hard-coded paths it uses now. Of course, the matching in font_manager.py would still need to be improved. Sounds reasonable. While you are poking around in font_manager: this is one of the biggest chunks of mpl script startup time, even with the present caching. I haven't looked very closely or done any testing, but I suspect more extensive caching could work fine. Specifically, can the entire fontManager instance be pickled, and loaded if it exists? Eric Cheers, Mike - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Font installation stuff
Michael Droettboom wrote: Just wanted to link up this thread with a question I posed on the cairo mailing list. http://lists.cairographics.org/archives/cairo/2007-August/011201.html Cheers, Mike Eric Firing wrote: Michael Droettboom wrote: [...] One middle ground I thought of since my first message is to use fc-list to get a list of all the fonts on the system, and continue to use font_manager.py for the font matching. If fc-list is not available, it could fall back to the hard-coded paths it uses now. Of course, the matching in font_manager.py would still need to be improved. Sounds reasonable. Your change to use fontconfig slightly raised the time for backend_driver.py Template: 0.50 - 0.53 minutes. While you are poking around in font_manager: this is one of the biggest chunks of mpl script startup time, even with the present caching. I haven't looked very closely or done any testing, but I suspect more extensive caching could work fine. Specifically, can the entire fontManager instance be pickled, and loaded if it exists? I tried this (svn diff is attached), and it cut the time above to 0.43 minutes. I have not committed it; I very much like doing what we can to reduce startup time (which is important for applications that run simple plots as standalone scripts), but perhaps the approach here will cause too much trouble, or will require better error trapping downstream to handle the case where the fontManager actually needs to be rebuilt. Eric Eric Cheers, Mike Index: font_manager.py === --- font_manager.py (revision 3706) +++ font_manager.py (working copy) @@ -231,10 +231,10 @@ if sys.platform == 'darwin': for f in OSXInstalledFonts(): fontfiles[f] = 1 - + for f in get_fontconfig_fonts(fontext): fontfiles[f] = 1 - + elif isinstance(fontpaths, (str, unicode)): fontpaths = [fontpaths] @@ -1009,7 +1009,7 @@ return fname font_family_aliases = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] - + for name in prop.get_family(): if name in font_family_aliases: for name2 in rcParams['font.' + name]: @@ -1060,5 +1060,12 @@ return fontdict +fmcache = os.path.join(get_configdir(), 'fontManager.cache') -fontManager = FontManager() +try: +fontManager = pickle_load(fmcache) +except: +fontManager = FontManager() +pickle_dump(fontManager, fmcache) +print generated new fontManager + - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel