||Holder for metadata regarding a particular font|
XXX Note: currently there is no distinction between the
Context-specific metadata and the generic descriptions
of the fonts. For instance, there is no reason that
the underlying glyph metadata needs to be queried for
each quality level of a given font (only the outlines
need to be regenerated), and the outlines themselves
are not actually dependent on the context, so they can
be shared across contexts, with only the display lists
not being shareable.
||Methods defined here:|
- __init__(self, filename, encoding=None, glyphClass=None, quality=3)
- Initialize the font
filename -- a file source from which to load
the .ttf file, must be a simple local filename,
not a URL or font-name.
encoding -- the TrueType encoding specifier, the
specifier is two elements, a PlatformID and
a platform-specific ID code (sub encoding).
the default should be the Unicode Roman if
I've done my homework correctly.
(0,0) or (0,3) -- Unicode (default or Unicode 2.0
semantics respectively), I have no fonts with which
to test this encoding.
(3,1) -- Latin-1 Microsoft encoding, while
(1,0) should be the Mac-Roman encoding. You will
almost certainly want (3,1) on windows, and I'm
guessing (1,0) on Mac.
glyphClass -- the class used for creating new glyphs,
if not provided, self.defaultGlyphClass is used.
quality -- rendering quality for the font, the number
of integration steps for each quadratic curve in
the font definition.
- Provide a representation of the Font
- countGlyphs(self, string)
- Count the number of glyphs from string present in file
- ensureGlyphs(self, string)
- Retrieve set of glyphs for the string from file into local cache
(Optimization), take all glyphs represented by the string
and compile each glyph not currently available with a
single opening of the font file.
- getGlyph(self, character)
- Retrieve the appropriate glyph for this character
Returns a compiled glyph for the given character in
- withFont(self, callable, *arguments, **named)
- Call a callable while we have a .font attribute
This method opens the font file and then calls the given
callable object. On exit, it eliminates the font.
XXX Currently this is not reentrant :(
Data descriptors defined here:
- dictionary for instance variables (if defined)
- list of weak references to the object (if defined)
Data and other attributes defined here:
- defaultGlyphClass = <class 'ttfquery.glyph.Glyph'>
- Object encapsulating metadata regarding a particular glyph
- encoding = None