Example #1
0
 def test_single_component_glyph(self, font):
     philter = PropagateAnchorsFilter(include={"a-cyr"})
     assert philter(font) == {"a-cyr"}
     assert [(a.name, a.x, a.y) for a in font["a-cyr"].anchors] == [
         ("bottom", 175, 0),
         ("top", 175, 300),
     ]
Example #2
0
 def test_fail_during_anchor_propagation(self, font):
     name = "emacron"
     with CapturingLogHandler(logger, level="WARNING") as captor:
         philter = PropagateAnchorsFilter(include={name})
         philter(font)
     captor.assertRegex("Anchors not propagated for inexistent component e "
                        "in glyph emacron")
Example #3
0
 def test_whole_font(self, font):
     philter = PropagateAnchorsFilter()
     modified = philter(font)
     assert modified == set([
         'a-cyr', 'amacron', 'adieresis', 'adieresismacron',
         'amacrondieresis', 'a_a'
     ])
Example #4
0
 def test_nested_component_glyph(self, font):
     name = 'amacrondieresis'
     philter = PropagateAnchorsFilter(include={name})
     assert philter(font) == {name}
     assert ([(a.name, a.x, a.y)
              for a in font[name].anchors] == [('bottom', 175, 0),
                                               ('top', 175, 660)])
Example #5
0
 def test_one_anchor_two_component_glyph(self, font):
     name = 'amacron'
     philter = PropagateAnchorsFilter(include={name})
     assert philter(font) == {name}
     assert ([(a.name, a.x, a.y)
              for a in font[name].anchors] == [('top', 176, 481),
                                               ('bottom', 175, 0)])
Example #6
0
 def test_nested_component_glyph(self, font):
     name = "amacrondieresis"
     philter = PropagateAnchorsFilter(include={name})
     assert philter(font) == {name}
     assert [(a.name, a.x, a.y) for a in font[name].anchors] == [
         ("bottom", 175, 0),
         ("top", 175, 660),
     ]
Example #7
0
 def test_one_anchor_two_component_glyph(self, font):
     name = "amacron"
     philter = PropagateAnchorsFilter(include={name})
     assert philter(font) == {name}
     assert [(a.name, a.x, a.y) for a in font[name].anchors] == [
         ("top", 176, 481),
         ("bottom", 175, 0),
     ]
Example #8
0
 def test_ligature_glyph(self, font):
     name = 'a_a'
     philter = PropagateAnchorsFilter(include={name})
     assert philter(font) == {name}
     assert ([(a.name, a.x, a.y)
              for a in font[name].anchors] == [('bottom_1', 175, 0),
                                               ('bottom_2', 525, 0),
                                               ('top_1', 175, 300),
                                               ('top_2', 525, 300)])
Example #9
0
 def test_ligature_glyph(self, font):
     name = "a_a"
     philter = PropagateAnchorsFilter(include={name})
     assert philter(font) == {name}
     assert [(a.name, a.x, a.y) for a in font[name].anchors] == [
         ("bottom_1", 175, 0),
         ("bottom_2", 525, 0),
         ("top_1", 175, 300),
         ("top_2", 525, 300),
     ]
Example #10
0
 def test_whole_font(self, font):
     philter = PropagateAnchorsFilter()
     modified = philter(font)
     assert modified == set([
         "a-cyr",
         "amacron",
         "adieresis",
         "adieresismacron",
         "amacrondieresis",
         "a_a",
     ])
Example #11
0
 def test_logger(self, font):
     with CapturingLogHandler(logger, level="INFO") as captor:
         philter = PropagateAnchorsFilter()
         philter(font)
     captor.assertRegex("Glyphs with propagated anchors: 6")
Example #12
0
 def test_contour_glyph(self, font):
     philter = PropagateAnchorsFilter(include={"a"})
     assert not philter(font)
Example #13
0
 def test_empty_glyph(self, font):
     philter = PropagateAnchorsFilter(include={"space"})
     assert not philter(font)
Example #14
0
 def test_single_component_glyph(self, font):
     philter = PropagateAnchorsFilter(include={'a-cyr'})
     assert philter(font) == {'a-cyr'}
     assert ([(a.name, a.x, a.y)
              for a in font['a-cyr'].anchors] == [('bottom', 175, 0),
                                                  ('top', 175, 300)])