Dompdf\FontMetrics
The font metrics class
This class provides information about fonts and text. It can resolve
font names into actual installed font files, as well as determine the
size of text in a particular font and size.
Synopsis
class FontMetrics
{
- // constants
- const CACHE_FILE = "dompdf_font_family_cache.php";
- // members
- protected Canvas $pdf;
- protected Canvas $canvas;
- protected array $fontLookup = ;
- private Options $options;
- // methods
- public void __construct()
- public void save_font_families()
- public void saveFontFamilies()
- public void load_font_families()
- public void loadFontFamilies()
- public bool register_font()
- public bool registerFont()
- public float get_text_width()
- public float getTextWidth()
- public float get_font_height()
- public float getFontHeight()
- public string get_font()
- public string getFont()
- public null|string get_family()
- public null|string getFamily()
- public string get_type()
- public string getType()
- public array get_font_families()
- public array getFontFamilies()
- public void set_font_family()
- public void setFontFamily()
- public string getCacheFile()
- public $this setOptions()
- public Options getOptions()
- public $this setCanvas()
- public Canvas getCanvas()
Tasks
Line | Task |
---|---|
263 | Make sure this cache is efficient before enabling it |
Constants
Name | Value |
---|---|
CACHE_FILE | "dompdf_font_family_cache.php" |
Members
private
- $options — Dompdf\Options
protected
- $canvas
—
Dompdf\Canvas
Underlying {@link Canvas} object to perform text size calculations - $fontLookup
—
array
Array of font family names to font files - $pdf — Dompdf\Canvas
Methods
public
- __construct() — Class initialization
- getCacheFile()
- getCanvas()
- getFamily()
- getFont() — Resolves a font family & subtype into an actual font file Subtype can be one of 'normal', 'bold', 'italic' or 'bold_italic'. If the particular font family has no suitable font file, the default font ({@link Options::defaultFont}) is used. The font file returned is the absolute pathname to the font file on the system.
- getFontFamilies() — Returns the current font lookup table
- getFontHeight() — Calculates font height
- getOptions()
- getTextWidth() — Calculates text size, in points
- getType()
- get_family()
- get_font()
- get_font_families()
- get_font_height()
- get_text_width()
- get_type()
- loadFontFamilies() — Loads the stored font family cache
- load_font_families()
- registerFont()
- register_font()
- saveFontFamilies() — Saves the stored font family cache
- save_font_families()
- setCanvas()
- setFontFamily()
- setOptions()
- set_font_family()