Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cantarell-fonts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
cantarell-fonts
Commits
64b909ca
Commit
64b909ca
authored
May 13, 2019
by
Nikolaus Waxweiler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make use of new ufo2ft and fontTools APIs
parent
054c051a
Pipeline
#81718
passed with stage
in 2 minutes and 38 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
24 deletions
+6
-24
scripts/instantiator.py
scripts/instantiator.py
+2
-4
scripts/make-variable-font.py
scripts/make-variable-font.py
+4
-20
No files found.
scripts/instantiator.py
View file @
64b909ca
...
...
@@ -66,12 +66,10 @@ class Instantiator:
"Can't generate UFOs from this designspace: no default font."
)
designspace
.
loadSourceFonts
(
ufoLib2
.
Font
.
open
)
glyph_names
:
Set
[
str
]
=
set
()
for
source
in
designspace
.
sources
:
if
source
.
font
is
None
:
if
not
Path
(
source
.
path
).
exists
():
raise
ValueError
(
f
"Source at path '
{
source
.
path
}
' not found."
)
source
.
font
=
ufoLib2
.
Font
.
open
(
source
.
path
,
lazy
=
False
)
glyph_names
.
update
(
source
.
font
.
keys
())
# Construct Variators
...
...
scripts/make-variable-font.py
View file @
64b909ca
...
...
@@ -32,32 +32,16 @@ output_path = args.output_path.resolve()
# 1. Load Designspace and filter out instances that are marked as non-exportable.
designspace
=
fontTools
.
designspaceLib
.
DesignSpaceDocument
.
fromfile
(
designspace_path
)
for
source
in
designspace
.
sources
:
source
.
font
=
ufoLib2
.
Font
.
open
(
designspace_path
.
parent
/
source
.
filename
)
# 1.5. Apply ufo2ft filters to masters before compiling them -- in ufo2ft up to and
# including 2.8.0, filters were applied in compileInterpolatableOTFsFromDS, but not
# compileInterpolatableTTFsFromDS. Do it manually to be sure...
pre_filter
,
post_filter
=
ufo2ft
.
filters
.
loadFilters
(
source
.
font
)
for
pf
in
pre_filter
:
pf
(
font
=
source
.
font
)
for
pf
in
post_filter
:
pf
(
font
=
source
.
font
)
# ... and then delete the key so they aren't re-applied.
del
source
.
font
.
lib
[
"com.github.googlei18n.ufo2ft.filters"
]
designspace
.
loadSourceFonts
(
ufoLib2
.
Font
.
open
)
designspace
.
instances
=
[
s
for
s
in
designspace
.
instances
if
s
.
lib
.
get
(
"com.schriftgestaltung.export"
,
True
)
]
# 2. Compile interpolatable master TTFs.
ufo2ft
.
compileInterpolatableTTFsFromDS
(
designspace
,
inplace
=
True
)
# 3. Combine masters into a variable TTF.
varfont
,
_
,
_
=
fontTools
.
varLib
.
build
(
designspace
)
# 2. Compile variable TTF from the masters.
varfont
=
ufo2ft
.
compileVariableTTF
(
designspace
,
inplace
=
True
)
#
4
. Generate STAT table.
#
3
. Generate STAT table.
stylespace
=
statmake
.
classes
.
Stylespace
.
from_file
(
stylespace_path
)
statmake
.
lib
.
apply_stylespace_to_variable_font
(
stylespace
,
varfont
,
{})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment