Revision: 8313 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8313&view=rev Author: mdboom Date: 2010-05-12 15:27:53 +0000 (Wed, 12 May 2010)
Log Message: ----------- [2963827] FontProperties does not seem to be working... Add a unit test to test the FontProperties confusing cases Added Paths: ----------- trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_text/ trunk/matplotlib/lib/matplotlib/tests/test_text.py Added: trunk/matplotlib/lib/matplotlib/tests/test_text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/tests/test_text.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/tests/test_text.py 2010-05-12 15:27:53 UTC (rev 8313) @@ -0,0 +1,66 @@ +import numpy as np +import matplotlib +from matplotlib.testing.decorators import image_comparison, knownfailureif +import matplotlib.pyplot as plt + + +...@image_comparison(baseline_images=['font_styles']) +def test_font_styles(): + from matplotlib.font_manager import FontProperties + + fig = plt.figure() + ax = plt.subplot( 1, 1, 1 ) + + normalFont = FontProperties( family = "sans-serif", + style = "normal", + variant = "normal", + size = 14, + ) + ax.annotate( "Normal Font", (0.1, 0.1), xycoords='axes fraction', + fontproperties = normalFont ) + + boldFont = FontProperties( family = "Foo", + style = "normal", + variant = "normal", + weight = "bold", + stretch = 500, + size = 14, + ) + ax.annotate( "Bold Font", (0.1, 0.2), xycoords='axes fraction', + fontproperties = boldFont ) + + boldItemFont = FontProperties( family = "sans serif", + style = "italic", + variant = "normal", + weight = 750, + stretch = 500, + size = 14, + ) + ax.annotate( "Bold Italic Font", (0.1, 0.3), xycoords='axes fraction', + fontproperties = boldItemFont ) + + lightFont = FontProperties( family = "sans-serif", + style = "normal", + variant = "normal", + weight = 200, + stretch = 500, + size = 14, + ) + ax.annotate( "Light Font", (0.1, 0.4), xycoords='axes fraction', + fontproperties = lightFont ) + + condensedFont = FontProperties( family = "sans-serif", + style = "normal", + variant = "normal", + weight = 500, + stretch = 100, + size = 14, + ) + ax.annotate( "Condensed Font", (0.1, 0.5), xycoords='axes fraction', + fontproperties = condensedFont ) + + ax.set_xticks([]) + ax.set_yticks([]) + + fig.savefig('font_styles') + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins