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
8c7e6e21
Commit
8c7e6e21
authored
May 18, 2019
by
Nikolaus Waxweiler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Instantiator: properly(?) generate OS/2 width class
parent
64b909ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
scripts/instantiator.py
scripts/instantiator.py
+19
-2
No files found.
scripts/instantiator.py
View file @
8c7e6e21
...
...
@@ -34,6 +34,19 @@ Location = Mapping[str, float]
# to reduce differences between the variable and static instances.
fontMath
.
mathFunctions
.
setRoundIntegerFunction
(
fontTools
.
misc
.
fixedTools
.
otRound
)
# For mapping `wdth` axis user values to the OS2 table's width class field.
WDTH_VALUE_TO_OS2_WIDTH_CLASS
=
{
50
:
1
,
62.5
:
2
,
75
:
3
,
87.5
:
4
,
100
:
5
,
112.5
:
6
,
125
:
7
,
150
:
8
,
200
:
9
,
}
@
attr
.
s
(
auto_attribs
=
True
,
frozen
=
True
,
slots
=
True
)
class
Instantiator
:
...
...
@@ -193,9 +206,13 @@ class Instantiator:
if
"wdth"
in
self
.
weight_width_axes
:
width_axis
=
self
.
weight_width_axes
[
"wdth"
]
width_axis_instance_location
=
instance
.
location
[
width_axis
.
name
]
font
.
info
.
openTypeOS2WidthClass
=
fontTools
.
misc
.
fixedTools
.
otRound
(
width_axis
.
map_backward
(
width_axis_instance_location
)
width_value
=
width_axis
.
map_backward
(
width_axis_instance_location
)
width_class
=
int
(
varLib
.
models
.
piecewiseLinearMap
(
width_value
,
WDTH_VALUE_TO_OS2_WIDTH_CLASS
)
)
font
.
info
.
openTypeOS2WidthClass
=
width_class
# Glyphs
for
glyph_name
,
glyph_mutator
in
self
.
glyph_mutators
.
items
():
...
...
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