Fonts and Typefaces (rinoh.font
)¶
Classes for fonts and typefaces.
- class rinoh.font.Font(filename, weight, slant, width)¶
A collection of glyphs in a particular style
This is a base class for classes that parse different font formats. See
rinoh.font.type1
andrinoh.font.opentype
.- Parameters:¶
- encoding¶
If no encoding is set for the
Font
, glyphs are addressed by glyph ID (and thus support more than 256 glyphs).
- get_glyph_metrics(char, variant)¶
Return the glyph metrics for a particular character
If the glyph of requested font variant is not present in the font, the normal variant is returned instead. If that is not present either, an exception is raised.
- get_ligature(glyph, successor_glyph)¶
Return the ligature to replace the given glyphs
If no ligature is defined in the font for the given glyphs, return
None
.
- class rinoh.font.Typeface(name, *fonts)¶
A set of fonts that share common design features
The fonts collected in a typeface differ in weight, width and/or slant.
- fonts()¶
Generator yielding all fonts of this typeface
- Yields:¶
Font – the next font in this typeface
- class rinoh.font.style.FontWeight¶
Accepts:
hairline
,thin
,ultra-light
,extra-light
,light
,regular
,normal
,book
,roman
,medium
,semi-bold
,demi-bold
,bold
,extra-bold
,ultra-bold
,black
,heavy
,extra-black
,ultra-black
- class rinoh.font.style.FontSlant¶
Accepts:
upright
,oblique
,italic
- class rinoh.font.style.FontWidth¶
Accepts:
ultra-condensed
,extra-condensed
,condensed
,semi-condensed
,normal
,medium
,semi-expanded
,expanded
,extra-expanded
,ultra-expanded
- class rinoh.font.style.FontVariant¶
Accepts:
normal
,small capital
,oldstyle figures
- class rinoh.font.style.TextPosition¶
Accepts:
normal
,superscript
,subscript