def __init__(self, name, size, isItalic): """ Creates a Font with the given properties. """ self.name = name self.size = size self.isItalic = isItalic if self.isItalic: self.slant = cairo.FONT_SLANT_ITALIC else: self.slant = cairo.FONT_SLANT_NORMAL if not Font._cairoContext: dummySurface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 1, 1) Font._cairoContext = cairo.Context(dummySurface) self.cairoContext = Font._cairoContext self.cairoContext.save() self.loadInto(self.cairoContext) # Make our font metrics information visible to the client. (self.ascent, self.descent, self.height, self.maxXAdvance, self.maxYAdvance) = self.cairoContext.font_extents() self.cairoContext.restore()
def __init__(self, name, size, isItalic): """ Creates a Font with the given properties. """ self.name = name self.size = size self.isItalic = isItalic self.font_name = None self.font_opts = {} if self.isItalic: self.slant = cairo.FONT_SLANT_ITALIC # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy else: self.slant = cairo.FONT_SLANT_NORMAL # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy if not Font._cairoContext: dummySurface = cairo.ImageSurface( cairo.FORMAT_ARGB32, 1, 1 ) # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy Font._cairoContext = cairo.Context( dummySurface ) # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy self.cairoContext = Font._cairoContext self.cairoContext.save() self.loadInto(self.cairoContext) # Make our font metrics information visible to the client. (self.ascent, self.descent, self.height, self.maxXAdvance, self.maxYAdvance) = self.cairoContext.font_extents() self.cairoContext.restore()
def makeCairoContext(self): context = cairo.Context(self._impl.makeCairoSurface()) # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy convertUserSpaceToPoints(context) return context
def makeCairoContext( self ): context = cairo.Context( self._impl.makeCairoSurface() ) convertUserSpaceToPoints( context ) return context