TTFQuery 1.0.5__tar.gz → 2.0.1a1__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.0.1a1/PKG-INFO +83 -0
- ttfquery-2.0.1a1/README.md +19 -0
- ttfquery-2.0.1a1/TTFQuery.egg-info/PKG-INFO +83 -0
- {TTFQuery-1.0.5 → ttfquery-2.0.1a1}/TTFQuery.egg-info/SOURCES.txt +10 -4
- ttfquery-2.0.1a1/TTFQuery.egg-info/entry_points.txt +5 -0
- ttfquery-2.0.1a1/TTFQuery.egg-info/requires.txt +6 -0
- {TTFQuery-1.0.5 → ttfquery-2.0.1a1}/license.txt +1 -1
- ttfquery-2.0.1a1/pyproject.toml +55 -0
- {TTFQuery-1.0.5 → ttfquery-2.0.1a1}/setup.cfg +0 -1
- {TTFQuery-1.0.5 → ttfquery-2.0.1a1}/setup.py +40 -50
- ttfquery-2.0.1a1/tests/test_describe.py +20 -0
- ttfquery-2.0.1a1/tests/test_findsystem_linux.py +18 -0
- ttfquery-2.0.1a1/tests/test_findsystem_win32.py +17 -0
- ttfquery-2.0.1a1/tests/test_glyphquery.py +45 -0
- ttfquery-2.0.1a1/tests/test_registry.py +59 -0
- {TTFQuery-1.0.5 → ttfquery-2.0.1a1}/ttfquery/__init__.py +1 -1
- ttfquery-2.0.1a1/ttfquery/_scriptregistry.py +16 -0
- ttfquery-2.0.1a1/ttfquery/describe.py +332 -0
- {TTFQuery-1.0.5 → ttfquery-2.0.1a1}/ttfquery/findsystem.py +20 -14
- {TTFQuery-1.0.5 → ttfquery-2.0.1a1}/ttfquery/glyph.py +14 -11
- {TTFQuery-1.0.5 → ttfquery-2.0.1a1}/ttfquery/guessdescription.py +3 -2
- ttfquery-2.0.1a1/ttfquery/scriptregistry.py +37 -0
- ttfquery-2.0.1a1/ttfquery/ttffamily.py +37 -0
- {TTFQuery-1.0.5 → ttfquery-2.0.1a1}/ttfquery/ttffiles.py +174 -76
- ttfquery-2.0.1a1/ttfquery/ttfgroups.py +50 -0
- ttfquery-2.0.1a1/ttfquery/ttfmetadata.py +41 -0
- TTFQuery-1.0.5/PKG-INFO +0 -37
- TTFQuery-1.0.5/TTFQuery.egg-info/PKG-INFO +0 -37
- TTFQuery-1.0.5/bin/ttffamily +0 -5
- TTFQuery-1.0.5/bin/ttffiles +0 -5
- TTFQuery-1.0.5/bin/ttfgroups +0 -5
- TTFQuery-1.0.5/bin/ttfmetadata +0 -5
- TTFQuery-1.0.5/ttfquery/_scriptregistry.py +0 -41
- TTFQuery-1.0.5/ttfquery/describe.py +0 -289
- TTFQuery-1.0.5/ttfquery/ttffamily.py +0 -30
- TTFQuery-1.0.5/ttfquery/ttfgroups.py +0 -94
- TTFQuery-1.0.5/ttfquery/ttfmetadata.py +0 -36
- {TTFQuery-1.0.5 → ttfquery-2.0.1a1}/MANIFEST.in +0 -0
- {TTFQuery-1.0.5 → ttfquery-2.0.1a1}/TTFQuery.egg-info/dependency_links.txt +0 -0
- {TTFQuery-1.0.5 → ttfquery-2.0.1a1}/TTFQuery.egg-info/top_level.txt +0 -0
- {TTFQuery-1.0.5 → ttfquery-2.0.1a1}/ttfquery/glyphquery.py +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: TTFQuery
|
|
3
|
+
Version: 2.0.1a1
|
|
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
|
|
50
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
51
|
+
Classifier: Intended Audience :: Developers
|
|
52
|
+
Classifier: Operating System :: OS Independent
|
|
53
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
54
|
+
Requires-Python: >=3.7
|
|
55
|
+
Description-Content-Type: text/markdown
|
|
56
|
+
Requires-Dist: fonttools
|
|
57
|
+
Requires-Dist: numpy
|
|
58
|
+
Provides-Extra: test
|
|
59
|
+
Requires-Dist: pytest; extra == "test"
|
|
60
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
61
|
+
Dynamic: author
|
|
62
|
+
Dynamic: home-page
|
|
63
|
+
Dynamic: platform
|
|
64
|
+
|
|
65
|
+
# TTFQuery
|
|
66
|
+
|
|
67
|
+
FontTools-based package for querying system fonts
|
|
68
|
+
|
|
69
|
+
TTFQuery builds on the FontTools package to allow the Python programmer to accomplish a number of tasks:
|
|
70
|
+
|
|
71
|
+
* query the system to find installed fonts
|
|
72
|
+
* retrieve metadata about any TTF font file (even those not yet installed)
|
|
73
|
+
* abstract family type
|
|
74
|
+
* proper font name
|
|
75
|
+
* glyph outlines
|
|
76
|
+
* build simple metadata registries for run-time font matching
|
|
77
|
+
|
|
78
|
+
With these functionalities, it is possible to readily create OpenGL solid-text
|
|
79
|
+
rendering libraries which can accept abstract font-family names as font
|
|
80
|
+
specifiers and deliver platform-specific TTF files to match those libraries.
|
|
81
|
+
|
|
82
|
+
TTFQuery doesn't provide rendering services, but a sample implementation can be
|
|
83
|
+
found in the OpenGLContext project, from which TTFQuery was refactored.
|
|
@@ -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,83 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: TTFQuery
|
|
3
|
+
Version: 2.0.1a1
|
|
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
|
|
50
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
51
|
+
Classifier: Intended Audience :: Developers
|
|
52
|
+
Classifier: Operating System :: OS Independent
|
|
53
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
54
|
+
Requires-Python: >=3.7
|
|
55
|
+
Description-Content-Type: text/markdown
|
|
56
|
+
Requires-Dist: fonttools
|
|
57
|
+
Requires-Dist: numpy
|
|
58
|
+
Provides-Extra: test
|
|
59
|
+
Requires-Dist: pytest; extra == "test"
|
|
60
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
61
|
+
Dynamic: author
|
|
62
|
+
Dynamic: home-page
|
|
63
|
+
Dynamic: platform
|
|
64
|
+
|
|
65
|
+
# TTFQuery
|
|
66
|
+
|
|
67
|
+
FontTools-based package for querying system fonts
|
|
68
|
+
|
|
69
|
+
TTFQuery builds on the FontTools package to allow the Python programmer to accomplish a number of tasks:
|
|
70
|
+
|
|
71
|
+
* query the system to find installed fonts
|
|
72
|
+
* retrieve metadata about any TTF font file (even those not yet installed)
|
|
73
|
+
* abstract family type
|
|
74
|
+
* proper font name
|
|
75
|
+
* glyph outlines
|
|
76
|
+
* build simple metadata registries for run-time font matching
|
|
77
|
+
|
|
78
|
+
With these functionalities, it is possible to readily create OpenGL solid-text
|
|
79
|
+
rendering libraries which can accept abstract font-family names as font
|
|
80
|
+
specifiers and deliver platform-specific TTF files to match those libraries.
|
|
81
|
+
|
|
82
|
+
TTFQuery doesn't provide rendering services, but a sample implementation can be
|
|
83
|
+
found in the OpenGLContext project, from which TTFQuery was refactored.
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
MANIFEST.in
|
|
2
|
+
README.md
|
|
2
3
|
license.txt
|
|
4
|
+
pyproject.toml
|
|
3
5
|
setup.py
|
|
4
6
|
TTFQuery.egg-info/PKG-INFO
|
|
5
7
|
TTFQuery.egg-info/SOURCES.txt
|
|
6
8
|
TTFQuery.egg-info/dependency_links.txt
|
|
9
|
+
TTFQuery.egg-info/entry_points.txt
|
|
10
|
+
TTFQuery.egg-info/requires.txt
|
|
7
11
|
TTFQuery.egg-info/top_level.txt
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
12
17
|
ttfquery/__init__.py
|
|
13
18
|
ttfquery/_scriptregistry.py
|
|
14
19
|
ttfquery/describe.py
|
|
@@ -16,6 +21,7 @@ ttfquery/findsystem.py
|
|
|
16
21
|
ttfquery/glyph.py
|
|
17
22
|
ttfquery/glyphquery.py
|
|
18
23
|
ttfquery/guessdescription.py
|
|
24
|
+
ttfquery/scriptregistry.py
|
|
19
25
|
ttfquery/ttffamily.py
|
|
20
26
|
ttfquery/ttffiles.py
|
|
21
27
|
ttfquery/ttfgroups.py
|
|
@@ -3,7 +3,7 @@ SITUATION ENDANGERING HUMAN LIFE OR PROPERTY.
|
|
|
3
3
|
|
|
4
4
|
TTFQuery License
|
|
5
5
|
|
|
6
|
-
Copyright (c) 2003, Michael C. Fletcher and Contributors
|
|
6
|
+
Copyright (c) 2003-2018, Michael C. Fletcher and Contributors
|
|
7
7
|
All rights reserved.
|
|
8
8
|
|
|
9
9
|
Redistribution and use in source and binary forms, with or without
|
|
@@ -0,0 +1,55 @@
|
|
|
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.7"
|
|
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",
|
|
30
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
31
|
+
"Intended Audience :: Developers",
|
|
32
|
+
"Operating System :: OS Independent",
|
|
33
|
+
"Topic :: Multimedia :: Graphics",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "http://ttfquery.sourceforge.net/"
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
test = [
|
|
41
|
+
"pytest",
|
|
42
|
+
"pytest-cov",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.scripts]
|
|
46
|
+
ttffiles = "ttfquery.ttffiles:main"
|
|
47
|
+
ttffamily = "ttfquery.ttffamily:main"
|
|
48
|
+
ttfgroups = "ttfquery.ttfgroups:main"
|
|
49
|
+
ttfmetadata = "ttfquery.ttfmetadata:main"
|
|
50
|
+
|
|
51
|
+
[tool.setuptools]
|
|
52
|
+
packages = ["ttfquery"]
|
|
53
|
+
|
|
54
|
+
[tool.setuptools.dynamic]
|
|
55
|
+
version = { attr = "ttfquery.__version__" }
|
|
@@ -5,35 +5,45 @@ Run:
|
|
|
5
5
|
python setup.py install
|
|
6
6
|
to install the package from the source archive.
|
|
7
7
|
"""
|
|
8
|
-
import sys,os, string
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
except ImportError, err:
|
|
12
|
-
from distutils.core import setup
|
|
13
|
-
from sys import hexversion
|
|
8
|
+
import sys, os, string
|
|
9
|
+
from setuptools import setup
|
|
10
|
+
HERE = os.path.dirname(__file__)
|
|
14
11
|
|
|
15
12
|
def find_version( ):
|
|
16
|
-
for line in open( os.path.join( 'ttfquery','__init__.py')):
|
|
13
|
+
for line in open( os.path.join( HERE, 'ttfquery','__init__.py')):
|
|
17
14
|
if line.strip().startswith( '__version__' ):
|
|
18
|
-
return
|
|
15
|
+
return line.split('=')[1].strip().strip('"').strip("'")
|
|
19
16
|
raise RuntimeError( """No __version__ = 'string' in __init__.py""" )
|
|
20
17
|
version = find_version()
|
|
21
18
|
|
|
22
19
|
if __name__ == "__main__":
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
'
|
|
36
|
-
|
|
20
|
+
|
|
21
|
+
### Now the actual set up call
|
|
22
|
+
setup (
|
|
23
|
+
name = "TTFQuery",
|
|
24
|
+
version = version,
|
|
25
|
+
description = "FontTools-based package for querying system fonts",
|
|
26
|
+
author = "Mike C. Fletcher",
|
|
27
|
+
author_email = "mcfletch@users.sourceforge.net",
|
|
28
|
+
url = "http://ttfquery.sourceforge.net/",
|
|
29
|
+
license = "BSD-style, see license.txt for details",
|
|
30
|
+
|
|
31
|
+
package_dir = {
|
|
32
|
+
'ttfquery':'ttfquery',
|
|
33
|
+
},
|
|
34
|
+
packages = [
|
|
35
|
+
'ttfquery',
|
|
36
|
+
],
|
|
37
|
+
install_requires = ['fonttools','numpy'],
|
|
38
|
+
classifiers= [
|
|
39
|
+
"""Programming Language :: Python""",
|
|
40
|
+
"""Topic :: Software Development :: Libraries :: Python Modules""",
|
|
41
|
+
"""Intended Audience :: Developers""",
|
|
42
|
+
"""Operating System :: OS Independent""",
|
|
43
|
+
"""Topic :: Multimedia :: Graphics""",
|
|
44
|
+
],
|
|
45
|
+
keywords= 'fonttools,ttf,truetype,outline,font,curve,system fonts',
|
|
46
|
+
long_description= """FontTools-based package for querying system fonts
|
|
37
47
|
|
|
38
48
|
TTFQuery builds on the FontTools package to allow the Python programmer to accomplish a number of tasks:
|
|
39
49
|
|
|
@@ -54,34 +64,14 @@ TTFQuery doesn't provide rendering services, but a sample
|
|
|
54
64
|
implementation can be found in the OpenGLContext project, from
|
|
55
65
|
which TTFQuery was refactored.
|
|
56
66
|
""",
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
platforms= ['Any'],
|
|
68
|
+
entry_points={
|
|
69
|
+
'console_scripts': [
|
|
70
|
+
'ttffiles=ttfquery.ttffiles:main',
|
|
71
|
+
'ttffamily=ttfquery.ttffamily:main',
|
|
72
|
+
'ttfgroups=ttfquery.ttfgroups:main',
|
|
73
|
+
'ttfmetadata=ttfquery.ttfmetadata:main',
|
|
74
|
+
]
|
|
61
75
|
}
|
|
62
|
-
|
|
63
|
-
### Now the actual set up call
|
|
64
|
-
setup (
|
|
65
|
-
name = "TTFQuery",
|
|
66
|
-
version = version,
|
|
67
|
-
description = "FontTools-based package for querying system fonts",
|
|
68
|
-
author = "Mike C. Fletcher",
|
|
69
|
-
author_email = "mcfletch@users.sourceforge.net",
|
|
70
|
-
url = "http://ttfquery.sourceforge.net/",
|
|
71
|
-
license = "BSD-style, see license.txt for details",
|
|
72
|
-
|
|
73
|
-
package_dir = {
|
|
74
|
-
'ttfquery':'ttfquery',
|
|
75
|
-
},
|
|
76
|
-
packages = [
|
|
77
|
-
'ttfquery',
|
|
78
|
-
],
|
|
79
|
-
scripts = [
|
|
80
|
-
os.path.join( 'bin','ttffiles' ),
|
|
81
|
-
os.path.join( 'bin','ttffamily' ),
|
|
82
|
-
os.path.join( 'bin','ttfgroups' ),
|
|
83
|
-
os.path.join( 'bin','ttfmetadata' ),
|
|
84
|
-
],
|
|
85
|
-
**extraArguments
|
|
86
76
|
)
|
|
87
77
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
from ttfquery import describe, findsystem
|
|
3
|
+
import pytest
|
|
4
|
+
import sys, glob, unittest
|
|
5
|
+
|
|
6
|
+
class TestDescribe(unittest.TestCase):
|
|
7
|
+
def test_describe_system_fonts(self):
|
|
8
|
+
for fontfile in list(findsystem.findFonts())[:100]:
|
|
9
|
+
try:
|
|
10
|
+
font = describe.openFont(fontfile)
|
|
11
|
+
except Exception as err:
|
|
12
|
+
err.args += ('Error opening font', font)
|
|
13
|
+
raise
|
|
14
|
+
else:
|
|
15
|
+
short = describe.shortName( font )
|
|
16
|
+
assert short, "Null name for font %s"%(fontfile,)
|
|
17
|
+
family = describe.family( font )
|
|
18
|
+
assert len(family)==2, family
|
|
19
|
+
modifiers = describe.modifiers( font )
|
|
20
|
+
assert describe.weightName(modifiers[0])
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
from ttfquery import findsystem
|
|
3
|
+
import pytest
|
|
4
|
+
import sys, glob, unittest
|
|
5
|
+
pytestmark = pytest.mark.skipif(
|
|
6
|
+
not sys.platform.startswith('linux'),
|
|
7
|
+
reason='Linux tests'
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
class TestLinux(unittest.TestCase):
|
|
11
|
+
def test_font_directory(self):
|
|
12
|
+
"""Validate that at least one font directory can be found"""
|
|
13
|
+
directories = findsystem.linuxFontDirectories()
|
|
14
|
+
assert directories, "No font directories were found, *something* should be there"
|
|
15
|
+
def test_fonts_from_registry(self):
|
|
16
|
+
fonts = findsystem.findFonts()
|
|
17
|
+
assert fonts, "No fonts were found in our default font-search paths"
|
|
18
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
from ttfquery import findsystem
|
|
3
|
+
import pytest
|
|
4
|
+
import sys, glob, unittest
|
|
5
|
+
pytestmark = pytest.mark.skipif(not sys.platform == 'win32', reason='Win32 tests')
|
|
6
|
+
|
|
7
|
+
class TestWin32(unittest.TestCase):
|
|
8
|
+
def test_font_directory(self):
|
|
9
|
+
"""Validate that the fonts directory windows reports is not empty"""
|
|
10
|
+
dirname = findsystem.win32FontDirectory()
|
|
11
|
+
assert glob.glob(os.path.join(dirname,'*.ttf')), "No .ttf files found in Win32 font directory %s"%(
|
|
12
|
+
dirname,
|
|
13
|
+
)
|
|
14
|
+
def test_fonts_from_registry(self):
|
|
15
|
+
dirname = 'c:\\should-not-exist-and-if-it-does-you-know-you-did-it'
|
|
16
|
+
fontpaths = findsystem.win32InstalledFonts(dirname)
|
|
17
|
+
assert fontpaths, "Did not find any registry-supplied fonts"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
from ttfquery import ttffiles, describe, glyphquery, glyph
|
|
3
|
+
import pytest
|
|
4
|
+
import os, sys, glob, unittest, tempfile, shutil
|
|
5
|
+
|
|
6
|
+
class TestGlyphQuery(unittest.TestCase):
|
|
7
|
+
def setUp(self):
|
|
8
|
+
self.workdir = tempfile.mkdtemp(prefix='ttfquery-',suffix='-tests')
|
|
9
|
+
self.registry = os.path.join(self.workdir,'fonts.cache')
|
|
10
|
+
class fakeoptions:
|
|
11
|
+
directories = []
|
|
12
|
+
registry = self.registry
|
|
13
|
+
self.options = fakeoptions
|
|
14
|
+
self.registry = ttffiles.registry_for_options(self.options)
|
|
15
|
+
def tearDown(self):
|
|
16
|
+
shutil.rmtree(self.workdir)
|
|
17
|
+
|
|
18
|
+
def test_has_a_glyph(self):
|
|
19
|
+
has,total = 0,0
|
|
20
|
+
for name,metadata in self.registry.specificFonts.items():
|
|
21
|
+
font = describe.openFont(metadata.file_name)
|
|
22
|
+
height = glyphquery.charHeight(font)
|
|
23
|
+
line = glyphquery.lineHeight(font)
|
|
24
|
+
desc = glyphquery.charDescent(font)
|
|
25
|
+
if glyphquery.hasGlyph(font,'a'):
|
|
26
|
+
glyphName = glyphquery.explicitGlyph(font,'a')
|
|
27
|
+
if glyphName:
|
|
28
|
+
width = glyphquery.width(font,glyphName)
|
|
29
|
+
has += 1
|
|
30
|
+
|
|
31
|
+
shape = glyph.Glyph(glyphName)
|
|
32
|
+
shape.compile(font)
|
|
33
|
+
assert shape.contours, "No contours generated"
|
|
34
|
+
assert shape.outlines, "No outlines generated"
|
|
35
|
+
assert shape.width, "Width of `a` character was null"
|
|
36
|
+
assert shape.height, "Width of `a` character was null"
|
|
37
|
+
|
|
38
|
+
else:
|
|
39
|
+
glyphName = glyphquery.glyphName(font,'a')
|
|
40
|
+
assert glyphName, """Didn't get a placeholder for the 'a' character"""
|
|
41
|
+
width = glyphquery.width(font,glyphName)
|
|
42
|
+
total += 1
|
|
43
|
+
assert total, "No specific fonts on this system?"
|
|
44
|
+
assert has/float(total) > .2, "More than 4/5 of fonts on this system are missing a glyph for `a`? %s/%s"%(has,total)
|
|
45
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
from ttfquery import ttffiles, ttfgroups, ttfmetadata, ttffamily
|
|
3
|
+
import pytest
|
|
4
|
+
import os, sys, glob, unittest, tempfile, shutil
|
|
5
|
+
|
|
6
|
+
class TestRegistry(unittest.TestCase):
|
|
7
|
+
def setUp(self):
|
|
8
|
+
self.workdir = tempfile.mkdtemp(prefix='ttfquery-',suffix='-tests')
|
|
9
|
+
self.registry = os.path.join(self.workdir,'fonts.cache')
|
|
10
|
+
class fakeoptions:
|
|
11
|
+
directories = []
|
|
12
|
+
registry = self.registry
|
|
13
|
+
self.options = fakeoptions
|
|
14
|
+
self.registry = ttffiles.registry_for_options(self.options)
|
|
15
|
+
def tearDown(self):
|
|
16
|
+
shutil.rmtree(self.workdir)
|
|
17
|
+
def test_registry_setup(self):
|
|
18
|
+
registry = self.registry
|
|
19
|
+
assert registry.fonts, "No fonts loaded"
|
|
20
|
+
assert registry.families, "No families extracted"
|
|
21
|
+
assert registry.specificFonts, "No final/specific font classes registered"
|
|
22
|
+
assert registry.files, "No files registered/added"
|
|
23
|
+
assert registry.shortFiles, "No short filenames registered"
|
|
24
|
+
assert not registry.DIRTY, "Registry was just saved, should be clean"
|
|
25
|
+
|
|
26
|
+
font = None
|
|
27
|
+
for name in ('Arial','Helvetica','SANS'):
|
|
28
|
+
try:
|
|
29
|
+
font = registry.matchName(name)
|
|
30
|
+
except KeyError:
|
|
31
|
+
pass
|
|
32
|
+
if font:
|
|
33
|
+
break
|
|
34
|
+
if not font:
|
|
35
|
+
raise RuntimeError("Unable to find any of Arial/Helvetica/SANS")
|
|
36
|
+
|
|
37
|
+
def test_ttfgroups(self):
|
|
38
|
+
registry = self.registry
|
|
39
|
+
table = ttfgroups.buildTable(registry)
|
|
40
|
+
ttfgroups.run_report(table)
|
|
41
|
+
|
|
42
|
+
parser = ttfgroups.get_options()
|
|
43
|
+
assert 'font-groups' in parser.description, parser.description
|
|
44
|
+
|
|
45
|
+
def test_ttfmetadata(self):
|
|
46
|
+
registry = self.registry
|
|
47
|
+
for name in registry.fonts.keys():
|
|
48
|
+
ttfmetadata.find_match(name,registry)
|
|
49
|
+
|
|
50
|
+
parser = ttfmetadata.get_options()
|
|
51
|
+
assert 'Query/search' in parser.description, parser.description
|
|
52
|
+
|
|
53
|
+
def test_ttffamily(self):
|
|
54
|
+
registry = self.registry
|
|
55
|
+
for family,subfams in registry.families.items():
|
|
56
|
+
ttffamily.search(registry,family)
|
|
57
|
+
for subfam in subfams.keys():
|
|
58
|
+
ttffamily.search(registry,family,subfam)
|
|
59
|
+
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""Fonttools package for querying and sorting system fonts"""
|
|
2
|
-
__version__ = "
|
|
2
|
+
__version__ = "2.0.1a1"
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
5
|
+
(which is obviously not a very good solution).
|
|
6
|
+
|
|
7
|
+
.. note::
|
|
8
|
+
|
|
9
|
+
This module is basically here for legacy applications that used
|
|
10
|
+
the singleton registry instance. Use scriptregistry.get_registry()
|
|
11
|
+
in new code.
|
|
12
|
+
"""
|
|
13
|
+
from ttfquery import scriptregistry
|
|
14
|
+
|
|
15
|
+
_getRegistry = scriptregistry.get_registry
|
|
16
|
+
registry = scriptregistry.get_registry()
|