Example #1
0
    def openFont(self, path, overlayPath=None, anchorPath=None):
        self.font = OpenFont(path)
        for g in self.font:
          size = len(g)
          csize = len(g.components)
          if (size > 0 and csize > 0):
            decomposeGlyph(self.font, g.name)

        if overlayPath != None:
            overlayFont = OpenFont(overlayPath)
            font = self.font
            for overlayGlyph in overlayFont:
                font.insertGlyph(overlayGlyph)

        # work around a bug with vfb2ufo in which anchors are dropped from
        # glyphs containing components and no contours. "anchorPath" should
        # point to the output of src/v2/get_dropped_anchors.py
        if anchorPath:
            anchorData = json.load(open(anchorPath))
            for glyphName, anchors in anchorData.items():
                glyph = self.font[glyphName]
                for name, (x, y) in anchors.items():
                    glyph.appendAnchor(str(name), (x, y))

        self.ffont = FFont(self.font)
Example #2
0
    def openFont(self, path, overlayPath=None):
        self.font = OpenFont(path)
        for g in self.font:
            size = len(g)
            csize = len(g.components)
            if (size > 0 and csize > 0):
                decomposeGlyph(self.font, self.font[g.name])

        if overlayPath != None:
            overlayFont = OpenFont(overlayPath)
            font = self.font
            for overlayGlyph in overlayFont:
                font.insertGlyph(overlayGlyph)

        self.ffont = FFont(self.font)
Example #3
0
File: mix.py Project: google/roboto
    def openFont(self, path, overlayPath=None):
        self.font = OpenFont(path)
        for g in self.font:
          size = len(g)
          csize = len(g.components)
          if (size > 0 and csize > 0):
            decomposeGlyph(self.font, g.name)

        if overlayPath != None:
            overlayFont = OpenFont(overlayPath)
            font = self.font
            for overlayGlyph in overlayFont:
                font.insertGlyph(overlayGlyph)

        self.ffont = FFont(self.font)