Skip to content

WIP: New FreeType wrappers #5414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
038cd9c
Remove ft2font
mdboom Nov 5, 2015
5e4c36e
Install freetypy from git
mdboom Nov 5, 2015
0cc61e9
Remove tests and examples that are now obsolete
mdboom Nov 5, 2015
d97def9
Use freetypy in font_manager.py
mdboom Nov 5, 2015
23c2f07
Move from FT2Font to freetypy for all uses
mdboom Nov 5, 2015
c91d988
Update comment
mdboom Nov 5, 2015
440fc51
Move local freetype building resp. to freetypy
mdboom Nov 5, 2015
632a6f6
Bugfix for AFM fonts
mdboom Nov 5, 2015
72cedd3
Remove usage of ttconv, in favor of freetypy.subset
mdboom Nov 18, 2015
4eaa209
Use font config in place of font_manager
mdboom Nov 18, 2015
04c14db
Font layout details
mdboom Nov 18, 2015
d8ca0d5
Bug fixes in new font universe
mdboom Dec 1, 2015
28fb1dc
Build freetypy with specific version of freetype
mdboom Dec 1, 2015
b7d73af
Install fcpy on Travis
mdboom Jan 22, 2016
d45129f
Minor fixes and consistency cleanups
mdboom Jan 22, 2016
cbd59dc
Fix merge
mdboom Jan 22, 2016
19bc0a3
Fix y-alignment
mdboom Apr 11, 2016
2825e44
Fix SVG
mdboom Apr 11, 2016
39a5e79
Fix y-alignment
mdboom Apr 11, 2016
1dfb7b8
Fix rendering of mathtext
mdboom Apr 11, 2016
d2ceb8e
Fix deprecation warnings
mdboom Apr 12, 2016
0208eb5
Remove obsolete test
mdboom Apr 19, 2016
ed07ac8
Fix requirements
mdboom Apr 28, 2016
2261d48
Narrow builds no longer relevant
mdboom Apr 28, 2016
e7e8065
Improve layout-to-bitmap API
mdboom Apr 28, 2016
e3f921e
Fix spacing in PDF
mdboom Apr 28, 2016
6ce033f
Fix slant handling
mdboom Apr 28, 2016
641d2b4
Make single directory font lookup work
mdboom Apr 28, 2016
b55c8eb
Fix deprecated rcParam warnings
mdboom Apr 28, 2016
607767e
Fix font styles test
mdboom Apr 28, 2016
e037636
Fix layout in legends
mdboom Apr 28, 2016
d00777d
Bugfix
mdboom Apr 28, 2016
4c68718
Handle AFM files correctly
mdboom Apr 29, 2016
0d10ec1
Use new layout API
mdboom Apr 29, 2016
9d6632f
Update test images
mdboom Apr 29, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move local freetype building resp. to freetypy
  • Loading branch information
mdboom committed Apr 11, 2016
commit 440fc5141107f6557360b01b3e78ecef23d056f5
8 changes: 4 additions & 4 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1536,11 +1536,11 @@ def _init_tests():
# tests. This must match the value in `setupext.py`
LOCAL_FREETYPE_VERSION = '2.6.1'

from matplotlib import ft2font
if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or
ft2font.__freetype_build_type__ != 'local'):
import freetypy as ft
if (ft.__freetype_version__ != LOCAL_FREETYPE_VERSION or
ft.__freetype_build_type__ != 'local'):
warnings.warn(
"matplotlib is not built with the correct FreeType version to run "
"freetypy is not built with the correct FreeType version to run "
"tests. Set local_freetype=True in setup.cfg and rebuild. "
"Expect many image comparison failures below.")

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/font_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import numpy as np

from matplotlib import ceil
from math import ceil


def draw_glyph_to_bitmap(image, x, y, glyph):
Expand Down
5 changes: 2 additions & 3 deletions lib/matplotlib/testing/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import nose
import numpy as np
import freetypy as ft

import matplotlib as mpl
import matplotlib.style
Expand Down Expand Up @@ -164,8 +165,6 @@ def wrapped_callable(*args, **kwargs):


def check_freetype_version(ver):
import freetypy as ft

if ver is None:
return True

Expand Down Expand Up @@ -263,7 +262,7 @@ def do_test():
if not check_freetype_version(self._freetype_version):
raise KnownFailureTest(
"Mismatched version of freetype. Test requires '%s', you have '%s'" %
(self._freetype_version, ft2font.__freetype_version__))
(self._freetype_version, ft.__freetype_version__))
raise

yield (do_test,)
Expand Down
7 changes: 0 additions & 7 deletions setup.cfg.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@
# This can be a single directory or a comma-delimited list of directories.
#basedirlist = /usr

[test]
# If you plan to develop matplotlib and run or add to the test suite,
# set this to True. It will download and build a specific version of
# FreeType, and then use that to build the ft2font extension. This
# ensures that test images are exactly reproducible.
#local_freetype = False

[status]
# To suppress display of the dependencies and their versions
# at the top of the build log, uncomment the following line:
Expand Down
65 changes: 0 additions & 65 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,53 +20,6 @@
PY32min = (PY3min and sys.version_info[1] >= 2 or sys.version_info[0] > 3)


def _get_home():
"""Find user's home directory if possible.
Otherwise, returns None.

:see:
http://mail.python.org/pipermail/python-list/2005-February/325395.html
"""
try:
if not PY3min and sys.platform == 'win32':
path = os.path.expanduser(b"~").decode(sys.getfilesystemencoding())
else:
path = os.path.expanduser("~")
except ImportError:
# This happens on Google App Engine (pwd module is not present).
pass
else:
if os.path.isdir(path):
return path
for evar in ('HOME', 'USERPROFILE', 'TMP'):
path = os.environ.get(evar)
if path is not None and os.path.isdir(path):
return path
return None


def _get_xdg_cache_dir():
"""
Returns the XDG cache directory, according to the `XDG
base directory spec
<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
"""
path = os.environ.get('XDG_CACHE_HOME')
if path is None:
path = _get_home()
if path is not None:
path = os.path.join(path, '.cache', 'matplotlib')
return path


# This is the version of FreeType to use when building a local
# version. It must match the value in
# lib/matplotlib.__init__.py and also needs to be changed below in the
# embedded windows build script (grep for "REMINDER" in this file)
LOCAL_FREETYPE_VERSION = '2.6.1'
# md5 hash of the freetype tarball
LOCAL_FREETYPE_HASH = '348e667d728c597360e4a87c16556597'

if sys.platform != 'win32':
if not PY3min:
from commands import getstatusoutput
Expand Down Expand Up @@ -107,9 +60,6 @@ def _get_xdg_cache_dir():
options['basedirlist'] = [
x.strip() for x in
config.get("directories", "basedirlist").split(',')]

if config.has_option('test', 'local_freetype'):
options['local_freetype'] = config.getboolean("test", "local_freetype")
else:
config = None

Expand Down Expand Up @@ -284,21 +234,6 @@ def make_extension(name, files, *args, **kwargs):
return ext


def get_file_hash(filename):
"""
Get the MD5 hash of a given filename.
"""
import hashlib
BLOCKSIZE = 1 << 16
hasher = hashlib.md5()
with open(filename, 'rb') as fd:
buf = fd.read(BLOCKSIZE)
while len(buf) > 0:
hasher.update(buf)
buf = fd.read(BLOCKSIZE)
return hasher.hexdigest()


class PkgConfig(object):
"""
This is a class for communicating with pkg-config.
Expand Down