TTFQuery 2.0.0b1__tar.gz → 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ttfquery-2.1.0/PKG-INFO +89 -0
- ttfquery-2.1.0/README.md +19 -0
- ttfquery-2.1.0/TTFQuery.egg-info/PKG-INFO +89 -0
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/TTFQuery.egg-info/SOURCES.txt +7 -1
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/TTFQuery.egg-info/entry_points.txt +0 -1
- ttfquery-2.1.0/TTFQuery.egg-info/requires.txt +6 -0
- ttfquery-2.1.0/pyproject.toml +102 -0
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/setup.cfg +0 -1
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/setup.py +4 -5
- ttfquery-2.1.0/tests/test_describe.py +56 -0
- ttfquery-2.1.0/tests/test_findsystem_linux.py +18 -0
- ttfquery-2.1.0/tests/test_findsystem_win32.py +20 -0
- ttfquery-2.1.0/tests/test_glyphquery.py +47 -0
- ttfquery-2.1.0/tests/test_registry.py +60 -0
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/ttfquery/__init__.py +1 -1
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/ttfquery/_scriptregistry.py +3 -3
- ttfquery-2.1.0/ttfquery/describe.py +338 -0
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/ttfquery/findsystem.py +25 -22
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/ttfquery/glyph.py +5 -5
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/ttfquery/glyphquery.py +8 -8
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/ttfquery/guessdescription.py +5 -3
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/ttfquery/scriptregistry.py +3 -2
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/ttfquery/ttffamily.py +1 -1
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/ttfquery/ttffiles.py +32 -24
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/ttfquery/ttfgroups.py +9 -6
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/ttfquery/ttfmetadata.py +3 -3
- TTFQuery-2.0.0b1/PKG-INFO +0 -38
- TTFQuery-2.0.0b1/TTFQuery.egg-info/PKG-INFO +0 -38
- TTFQuery-2.0.0b1/TTFQuery.egg-info/requires.txt +0 -2
- TTFQuery-2.0.0b1/ttfquery/describe.py +0 -294
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/MANIFEST.in +0 -0
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/TTFQuery.egg-info/dependency_links.txt +0 -0
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/TTFQuery.egg-info/top_level.txt +0 -0
- {TTFQuery-2.0.0b1 → ttfquery-2.1.0}/license.txt +0 -0
ttfquery-2.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: TTFQuery
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: FontTools-based package for querying system fonts
|
|
5
|
+
Home-page: http://ttfquery.sourceforge.net/
|
|
6
|
+
Author: Mike C. Fletcher
|
|
7
|
+
Author-email: "Mike C. Fletcher" <mcfletch@users.sourceforge.net>
|
|
8
|
+
License: THIS SOFTWARE IS NOT FAULT TOLERANT AND SHOULD NOT BE USED IN ANY
|
|
9
|
+
SITUATION ENDANGERING HUMAN LIFE OR PROPERTY.
|
|
10
|
+
|
|
11
|
+
TTFQuery License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2003-2018, Michael C. Fletcher and Contributors
|
|
14
|
+
All rights reserved.
|
|
15
|
+
|
|
16
|
+
Redistribution and use in source and binary forms, with or without
|
|
17
|
+
modification, are permitted provided that the following conditions
|
|
18
|
+
are met:
|
|
19
|
+
|
|
20
|
+
Redistributions of source code must retain the above copyright
|
|
21
|
+
notice, this list of conditions and the following disclaimer.
|
|
22
|
+
|
|
23
|
+
Redistributions in binary form must reproduce the above
|
|
24
|
+
copyright notice, this list of conditions and the following
|
|
25
|
+
disclaimer in the documentation and/or other materials
|
|
26
|
+
provided with the distribution.
|
|
27
|
+
|
|
28
|
+
The name of Michael C. Fletcher, or the name of any Contributor,
|
|
29
|
+
may not be used to endorse or promote products derived from this
|
|
30
|
+
software without specific prior written permission.
|
|
31
|
+
|
|
32
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
33
|
+
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
34
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
35
|
+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
36
|
+
COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
37
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
38
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
39
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
40
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
41
|
+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
42
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
43
|
+
OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
Project-URL: Homepage, http://ttfquery.sourceforge.net/
|
|
47
|
+
Keywords: fonttools,ttf,truetype,outline,font,curve,system fonts
|
|
48
|
+
Platform: Any
|
|
49
|
+
Classifier: Programming Language :: Python :: 3
|
|
50
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
51
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
52
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
53
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
54
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
55
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
56
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
57
|
+
Classifier: Intended Audience :: Developers
|
|
58
|
+
Classifier: Operating System :: OS Independent
|
|
59
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
60
|
+
Requires-Python: >=3.9
|
|
61
|
+
Description-Content-Type: text/markdown
|
|
62
|
+
Requires-Dist: fonttools
|
|
63
|
+
Requires-Dist: numpy
|
|
64
|
+
Provides-Extra: test
|
|
65
|
+
Requires-Dist: pytest; extra == "test"
|
|
66
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
67
|
+
Dynamic: author
|
|
68
|
+
Dynamic: home-page
|
|
69
|
+
Dynamic: platform
|
|
70
|
+
|
|
71
|
+
# TTFQuery
|
|
72
|
+
|
|
73
|
+
FontTools-based package for querying system fonts
|
|
74
|
+
|
|
75
|
+
TTFQuery builds on the FontTools package to allow the Python programmer to accomplish a number of tasks:
|
|
76
|
+
|
|
77
|
+
* query the system to find installed fonts
|
|
78
|
+
* retrieve metadata about any TTF font file (even those not yet installed)
|
|
79
|
+
* abstract family type
|
|
80
|
+
* proper font name
|
|
81
|
+
* glyph outlines
|
|
82
|
+
* build simple metadata registries for run-time font matching
|
|
83
|
+
|
|
84
|
+
With these functionalities, it is possible to readily create OpenGL solid-text
|
|
85
|
+
rendering libraries which can accept abstract font-family names as font
|
|
86
|
+
specifiers and deliver platform-specific TTF files to match those libraries.
|
|
87
|
+
|
|
88
|
+
TTFQuery doesn't provide rendering services, but a sample implementation can be
|
|
89
|
+
found in the OpenGLContext project, from which TTFQuery was refactored.
|
ttfquery-2.1.0/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# TTFQuery
|
|
2
|
+
|
|
3
|
+
FontTools-based package for querying system fonts
|
|
4
|
+
|
|
5
|
+
TTFQuery builds on the FontTools package to allow the Python programmer to accomplish a number of tasks:
|
|
6
|
+
|
|
7
|
+
* query the system to find installed fonts
|
|
8
|
+
* retrieve metadata about any TTF font file (even those not yet installed)
|
|
9
|
+
* abstract family type
|
|
10
|
+
* proper font name
|
|
11
|
+
* glyph outlines
|
|
12
|
+
* build simple metadata registries for run-time font matching
|
|
13
|
+
|
|
14
|
+
With these functionalities, it is possible to readily create OpenGL solid-text
|
|
15
|
+
rendering libraries which can accept abstract font-family names as font
|
|
16
|
+
specifiers and deliver platform-specific TTF files to match those libraries.
|
|
17
|
+
|
|
18
|
+
TTFQuery doesn't provide rendering services, but a sample implementation can be
|
|
19
|
+
found in the OpenGLContext project, from which TTFQuery was refactored.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: TTFQuery
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: FontTools-based package for querying system fonts
|
|
5
|
+
Home-page: http://ttfquery.sourceforge.net/
|
|
6
|
+
Author: Mike C. Fletcher
|
|
7
|
+
Author-email: "Mike C. Fletcher" <mcfletch@users.sourceforge.net>
|
|
8
|
+
License: THIS SOFTWARE IS NOT FAULT TOLERANT AND SHOULD NOT BE USED IN ANY
|
|
9
|
+
SITUATION ENDANGERING HUMAN LIFE OR PROPERTY.
|
|
10
|
+
|
|
11
|
+
TTFQuery License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2003-2018, Michael C. Fletcher and Contributors
|
|
14
|
+
All rights reserved.
|
|
15
|
+
|
|
16
|
+
Redistribution and use in source and binary forms, with or without
|
|
17
|
+
modification, are permitted provided that the following conditions
|
|
18
|
+
are met:
|
|
19
|
+
|
|
20
|
+
Redistributions of source code must retain the above copyright
|
|
21
|
+
notice, this list of conditions and the following disclaimer.
|
|
22
|
+
|
|
23
|
+
Redistributions in binary form must reproduce the above
|
|
24
|
+
copyright notice, this list of conditions and the following
|
|
25
|
+
disclaimer in the documentation and/or other materials
|
|
26
|
+
provided with the distribution.
|
|
27
|
+
|
|
28
|
+
The name of Michael C. Fletcher, or the name of any Contributor,
|
|
29
|
+
may not be used to endorse or promote products derived from this
|
|
30
|
+
software without specific prior written permission.
|
|
31
|
+
|
|
32
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
33
|
+
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
34
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
35
|
+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
36
|
+
COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
37
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
38
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
39
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
40
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
41
|
+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
42
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
43
|
+
OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
Project-URL: Homepage, http://ttfquery.sourceforge.net/
|
|
47
|
+
Keywords: fonttools,ttf,truetype,outline,font,curve,system fonts
|
|
48
|
+
Platform: Any
|
|
49
|
+
Classifier: Programming Language :: Python :: 3
|
|
50
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
51
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
52
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
53
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
54
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
55
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
56
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
57
|
+
Classifier: Intended Audience :: Developers
|
|
58
|
+
Classifier: Operating System :: OS Independent
|
|
59
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
60
|
+
Requires-Python: >=3.9
|
|
61
|
+
Description-Content-Type: text/markdown
|
|
62
|
+
Requires-Dist: fonttools
|
|
63
|
+
Requires-Dist: numpy
|
|
64
|
+
Provides-Extra: test
|
|
65
|
+
Requires-Dist: pytest; extra == "test"
|
|
66
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
67
|
+
Dynamic: author
|
|
68
|
+
Dynamic: home-page
|
|
69
|
+
Dynamic: platform
|
|
70
|
+
|
|
71
|
+
# TTFQuery
|
|
72
|
+
|
|
73
|
+
FontTools-based package for querying system fonts
|
|
74
|
+
|
|
75
|
+
TTFQuery builds on the FontTools package to allow the Python programmer to accomplish a number of tasks:
|
|
76
|
+
|
|
77
|
+
* query the system to find installed fonts
|
|
78
|
+
* retrieve metadata about any TTF font file (even those not yet installed)
|
|
79
|
+
* abstract family type
|
|
80
|
+
* proper font name
|
|
81
|
+
* glyph outlines
|
|
82
|
+
* build simple metadata registries for run-time font matching
|
|
83
|
+
|
|
84
|
+
With these functionalities, it is possible to readily create OpenGL solid-text
|
|
85
|
+
rendering libraries which can accept abstract font-family names as font
|
|
86
|
+
specifiers and deliver platform-specific TTF files to match those libraries.
|
|
87
|
+
|
|
88
|
+
TTFQuery doesn't provide rendering services, but a sample implementation can be
|
|
89
|
+
found in the OpenGLContext project, from which TTFQuery was refactored.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
MANIFEST.in
|
|
2
|
+
README.md
|
|
2
3
|
license.txt
|
|
3
|
-
|
|
4
|
+
pyproject.toml
|
|
4
5
|
setup.py
|
|
5
6
|
TTFQuery.egg-info/PKG-INFO
|
|
6
7
|
TTFQuery.egg-info/SOURCES.txt
|
|
@@ -8,6 +9,11 @@ TTFQuery.egg-info/dependency_links.txt
|
|
|
8
9
|
TTFQuery.egg-info/entry_points.txt
|
|
9
10
|
TTFQuery.egg-info/requires.txt
|
|
10
11
|
TTFQuery.egg-info/top_level.txt
|
|
12
|
+
tests/test_describe.py
|
|
13
|
+
tests/test_findsystem_linux.py
|
|
14
|
+
tests/test_findsystem_win32.py
|
|
15
|
+
tests/test_glyphquery.py
|
|
16
|
+
tests/test_registry.py
|
|
11
17
|
ttfquery/__init__.py
|
|
12
18
|
ttfquery/_scriptregistry.py
|
|
13
19
|
ttfquery/describe.py
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "TTFQuery"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "FontTools-based package for querying system fonts"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "license.txt" }
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Mike C. Fletcher", email = "mcfletch@users.sourceforge.net" },
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.9"
|
|
15
|
+
dependencies = [
|
|
16
|
+
"fonttools",
|
|
17
|
+
"numpy",
|
|
18
|
+
]
|
|
19
|
+
keywords = [
|
|
20
|
+
"fonttools",
|
|
21
|
+
"ttf",
|
|
22
|
+
"truetype",
|
|
23
|
+
"outline",
|
|
24
|
+
"font",
|
|
25
|
+
"curve",
|
|
26
|
+
"system fonts",
|
|
27
|
+
]
|
|
28
|
+
classifiers = [
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
31
|
+
"Programming Language :: Python :: 3.9",
|
|
32
|
+
"Programming Language :: Python :: 3.10",
|
|
33
|
+
"Programming Language :: Python :: 3.11",
|
|
34
|
+
"Programming Language :: Python :: 3.12",
|
|
35
|
+
"Programming Language :: Python :: 3.13",
|
|
36
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
37
|
+
"Intended Audience :: Developers",
|
|
38
|
+
"Operating System :: OS Independent",
|
|
39
|
+
"Topic :: Multimedia :: Graphics",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
Homepage = "http://ttfquery.sourceforge.net/"
|
|
44
|
+
|
|
45
|
+
[project.optional-dependencies]
|
|
46
|
+
test = [
|
|
47
|
+
"pytest",
|
|
48
|
+
"pytest-cov",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[project.scripts]
|
|
52
|
+
ttffiles = "ttfquery.ttffiles:main"
|
|
53
|
+
ttffamily = "ttfquery.ttffamily:main"
|
|
54
|
+
ttfgroups = "ttfquery.ttfgroups:main"
|
|
55
|
+
ttfmetadata = "ttfquery.ttfmetadata:main"
|
|
56
|
+
|
|
57
|
+
[tool.setuptools]
|
|
58
|
+
packages = ["ttfquery"]
|
|
59
|
+
|
|
60
|
+
[tool.setuptools.dynamic]
|
|
61
|
+
version = { attr = "ttfquery.__version__" }
|
|
62
|
+
|
|
63
|
+
# uv decides whether its cached metadata for a source tree is still current
|
|
64
|
+
# from pyproject.toml, setup.py and setup.cfg alone. This project's version
|
|
65
|
+
# lives in ttfquery/__init__.py, so name that file too: without it a version
|
|
66
|
+
# bump leaves uv answering with the previous number, and a dependent requiring
|
|
67
|
+
# the new one resolves against PyPI rather than this checkout.
|
|
68
|
+
[tool.uv]
|
|
69
|
+
cache-keys = [{ file = "pyproject.toml" }, { file = "ttfquery/__init__.py" }]
|
|
70
|
+
|
|
71
|
+
# Named explicitly rather than left to ruff's default, which has widened
|
|
72
|
+
# between releases: a gate whose meaning moves when a tool is upgraded is not a
|
|
73
|
+
# gate. `E,W,F,B` is what the other pre-2010 projects here hold to.
|
|
74
|
+
[tool.ruff.lint]
|
|
75
|
+
select = ["E", "W", "F", "B"]
|
|
76
|
+
# `_name` as well as `_`: an underscore prefix is how Python says a name is
|
|
77
|
+
# bound but deliberately unused.
|
|
78
|
+
dummy-variable-rgx = "^(_[a-zA-Z0-9_]*|err)$"
|
|
79
|
+
ignore = [
|
|
80
|
+
'E501', # long lines, kept readable by hand
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
# The package's own declarations, checked as a consumer's checker reads them.
|
|
84
|
+
# `check_untyped_defs` rather than `disallow_untyped_defs`: this package is
|
|
85
|
+
# older than annotations, and its bodies being checked is the half that finds
|
|
86
|
+
# defects -- the other half is a job of its own, tracked as one.
|
|
87
|
+
[tool.mypy]
|
|
88
|
+
# Named here so that `mypy` with no arguments checks the package: the tox
|
|
89
|
+
# environment and a developer's bare `mypy` are then the same run.
|
|
90
|
+
files = ["ttfquery"]
|
|
91
|
+
python_version = "3.12"
|
|
92
|
+
check_untyped_defs = true
|
|
93
|
+
warn_unused_ignores = true
|
|
94
|
+
ignore_missing_imports = true
|
|
95
|
+
|
|
96
|
+
# `findsystem` reads the Windows font directories out of the registry, and
|
|
97
|
+
# `winreg` is a module Linux does not have. Checked as Windows sees it in a
|
|
98
|
+
# second run -- see tools/preflight.toml -- so this keeps the Linux run from
|
|
99
|
+
# reporting nine absent names as defects.
|
|
100
|
+
[[tool.mypy.overrides]]
|
|
101
|
+
module = "ttfquery.findsystem"
|
|
102
|
+
disable_error_code = ["attr-defined"]
|
|
@@ -5,7 +5,7 @@ Run:
|
|
|
5
5
|
python setup.py install
|
|
6
6
|
to install the package from the source archive.
|
|
7
7
|
"""
|
|
8
|
-
import
|
|
8
|
+
import os
|
|
9
9
|
from setuptools import setup
|
|
10
10
|
HERE = os.path.dirname(__file__)
|
|
11
11
|
|
|
@@ -32,11 +32,10 @@ if __name__ == "__main__":
|
|
|
32
32
|
'ttfquery':'ttfquery',
|
|
33
33
|
},
|
|
34
34
|
packages = [
|
|
35
|
-
'ttfquery',
|
|
35
|
+
'ttfquery',
|
|
36
36
|
],
|
|
37
|
-
|
|
37
|
+
install_requires = ['fonttools','numpy'],
|
|
38
38
|
classifiers= [
|
|
39
|
-
"""License :: OSI Approved :: BSD License""",
|
|
40
39
|
"""Programming Language :: Python""",
|
|
41
40
|
"""Topic :: Software Development :: Libraries :: Python Modules""",
|
|
42
41
|
"""Intended Audience :: Developers""",
|
|
@@ -75,4 +74,4 @@ which TTFQuery was refactored.
|
|
|
75
74
|
]
|
|
76
75
|
}
|
|
77
76
|
)
|
|
78
|
-
|
|
77
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
from ttfquery import describe, findsystem
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
class TestDescribe(unittest.TestCase):
|
|
6
|
+
def test_describe_system_fonts(self):
|
|
7
|
+
for fontfile in list(findsystem.findFonts())[:100]:
|
|
8
|
+
try:
|
|
9
|
+
font = describe.openFont(fontfile)
|
|
10
|
+
except Exception as err:
|
|
11
|
+
err.args += ('Error opening font', font)
|
|
12
|
+
raise
|
|
13
|
+
else:
|
|
14
|
+
short = describe.shortName( font )
|
|
15
|
+
assert short, "Null name for font %s"%(fontfile,)
|
|
16
|
+
family = describe.family( font )
|
|
17
|
+
assert len(family)==2, family
|
|
18
|
+
modifiers = describe.modifiers( font )
|
|
19
|
+
assert describe.weightName(modifiers[0])
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class TestTheNameIsText:
|
|
23
|
+
"""`shortName` answers what the font calls itself, as text.
|
|
24
|
+
|
|
25
|
+
A name record is bytes in one of two encodings, and answering those bytes
|
|
26
|
+
put `b'Open Sans'` into every message that named a font and left the font
|
|
27
|
+
registry decoding what this had just encoded.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def a_font(self):
|
|
31
|
+
from ttfquery import findsystem
|
|
32
|
+
for path in findsystem.findFonts():
|
|
33
|
+
try:
|
|
34
|
+
return describe.openFont(path)
|
|
35
|
+
except Exception:
|
|
36
|
+
continue
|
|
37
|
+
return None
|
|
38
|
+
|
|
39
|
+
def test_both_halves_are_strings(self):
|
|
40
|
+
font = self.a_font()
|
|
41
|
+
if font is None:
|
|
42
|
+
import pytest
|
|
43
|
+
pytest.skip('no readable font on this machine')
|
|
44
|
+
name, family = describe.shortName(font)
|
|
45
|
+
assert isinstance(name, str), repr(name)
|
|
46
|
+
assert isinstance(family, str), repr(family)
|
|
47
|
+
|
|
48
|
+
def test_a_two_byte_record_is_read_as_utf_16(self):
|
|
49
|
+
assert describe._recordText('Ångstrom'.encode('utf-16-be')) == \
|
|
50
|
+
'Ångstrom'
|
|
51
|
+
|
|
52
|
+
def test_a_single_byte_record_is_read_as_latin_1(self):
|
|
53
|
+
assert describe._recordText(b'Open Sans') == 'Open Sans'
|
|
54
|
+
|
|
55
|
+
def test_text_is_left_as_it_is(self):
|
|
56
|
+
assert describe._recordText('Open Sans') == 'Open Sans'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
from ttfquery import findsystem
|
|
3
|
+
import pytest
|
|
4
|
+
import sys
|
|
5
|
+
import unittest
|
|
6
|
+
pytestmark = pytest.mark.skipif(
|
|
7
|
+
not sys.platform.startswith('linux'),
|
|
8
|
+
reason='Linux tests'
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
class TestLinux(unittest.TestCase):
|
|
12
|
+
def test_font_directory(self):
|
|
13
|
+
"""Validate that at least one font directory can be found"""
|
|
14
|
+
directories = findsystem.linuxFontDirectories()
|
|
15
|
+
assert directories, "No font directories were found, *something* should be there"
|
|
16
|
+
def test_fonts_from_registry(self):
|
|
17
|
+
fonts = findsystem.findFonts()
|
|
18
|
+
assert fonts, "No fonts were found in our default font-search paths"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
from ttfquery import findsystem
|
|
3
|
+
import pytest
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
import glob
|
|
7
|
+
import unittest
|
|
8
|
+
pytestmark = pytest.mark.skipif(not sys.platform == 'win32', reason='Win32 tests')
|
|
9
|
+
|
|
10
|
+
class TestWin32(unittest.TestCase):
|
|
11
|
+
def test_font_directory(self):
|
|
12
|
+
"""Validate that the fonts directory windows reports is not empty"""
|
|
13
|
+
dirname = findsystem.win32FontDirectory()
|
|
14
|
+
assert glob.glob(os.path.join(dirname,'*.ttf')), "No .ttf files found in Win32 font directory %s"%(
|
|
15
|
+
dirname,
|
|
16
|
+
)
|
|
17
|
+
def test_fonts_from_registry(self):
|
|
18
|
+
dirname = 'c:\\should-not-exist-and-if-it-does-you-know-you-did-it'
|
|
19
|
+
fontpaths = findsystem.win32InstalledFonts(dirname)
|
|
20
|
+
assert fontpaths, "Did not find any registry-supplied fonts"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
from ttfquery import ttffiles, describe, glyphquery, glyph
|
|
3
|
+
import os
|
|
4
|
+
import unittest
|
|
5
|
+
import tempfile
|
|
6
|
+
import shutil
|
|
7
|
+
|
|
8
|
+
class TestGlyphQuery(unittest.TestCase):
|
|
9
|
+
def setUp(self):
|
|
10
|
+
self.workdir = tempfile.mkdtemp(prefix='ttfquery-',suffix='-tests')
|
|
11
|
+
self.registry = os.path.join(self.workdir,'fonts.cache')
|
|
12
|
+
class fakeoptions:
|
|
13
|
+
directories = []
|
|
14
|
+
registry = self.registry
|
|
15
|
+
self.options = fakeoptions
|
|
16
|
+
self.registry = ttffiles.registry_for_options(self.options)
|
|
17
|
+
def tearDown(self):
|
|
18
|
+
shutil.rmtree(self.workdir)
|
|
19
|
+
|
|
20
|
+
def test_has_a_glyph(self):
|
|
21
|
+
has,total = 0,0
|
|
22
|
+
for _name,metadata in self.registry.specificFonts.items():
|
|
23
|
+
font = describe.openFont(metadata.file_name)
|
|
24
|
+
glyphquery.charHeight(font)
|
|
25
|
+
glyphquery.lineHeight(font)
|
|
26
|
+
glyphquery.charDescent(font)
|
|
27
|
+
if glyphquery.hasGlyph(font,'a'):
|
|
28
|
+
glyphName = glyphquery.explicitGlyph(font,'a')
|
|
29
|
+
if glyphName:
|
|
30
|
+
glyphquery.width(font,glyphName)
|
|
31
|
+
has += 1
|
|
32
|
+
|
|
33
|
+
shape = glyph.Glyph(glyphName)
|
|
34
|
+
shape.compile(font)
|
|
35
|
+
assert shape.contours, "No contours generated"
|
|
36
|
+
assert shape.outlines, "No outlines generated"
|
|
37
|
+
assert shape.width, "Width of `a` character was null"
|
|
38
|
+
assert shape.height, "Width of `a` character was null"
|
|
39
|
+
|
|
40
|
+
else:
|
|
41
|
+
glyphName = glyphquery.glyphName(font,'a')
|
|
42
|
+
assert glyphName, """Didn't get a placeholder for the 'a' character"""
|
|
43
|
+
glyphquery.width(font,glyphName)
|
|
44
|
+
total += 1
|
|
45
|
+
assert total, "No specific fonts on this system?"
|
|
46
|
+
assert has/float(total) > .2, "More than 4/5 of fonts on this system are missing a glyph for `a`? %s/%s"%(has,total)
|
|
47
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
from ttfquery import ttffiles, ttfgroups, ttfmetadata, ttffamily
|
|
3
|
+
import os
|
|
4
|
+
import unittest
|
|
5
|
+
import tempfile
|
|
6
|
+
import shutil
|
|
7
|
+
|
|
8
|
+
class TestRegistry(unittest.TestCase):
|
|
9
|
+
def setUp(self):
|
|
10
|
+
self.workdir = tempfile.mkdtemp(prefix='ttfquery-',suffix='-tests')
|
|
11
|
+
self.registry = os.path.join(self.workdir,'fonts.cache')
|
|
12
|
+
class fakeoptions:
|
|
13
|
+
directories = []
|
|
14
|
+
registry = self.registry
|
|
15
|
+
self.options = fakeoptions
|
|
16
|
+
self.registry = ttffiles.registry_for_options(self.options)
|
|
17
|
+
def tearDown(self):
|
|
18
|
+
shutil.rmtree(self.workdir)
|
|
19
|
+
def test_registry_setup(self):
|
|
20
|
+
registry = self.registry
|
|
21
|
+
assert registry.fonts, "No fonts loaded"
|
|
22
|
+
assert registry.families, "No families extracted"
|
|
23
|
+
assert registry.specificFonts, "No final/specific font classes registered"
|
|
24
|
+
assert registry.files, "No files registered/added"
|
|
25
|
+
assert registry.shortFiles, "No short filenames registered"
|
|
26
|
+
assert not registry.DIRTY, "Registry was just saved, should be clean"
|
|
27
|
+
|
|
28
|
+
font = None
|
|
29
|
+
for name in ('Arial','Helvetica','SANS'):
|
|
30
|
+
try:
|
|
31
|
+
font = registry.matchName(name)
|
|
32
|
+
except KeyError:
|
|
33
|
+
pass
|
|
34
|
+
if font:
|
|
35
|
+
break
|
|
36
|
+
if not font:
|
|
37
|
+
raise RuntimeError("Unable to find any of Arial/Helvetica/SANS")
|
|
38
|
+
|
|
39
|
+
def test_ttfgroups(self):
|
|
40
|
+
registry = self.registry
|
|
41
|
+
table = ttfgroups.buildTable(registry)
|
|
42
|
+
ttfgroups.run_report(table)
|
|
43
|
+
|
|
44
|
+
parser = ttfgroups.get_options()
|
|
45
|
+
assert 'font-groups' in parser.description, parser.description
|
|
46
|
+
|
|
47
|
+
def test_ttfmetadata(self):
|
|
48
|
+
registry = self.registry
|
|
49
|
+
for name in registry.fonts.keys():
|
|
50
|
+
ttfmetadata.find_match(name,registry)
|
|
51
|
+
|
|
52
|
+
parser = ttfmetadata.get_options()
|
|
53
|
+
assert 'Query/search' in parser.description, parser.description
|
|
54
|
+
|
|
55
|
+
def test_ttffamily(self):
|
|
56
|
+
registry = self.registry
|
|
57
|
+
for family,subfams in registry.families.items():
|
|
58
|
+
ttffamily.search(registry,family)
|
|
59
|
+
for subfam in subfams.keys():
|
|
60
|
+
ttffamily.search(registry,family,subfam)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""Fonttools package for querying and sorting system fonts"""
|
|
2
|
-
__version__ = "2.0
|
|
2
|
+
__version__ = "2.1.0"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""The singleton "registry" object (an instance of :class:`ttfquery.ttffiles.Registry`
|
|
2
|
-
is the only member of note). This registry with be created in a file
|
|
3
|
-
in the user's $HOME directory ``.font.cache`` if the $HOME environment variable
|
|
4
|
-
is defined. Otherwise will be created in the ttfquery source code directory
|
|
2
|
+
is the only member of note). This registry with be created in a file
|
|
3
|
+
in the user's $HOME directory ``.font.cache`` if the $HOME environment variable
|
|
4
|
+
is defined. Otherwise will be created in the ttfquery source code directory
|
|
5
5
|
(which is obviously not a very good solution).
|
|
6
6
|
|
|
7
7
|
.. note::
|