diff --git a/tests/maximum_color_test.py b/tests/maximum_color_test.py index 64200e3a..335378a0 100644 --- a/tests/maximum_color_test.py +++ b/tests/maximum_color_test.py @@ -17,6 +17,7 @@ import copy from fontTools import ttLib from nanoemoji.keep_glyph_names import keep_glyph_names +from picosvg.svg import SVG from pathlib import Path import pytest import sys @@ -143,3 +144,21 @@ def test_zero_advance_width_colrv1_to_svg(): assert maximum_font["COLR"].table.BaseGlyphList.BaseGlyphCount == 2 assert "SVG " in maximum_font assert len(maximum_font["SVG "].docList) == 2 + + # check that 'acutecomb' still has 0 advance width + assert initial_font["hmtx"]["acutecomb"] == (0, 0) + # it has not been cropped away (has a non-empty bounding box) + doc = maximum_font["SVG "].docList[1] + assert doc.startGlyphID == doc.endGlyphID == maximum_font.getGlyphID("acutecomb") + svg = SVG.fromstring(doc.data) + shapes = list(svg.shapes()) + assert len(shapes) == 1 + bbox = shapes[0].bounding_box() + assert bbox.w > 0 + assert bbox.h > 0 + # its bbox matches the respective COLR ClipBox dimensions (quantized to 10) + clipBox = maximum_font["COLR"].table.ClipList.clips["acutecomb"] + assert abs(bbox.w - (clipBox.xMax - clipBox.xMin)) <= 10 + assert abs(bbox.h - (clipBox.yMax - clipBox.yMin)) <= 10 + # the SVG shape's horizontal positioning also matches the respective COLR glyph + assert abs(bbox.x - clipBox.xMin) <= 10