diff --git a/Lib/glyphsLib/builder/builders.py b/Lib/glyphsLib/builder/builders.py index 939c2d4cb..7bb472c21 100644 --- a/Lib/glyphsLib/builder/builders.py +++ b/Lib/glyphsLib/builder/builders.py @@ -168,6 +168,9 @@ def __init__( self._do_filter_instances_by_family = True def _is_vertical(self): + for feature in self.font.features: + if feature.name in ["vert", "vrt2", "vkna"]: + return True master_ids = {m.id for m in self.font.masters} for glyph in self.font.glyphs: for layer in glyph.layers: diff --git a/Lib/glyphsLib/builder/glyph.py b/Lib/glyphsLib/builder/glyph.py index f3a355e0d..c355f8476 100644 --- a/Lib/glyphsLib/builder/glyph.py +++ b/Lib/glyphsLib/builder/glyph.py @@ -139,7 +139,7 @@ def to_ufo_glyph(self, ufo_glyph, layer, glyph): # noqa: C901 self.to_ufo_components(ufo_glyph, layer) self.to_ufo_glyph_anchors(ufo_glyph, layer.anchors) if self.is_vertical: - self.to_ufo_glyph_height_and_vertical_origin(ufo_glyph, layer) + self.to_ufo_glyph_height_and_vertical_origin(ufo_font, ufo_glyph, layer) def to_glyphs_glyph(self, ufo_glyph, ufo_layer, master): # noqa: C901 @@ -261,7 +261,7 @@ def to_glyphs_glyph(self, ufo_glyph, ufo_layer, master): # noqa: C901 self.to_glyphs_glyph_height_and_vertical_origin(ufo_glyph, master, layer) -def to_ufo_glyph_height_and_vertical_origin(self, ufo_glyph, layer): +def to_ufo_glyph_height_and_vertical_origin(self, ufo_font, ufo_glyph, layer): # implentation based on: # https://github.com/googlefonts/glyphsLib/issues/557#issuecomment-667074856 assert self.is_vertical @@ -270,6 +270,8 @@ def to_ufo_glyph_height_and_vertical_origin(self, ufo_glyph, layer): if layer.vertWidth: ufo_glyph.height = layer.vertWidth + elif "rotat" in ufo_glyph.name: + ufo_glyph.height = ufo_font[ufo_glyph.name.replace(".rotat", "")].width else: ufo_glyph.height = ascender - descender