Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sebastian Friedl
GYPT Fonts
Commits
81bf45b3
Commit
81bf45b3
authored
Sep 09, 2021
by
Sebastian Friedl
Browse files
Patch Small Capitals
parent
8b9d8559
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/11-slice.py
View file @
81bf45b3
...
...
@@ -112,6 +112,40 @@ def update_flags(instance, weight, italic=False):
instance
[
'head'
].
macStyle
=
mac_style
def
patch_small_caps
(
font
,
style
,
italic
=
False
):
gsub
=
font
[
'GSUB'
].
table
lookup_list
=
[]
for
fr
in
[
fr
for
fr
in
gsub
.
FeatureList
.
FeatureRecord
if
fr
.
FeatureTag
==
'smcp'
]:
lookup_list
+=
fr
.
Feature
.
LookupListIndex
for
lookup_id
in
list
(
sorted
(
set
(
lookup_list
))):
lookup
=
gsub
.
LookupList
.
Lookup
[
lookup_id
]
for
substitution_table
in
lookup
.
SubTable
:
if
substitution_table
.
LookupType
!=
1
:
continue
if
style
==
'Serif'
and
not
italic
:
# lookup 35 sets different numbers for smallcaps
if
lookup_id
==
35
:
for
g
in
list
(
substitution_table
.
mapping
.
keys
()):
del
substitution_table
.
mapping
[
g
]
# replace ß with appropriate glyph (not ss)
if
'germandbls'
in
substitution_table
.
mapping
:
substitution_table
.
mapping
[
'germandbls'
]
=
'glyph01192'
if
style
==
'Sans'
and
not
italic
:
# lookup 88 sets different numbers for smallcaps
if
lookup_id
==
88
:
for
g
in
list
(
substitution_table
.
mapping
.
keys
()):
del
substitution_table
.
mapping
[
g
]
# replace ß with appropriate glyph (not ss)
if
'germandbls'
in
substitution_table
.
mapping
:
substitution_table
.
mapping
[
'germandbls'
]
=
'glyph01708'
def
slice_font
(
style
,
source
,
weight
,
adobe_weight
,
verbose_weight
,
italic
=
False
):
source_dir
=
_root_dir
/
'adobe'
/
'-'
.
join
(
source
.
split
(
' '
)[:
2
]).
lower
()
/
'VAR'
source_fnt
=
f
'
{
source
.
replace
(
" "
,
""
)
}
-
{
"Roman"
if
not
italic
else
"Italic"
}
.ttf'
...
...
@@ -123,7 +157,7 @@ def slice_font(style, source, weight, adobe_weight, verbose_weight, italic=False
update_name_table
(
instance
,
style
,
weight
,
verbose_weight
,
italic
)
update_flags
(
instance
,
weight
,
italic
)
# TODO:
patch
small
caps
patch
_
small
_
caps
(
instance
,
style
,
italic
)
output_dir
=
_root_dir
/
'out'
/
f
'gypt-
{
style
.
lower
()
}
'
/
'TTF'
output_fnt
=
f
'GYPT
{
style
}
-
{
(
weight
!
=
400
or
not
italic
)
*
verbose_weight
}{
italic
*
"It"
}
.ttf'
...
...
Write
Preview
Supports
Markdown
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