Exemplo n.º 1
0
    def bounds(self, glyphs, bounds):
        """
        Given an x, y, w, h bounding box, returns the union of the given
        bounding box and the bounding box the glyphs will actually be drawn
        into, not including any offsets or expansions.

        This is used to deal with glyphs that are on the wrong side of the
        origin point.
        """

        fo = font.get_font(self.font, self.size, self.bold, self.italic, 0, self.antialias, self.vertical)
        return fo.bounds(glyphs, bounds)
Exemplo n.º 2
0
    def bounds(self, glyphs, bounds):
        """
        Given an x, y, w, h bounding box, returns the union of the given
        bounding box and the bounding box the glyphs will actually be drawn
        into, not including any offsets or expansions.

        This is used to deal with glyphs that are on the wrong side of the
        origin point.
        """

        fo = font.get_font(self.font, self.size, self.bold, self.italic, 0,
                           self.antialias, self.vertical)
        return fo.bounds(glyphs, bounds)
Exemplo n.º 3
0
    def draw(self, glyphs, di, xo, yo):
        """
        Draws the glyphs to surf.
        """

        if di.override_color:
            color = di.override_color
            black_color = None
        else:
            color = self.color
            black_color = self.black_color

        fo = font.get_font(self.font, self.size, self.bold, self.italic, di.outline, self.antialias, self.vertical)
        fo.draw(di.surface, xo, yo, color, glyphs, self.underline, self.strikethrough, black_color)
Exemplo n.º 4
0
 def draw(self, glyphs, di):
     """
     Draws the glyphs to surf.
     """
     
     if di.override_color:
         color = di.override_color
         black_color = None
     else:
         color = self.color
         black_color = self.black_color
     
     fo = font.get_font(self.font, self.size, self.bold, self.italic, di.outline, self.antialias, self.vertical)
     fo.draw(di.surface, 0, 0, color, glyphs, self.underline, self.strikethrough, black_color)
Exemplo n.º 5
0
    def glyphs(self, s):
        """
        Return the list of glyphs corresponding to unicode string s.
        """

        fo = font.get_font(self.font, self.size, self.bold, self.italic, 0, self.antialias, self.vertical)
        rv = fo.glyphs(s)

        # Apply kerning to the glyphs.
        if self.kerning:
            textsupport.kerning(rv, self.kerning)

        if self.hyperlink:
            for g in rv:
                g.hyperlink = self.hyperlink

        if self.ruby_bottom:
            textsupport.mark_ruby_bottom(rv)
        elif self.ruby_top:
            textsupport.mark_ruby_top(rv)

        return rv
Exemplo n.º 6
0
    def glyphs(self, s):
        """
        Return the list of glyphs corresponding to unicode string s.
        """

        fo = font.get_font(self.font, self.size, self.bold, self.italic, 0, self.antialias, self.vertical)
        rv = fo.glyphs(s)
        
        # Apply kerning to the glyphs.
        if self.kerning:
            textsupport.kerning(rv, self.kerning)
        
        if self.hyperlink:
            for g in rv:
                g.hyperlink = self.hyperlink
        
        if self.ruby_bottom:
            textsupport.mark_ruby_bottom(rv)
        elif self.ruby_top:
            textsupport.mark_ruby_top(rv)
        
        return rv