Пример #1
0
    def call_metapost_all_glyphs(self, master):
        writeGlobalParam(self.get_project())

        hasglyphs = False
        for glyph in master.get_glyphs():
            _glyphs = models.Glyph.filter(name=glyph.name)
            _glyphs = _glyphs.filter(models.Glyph.master_id.in_(map(lambda x: x.id, self._masters)))

            glyphs = []
            for m in self._masters:
                for g in _glyphs:
                    if g.master_id == m.id:
                        glyphs.append(g)
                        break

            if session.get('mfparser', '') == 'controlpoints':
                import xmltomf_new_2axes as xmltomf
                xmltomf.xmltomf1(self.get_lft_master(), *list(glyphs))
            else:
                import xmltomf
                xmltomf.xmltomf1(self.get_lft_master(), *list(glyphs))
            hasglyphs = True

        if hasglyphs:
            writeGlyphlist(master)
            makefont_single(self.get_lft_master())
Пример #2
0
    def get_glyphs_jsondata(self, glyphid, master):
        self.call_metapost(glyphid)

        project = self.get_project()

        instancelog = project.get_instancelog(self.get_lft_version())
        M_glyphjson = get_edges_json(instancelog, glyphid)

        glyph = models.Glyph.get(master_id=master.id, name=glyphid)
        instancelog = project.get_instancelog(master.version, 'a')
        if session.get('mfparser', '') == 'controlpoints':
            import xmltomf_new_2axes as xmltomf
            xmltomf.xmltomf1(master, glyph)
        else:
            import xmltomf
            xmltomf.xmltomf1(master, glyph)

        writeGlyphlist(master, glyph.name)
        makefont_single(master, cell='A')

        zpoints = get_edges_json_from_db(master, glyphid)

        glyphjson = get_edges_json(instancelog, glyphid)
        return {'M': M_glyphjson, 'R': glyphjson, 'zpoints': zpoints}