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
ad787106
Commit
ad787106
authored
May 07, 2019
by
Nikolaus Waxweiler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
instantiator.py: do not copy glyph lib, remove Variator.neutral_master
parent
15cc6b74
Pipeline
#80229
passed with stage
in 2 minutes and 14 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
23 deletions
+13
-23
scripts/instantiator.py
scripts/instantiator.py
+13
-23
No files found.
scripts/instantiator.py
View file @
ad787106
...
...
@@ -211,19 +211,15 @@ class Instantiator:
# Glyphs
for
glyph_name
,
glyph_mutator
in
self
.
glyph_mutators
.
items
():
glyph
=
font
.
newGlyph
(
glyph_name
)
neutral
=
glyph_mutator
.
neutral_master
()
glyph_instance
=
glyph_mutator
.
instance_at
(
location_normalized
)
if
self
.
round_geometry
:
glyph_instance
=
glyph_instance
.
round
()
glyph_instance
.
extractGlyph
(
glyph
,
onlyGeometry
=
True
)
glyph
.
width
=
glyph_instance
.
width
glyph
.
unicodes
=
neutral
.
unicodes
#
XXX: What to do about a glyphs lib key? Any useful data that should be
#
copied from master to all instances? `public.verticalOrigin`, does it
# interpolate? `public.postscript.hints`?
glyph
.
lib
.
clear
()
#
onlyGeometry=True does not set name and unicodes, in ufoLib2 we can't
#
modify a glyph's name. Copy unicodes.
glyph_instance
.
extractGlyph
(
glyph
,
onlyGeometry
=
True
)
glyph
.
unicodes
=
glyph_instance
.
unicodes
# Process rules
glyph_names_list
=
self
.
glyph_mutators
.
keys
()
...
...
@@ -317,6 +313,12 @@ def collect_glyph_masters(
continue
source_glyph
=
source_layer
[
glyph_name
]
# XXX: What to do about a glyphs lib key? Any useful data that should be
# copied from master to all instances? `public.verticalOrigin`, does it
# interpolate? `public.postscript.hints`?
source_glyph
.
lib
.
clear
()
normalized_location
=
normalize_design_location
(
source
.
location
,
axis_bounds
)
locations_and_masters
.
append
(
(
normalized_location
,
fontMath
.
MathGlyph
(
source_glyph
))
...
...
@@ -406,9 +408,9 @@ def swapGlyphNames(font, oldName, newName, swapNameExtension="_______________swa
@
attr
.
s
(
auto_attribs
=
True
,
frozen
=
True
,
slots
=
True
)
class
Variator
:
"""A middle-man class that ingests a mapping of
locations to masters plus
axis definitions and uses varLib to spit out interpolated instances at
specifi
ed locations.
"""A middle-man class that ingests a mapping of
normalized locations to
masters plus axis definitions and uses varLib to spit out interpolated
instances at specified normaliz
ed locations.
fontMath objects stand in for the actual master objects from the
UFO. Upon generating an instance, these objects have to be extracted
...
...
@@ -431,17 +433,5 @@ class Variator:
return
cls
(
masters
,
model
)
def
get
(
self
,
key
)
->
FontMathObject
:
if
key
in
self
.
model
.
locations
:
i
=
self
.
model
.
locations
.
index
(
key
)
return
self
.
masters
[
i
]
return
None
def
neutral_master
(
self
)
->
FontMathObject
:
neutral
=
self
.
get
({})
if
neutral
is
None
:
raise
ValueError
(
"Can't find the neutral master."
)
return
neutral
def
instance_at
(
self
,
normalized_location
:
Location
)
->
FontMathObject
:
return
self
.
model
.
interpolateFromMasters
(
normalized_location
,
self
.
masters
)
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