Skip to content

Commit d730481

Browse files
jenshnielsenmdboom
authored andcommitted
Merge pull request #5306 from mdboom/local-freetype
Use a specific version of Freetype for testing
1 parent c22614e commit d730481

File tree

18 files changed

+190
-54
lines changed

18 files changed

+190
-54
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ dist
3939
.eggs
4040
# tox testing tool
4141
.tox
42+
setup.cfg
4243

4344
# OS generated files #
4445
######################

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ install:
8282
# version since is it basically just a .ttf file
8383
# The current Travis Ubuntu image is to old to search .local/share/fonts so we store fonts in .fonts
8484

85-
# We install ipython to use the console highlighting. From IPython 3 this depends on jsonschema and misture.
85+
# We install ipython to use the console highlighting. From IPython 3 this depends on jsonschema and mistune.
8686
# Neihter is installed as a dependency of IPython since they are not used by the IPython console.
8787
- |
8888
if [[ $BUILD_DOCS == true ]]; then
@@ -96,7 +96,11 @@ install:
9696
cp tmp/usr/share/fonts/truetype/humor-sans/Humor-Sans.ttf ~/.fonts
9797
cp Felipa-Regular.ttf ~/.fonts
9898
fc-cache -f -v
99+
else
100+
# Use the special local version of freetype for testing
101+
cp .travis/setup.cfg .
99102
fi;
103+
100104
- python setup.py install
101105

102106
script:

.travis/setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[test]
2+
local_freetype=True

INSTALL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ libpng 1.2 (or later)
208208
`pytz`
209209
Used to manipulate time-zone aware datetimes.
210210

211-
:term:`freetype` 2.3 or later
211+
:term:`FreeType` 2.3 or later
212212
library for reading true type font files.
213213

214214
``cycler`` 0.9 or later

doc/devel/testing.rst

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ Optionally you can install:
3333

3434
- `pep8 <http://pep8.readthedocs.org/en/latest>`_ to test coding standards
3535

36+
Building matplotlib for image comparison tests
37+
----------------------------------------------
38+
39+
matplotlib's test suite makes heavy use of image comparison tests,
40+
meaning the result of a plot is compared against a known good result.
41+
Unfortunately, different versions of FreeType produce differently
42+
formed characters, causing these image comparisons to fail. To make
43+
them reproducible, matplotlib can be built with a special local copy
44+
of FreeType. This is recommended for all matplotlib developers.
45+
46+
Add the following content to a ``setup.cfg`` file at the root of the
47+
matplotlib source directory::
48+
49+
[test]
50+
local_freetype = True
51+
3652
Running the tests
3753
-----------------
3854

@@ -185,17 +201,6 @@ decorator:
185201
If some variation is expected in the image between runs, this
186202
value may be adjusted.
187203

188-
Freetype version
189-
----------------
190-
191-
Due to subtle differences in the font rendering under different
192-
version of freetype some care must be taken when generating the
193-
baseline images. Currently (early 2015), almost all of the images
194-
were generated using ``freetype 2.5.3-21`` on Fedora 21 and only the
195-
fonts that ship with ``matplotlib`` (regenerated in PR #4031 / commit
196-
005cfde02751d274f2ab8016eddd61c3b3828446) and travis is using
197-
``freetype 2.4.8`` on ubuntu.
198-
199204
Known failing tests
200205
-------------------
201206

doc/glossary/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Glossary
2222
EPS
2323
Encapsulated Postscript (`EPS <http://en.wikipedia.org/wiki/Encapsulated_PostScript>`_)
2424

25-
freetype
26-
`freetype <http://www.freetype.org/>`_ is a font rasterization
25+
FreeType
26+
`FreeType <http://www.freetype.org/>`_ is a font rasterization
2727
library used by matplotlib which supports TrueType, Type 1, and
2828
OpenType fonts.
2929

doc/users/screenshots.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ Mathtext_examples
252252

253253
Below is a sampling of the many TeX expressions now supported by matplotlib's
254254
internal mathtext engine. The mathtext module provides TeX style mathematical
255-
expressions using `freetype2 <http://www.freetype.org/>`_
255+
expressions using `FreeType <http://www.freetype.org/>`_
256256
and the BaKoMa computer modern or `STIX <http://www.stixfonts.org>`_ fonts.
257257
See the :mod:`matplotlib.mathtext` module for additional details.
258258

doc/users/text_intro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ expressions, truetype support for raster and vector outputs, newline
88
separated text with arbitrary rotations, and unicode support. Because
99
we embed the fonts directly in the output documents, e.g., for postscript
1010
or PDF, what you see on the screen is what you get in the hardcopy.
11-
`freetype2 <http://www.freetype.org/>`_ support
11+
`FreeType <http://www.freetype.org/>`_ support
1212
produces very nice, antialiased fonts, that look good even at small
1313
raster sizes. matplotlib includes its own
1414
:mod:`matplotlib.font_manager`, thanks to Paul Barrett, which

examples/pylab_examples/font_table_ttf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- noplot -*-
22
"""
3-
matplotlib has support for freetype fonts. Here's a little example
3+
matplotlib has support for FreeType fonts. Here's a little example
44
using the 'table' command to build a font table that shows the glyphs
55
by character code.
66

lib/matplotlib/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,6 +1488,18 @@ def verify_test_dependencies():
14881488
if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'tests')):
14891489
raise ImportError("matplotlib test data is not installed")
14901490

1491+
# The version of FreeType to install locally for running the
1492+
# tests. This must match the value in `setupext.py`
1493+
LOCAL_FREETYPE_VERSION = '2.6.1'
1494+
1495+
from matplotlib import ft2font
1496+
if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or
1497+
ft2font.__freetype_build_type__ != 'local'):
1498+
warnings.warn(
1499+
"matplotlib is not built with the correct FreeType version to run "
1500+
"tests. Set local_freetype=True in setup.cfg and rebuild. "
1501+
"Expect many image comparison failures below.")
1502+
14911503
try:
14921504
import nose
14931505
try:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy