How to use fonttools - 3 common examples

To help you get started, we’ve selected a few fonttools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enthought / enable / enthought / kiva / backend_qt4.py View on Github external
def font_metrics_provider():
    """ Creates an object to be used for querying font metrics.  Typically
    this can just be an empty/dummy graphics context
    """
    gc = GraphicsContext((1,1))
    gc.set_font(Font())
    return gc
github enthought / enable / enthought / kiva / gl.py View on Github external
def GetFont(font):
    """ Returns a Pylget Font object for the given Agg or Kiva font """
    if isinstance(font, PygletFont):
        pyglet_font = font
    else:
        # AggFontType
        key = (font.name, font.size, font.family, font.style)
        if key not in GlobalFontCache:
            if isinstance(font, AggFontType):
                agg_font = font
                font = Font(face_name = agg_font.name,
                            size = agg_font.size,
                            family = agg_font.family,
                            style = agg_font.style)
            bold = False
            italic = False
            if font.style == BOLD or font.style == BOLD_ITALIC or font.weight == BOLD:
                bold = True
            if font.style == ITALIC or font.style == BOLD_ITALIC:
                italic = True
            pyglet_font = load_font(font.findfontname(), font.size, bold, italic)
            GlobalFontCache[key] = pyglet_font
        else:
            pyglet_font = GlobalFontCache[key]
    return pyglet_font
github enthought / enable / enthought / kiva / backend_wx.py View on Github external
def font_metrics_provider():
    gc = GraphicsContext((1, 1))
    gc.set_font(Font())
    return gc

fonttools

Tools to manipulate font files

MIT
Latest version published 11 days ago

Package Health Score

97 / 100
Full package analysis

Popular fonttools functions

Similar packages