Class Font_Metrics

Description

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.

  • static:

Located in /include/font_metrics.cls.php (line 63)


	
			
Class Constant Summary
 CACHE_FILE = __DOMPDF_FONT_CACHE_FILE
Variable Summary
Cpdf $_pdf
Method Summary
string get_font (string $family, [string $subtype = "normal"])
float get_font_height (string $font, float $size)
float get_text_width (string $text, string $font, float $size, float $spacing)
void init ()
void set_font_family (mixed $fontname, mixed $entry)
Variables
array $_font_lookup = array() (line 84)

Array of font family names to font files

Usually cached by the load_font.php script

  • access: protected
  • static:
Cpdf $_pdf = null (line 75)

Underlying Cpdf object to perform text size calculations

  • access: protected
  • static:
Methods
get_font (line 134)

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 (DOMPDF_DEFAULT_FONT) is used. The font file returned is the absolute pathname to the font file on the system.

  • static:
string get_font (string $family, [string $subtype = "normal"])
  • string $family
  • string $subtype
get_font_families (line 185)

Returns the current font lookup table

  • static:
array get_font_families ()
get_font_height (line 118)

Calculates font height

  • static:
float get_font_height (string $font, float $size)
  • string $font
  • float $size
get_text_width (line 107)

Calculates text size, in points

  • static:
float get_text_width (string $text, string $font, float $size, float $spacing)
  • string $text: the text to be sized
  • string $font: the desired font
  • float $size: the desired font size
  • float $spacing: word spacing, if any
init (line 91)

Class initialization

  • static:
void init ()
load_font_families (line 169)

Loads the stored font family cache

void load_font_families ()
save_font_families (line 158)

Saves the stored font family cache

The name and location of the cache file are determined by Font_Metrics::CACHE_FILE. This file should be writable by the webserver process.

void save_font_families ()
set_font_family (line 189)
  • static:
void set_font_family (mixed $fontname, mixed $entry)
Class Constants
CACHE_FILE = __DOMPDF_FONT_CACHE_FILE (line 68)

Documentation generated on Fri, 04 Mar 2005 13:31:18 -0700 by phpDocumentor 1.3.0RC3