drafting.text.reader.Style¶
-
class
Style
(font: Optional[Union[drafting.text.reader.Font, str]] = None, fontSize: int = 12, tracking=0, trackingMode=1, kern_pairs={}, space=None, baselineShift=0, xShift=None, rotate=0, reverse=False, removeOverlap=False, lang=None, narrower=None, include_blanks=False, palette=0, capHeight=None, data={}, layer=None, liga=True, fill=(0, 0.5, 1), stroke=None, strokeWidth=0, variations={}, variationLimits={}, trackingLimit=0, scaleVariations=True, mods=None, features={}, increments={}, varyFontSize=False, preventHwid=False, fitHeight=None, load_font=True, tag=None, **kwargs)¶ Class for configuring font properties
Keyword arguments
font
: can either be adrafting.text.Font
object, apathlib.Path
, or a plain string pathfontSize
: standard point-based font-size, expressed as integertracking
(akatu
): set the tracking, by default in font-source-point-size aka as if the font-size was always 1000; this means tracking is by default done relatively rather than absolutely (aka the relative tracking will not change when you change the fontSize)trackingMode
: set to 0 to set tracking in a classic fontSize-based (defaults to 1, as described just above)space
: set this to override the width of the standard space character (useful when setting text on a curve and the space is getting collapsed)baselineShift
(akabs
): if an integer, shifts glyphs by that amount in y axis; if a list, shifts glyphs at corresponding index in list by that amount in y axisxShift
(akaxs
): if an integer, shifts glyphs by that amount in x axis; if a list, shifts glyphs at corresponding index in list by that amount in x axisrotate
: rotate glyphs by degreereverse
(akar
): reverse the order of the glyphs, so that the left-most glyph is first in when vectorized via.pens()
removeOverlaps
(akaro
): automatically use skia-pathops to remove overlaps from the glyphs (useful when using variable ttf fonts)lang
: set language directly, to access language-specific alternate characters/rules
Shorthand kwargs
kp
forkern_pairs
— a dict of glyphName->[left,right] values in font-spacetl
fortrackingLimit
bs
forbaselineShift
ch
forcapHeight
— a number in font-space; not specified, read from font; specified as ‘x’, capHeight is set to xHeight as read from font