This module handles TeX Font Metric.
The class PyDvi.Tfm handles the font’s metric. To get a PyDvi.Tfm instance for a particular font use the static method PyDvi.TfmParser.TfmParser.parse(). For example use this code for the font “cmr10”:
tfm = TfmParser.parse('cmr10', '/usr/share/texmf/fonts/tfm/public/cm/cmr10.tfm')
The number of characters in the font can be obtained using the function len():
>>> len(tfm)
128
Each character’s metric is stored in a TfmChar instance that can be accessed using the char code as index on the Tfm class instance. For example to get the metric of the character “A” use:
tfm[ord('A')]
Bases: object
This class encapsulates a TeX Font Metric for a font.
Public attributes:
- font_name
- font’s name
- filename
- ”.tfm” filename
- smallest_character_code
- smallest character code of the font
- largest_character_code
- largest character code of the font
- checksum
- checksum of the tfm file
- design_font_size
- design font size
- character_coding_scheme
- character coding scheme
- family
- font’s family
slant
spacing
space_stretch
space_shrink
x_height
quad
extra_space
In addition for Math font, the following public attributes are available:
um1
num2
num3
denom1
denom2
sup1
sup2
sup3
sub1
sub2
supdrop
subdrop
delim1
delim2
axis_height
default_rule_thickness
big_op_spacing
The number of characters can be queried using len(). The TfmChar instance for a character code char_code can be set or get using the operator [].
Bases: object
This class encapsulates a TeX Font Metric for a Glyph.
Public attributes:
char_code
width
height
depth
italic_correction
Return the TfmChar instance for the next larger char if it exists else return None.
List of the printable characters.
Bases: PyDvi.Font.Tfm.TfmChar
This class encapsulates a TeX Font Metric for an extensible Glyph.
Public attributes:
top
mid
bot
rep
Bases: PyDvi.Font.Tfm.TfmLigKern
This class represents a Kerning Program Instruction.
Public Attributes:
- next_char
- next character
- kern
- kerning value
Bases: PyDvi.Font.Tfm.TfmLigKern
This class represents a Ligature Program Instruction.
Public Attributes:
- next_char
- next character
- ligature_char_code
- ligature character code
- current_char_is_deleted
- the current characters must be deleted of the stream
- next_char_is_deleted
- the next characters must be deleted of the stream
- number_of_chars_to_pass_over
- number of characters to pass over