Skip to content

Commit e5148c6

Browse files
committed
check if normal kerning pairs exist
1 parent 6b0f7dd commit e5148c6

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

kernFeatureWriter.py

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -776,28 +776,32 @@ def _make_fea_data(self, args):
776776
order_ltr.extend(order_ltr_ext)
777777
order_rtl.extend(order_rtl_ext)
778778

779-
for container_dict, minKern, comment, enum in order_ltr:
780-
if container_dict:
781-
output.append(comment)
782-
output.append(
783-
self._dict2pos(container_dict, minKern, enum))
784-
785-
if self.write_subtables:
786-
self.num_subtables = 0
787-
788-
glyph_to_class_subtables = MakeMeasuredSubtables(
789-
kp.glyph_group, kp.kerning, kp.groups,
790-
self.subtable_size).subtables
791-
output.extend(self._build_st_output(
792-
glyph_to_class_subtables, '\n# glyph, group:'))
793-
794-
class_to_class_subtables = MakeMeasuredSubtables(
795-
kp.group_group, kp.kerning, kp.groups,
796-
self.subtable_size).subtables
797-
output.extend(self._build_st_output(
798-
class_to_class_subtables,
799-
'\n# group, glyph and group, group:')
800-
)
779+
# Check if LTR pairs exist
780+
ltr_container_dicts = [i[0] for i in order_ltr_ext + order_ltr]
781+
if any(ltr_container_dicts):
782+
783+
for container_dict, minKern, comment, enum in order_ltr:
784+
if container_dict:
785+
output.append(comment)
786+
output.append(
787+
self._dict2pos(container_dict, minKern, enum))
788+
789+
if self.write_subtables:
790+
self.num_subtables = 0
791+
792+
glyph_to_class_subtables = MakeMeasuredSubtables(
793+
kp.glyph_group, kp.kerning, kp.groups,
794+
self.subtable_size).subtables
795+
output.extend(self._build_st_output(
796+
glyph_to_class_subtables, '\n# glyph, group:'))
797+
798+
class_to_class_subtables = MakeMeasuredSubtables(
799+
kp.group_group, kp.kerning, kp.groups,
800+
self.subtable_size).subtables
801+
output.extend(self._build_st_output(
802+
class_to_class_subtables,
803+
'\n# group, glyph and group, group:')
804+
)
801805

802806
# Check if RTL pairs exist
803807
rtl_container_dicts = [i[0] for i in order_rtl_ext + order_rtl]

0 commit comments

Comments
 (0)