wand.font — Fonts¶
New in version 0.3.0.
Font is an object which takes the path of font file,
size, color, and whether to use
antialiasing. If you want to use font by its name rather
than the file path, use TTFQuery package. The font path resolution by its
name is a very complicated problem to achieve.
See also
- TTFQuery — Find and Extract Information from TTF Files
TTFQuery builds on the FontTools-TTX package to allow the Python programmer to accomplish a number of tasks:
query the system to find installed fonts
retrieve metadata about any TTF font file
this includes the glyph outlines (shape) of individual code-points, which allows for rendering the glyphs in 3D (such as is done in OpenGLContext)
lookup/find fonts by:
abstract family type
proper font name
build simple metadata registries for run-time font matching
- class wand.font.Font(path, size=0, color=None, antialias=True, stroke_color=None, stroke_width=None)¶
Font struct which is a subtype of
tuple.- Parameters:
path (
str,basestring) – the path of the font filesize (
numbers.Real) – the size of typeface. 0 by default which means autosizedcolor (
Color) – the color of typeface. black by defaultantialias (
bool) – whether to use antialiasing.Trueby defaultstroke_color (
Color) – optional color to outline typeface.stroke_width (
numbers.Real) – optional thickness of typeface outline.
Changed in version 0.3.9: The
sizeparameter becomes optional. Its default value is 0, which means autosized.Changed in version 0.5.0: Added
stroke_color&stoke_widthparamaters.- property color¶
(
wand.color.Color) The font color.
- property path¶
(
basestring) The path of font file.
- property size¶
(
numbers.Real) The font size in pixels.
- property stroke_color¶
(
wand.color.Color) The stroke color.
- property stroke_width¶
(
numbers.Real) The width of the stroke line.