Exemplo n.º 1
0
def makeMaster(styleName, weight=None, width=None):
    m = GSFontMaster()
    m.name = styleName
    if weight is not None:
        m.weightValue = weight
    if width is not None:
        m.widthValue = width
    return m
Exemplo n.º 2
0
 def test_normalizes_curved_quotes_in_names(self):
     master = GSFontMaster()
     master.customParameters = [
         GSCustomParameter(name='‘bad’', value=1),
         GSCustomParameter(name='“also bad”', value=2)
     ]
     set_custom_params(self.ufo, data=master)
     self.assertIn(GLYPHS_PREFIX + "'bad'", self.ufo.lib)
     self.assertIn(GLYPHS_PREFIX + '"also bad"', self.ufo.lib)
Exemplo n.º 3
0
 def setUp(self):
     self.font = GSFont()
     self.font.masters.append(GSFontMaster())
     self.font.glyphs.append(GSGlyph("a"))
     self.font.glyphs.append(GSGlyph("c"))
     self.font.glyphs.append(GSGlyph("f"))
     self.ufo = Font()
     self.ufo.newGlyph("a")
     self.ufo.newGlyph("c")
     self.ufo.newGlyph("f")
Exemplo n.º 4
0
 def setUp(self):
     self.font = GSFont()
     self.font.masters.append(GSFontMaster())
     self.font.glyphs.append(GSGlyph('a'))
     self.font.glyphs.append(GSGlyph('c'))
     self.font.glyphs.append(GSGlyph('f'))
     self.ufo = Font()
     self.ufo.newGlyph('a')
     self.ufo.newGlyph('c')
     self.ufo.newGlyph('f')
Exemplo n.º 5
0
def test_single_master_default_weight_400(ufo_module):
    font = GSFont()
    master = GSFontMaster()
    master.weightValue = 400
    font.masters.append(master)

    doc = to_designspace(font, ufo_module=ufo_module)

    assert len(doc.axes) == 1
    assert doc.axes[0].name == "Weight"
    assert doc.axes[0].minimum == 400
    assert doc.axes[0].default == 400
    assert doc.axes[0].maximum == 400
    assert len(doc.sources) == 1
    assert doc.sources[0].location["Weight"] == 400

    font2 = to_glyphs(doc)

    assert len(font2.masters) == 1
    assert font2.masters[0].weightValue == 400
Exemplo n.º 6
0
    def test_unique_masterid(self):
        font = generate_minimal_font()
        master2 = GSFontMaster()
        master2.ascender = 0
        master2.capHeight = 0
        master2.descender = 0
        master2.xHeight = 0
        font.masters.append(master2)
        ufos = to_ufos(font, minimize_glyphs_diffs=True)

        try:
            to_glyphs(ufos)
        except Exception as e:
            self.fail("Unexpected exception: " + str(e))

        ufos[1].lib["com.schriftgestaltung.fontMasterID"] = ufos[0].lib[
            "com.schriftgestaltung.fontMasterID"
        ]

        font_rt = to_glyphs(ufos)
        assert len({m.id for m in font_rt.masters}) == 2
Exemplo n.º 7
0
 def setUp(self):
     self.ufo = Font()
     self.font = GSFont()
     self.master = GSFontMaster()
     self.font.masters.insert(0, self.master)
     self.builder = UFOBuilder(self.font)