Source for file Font.class.php
Documentation is available at Font.class.php
* This work is hereby released into the Public Domain.
* To view a copy of the public domain dedication,
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
require_once dirname(__FILE__ ). "/../Graph.class.php";
* Common font characteristics and methods.
* Declared abstract only so that it can't be instanciated.
* Users have to call 'new awPHPFont' or 'new awFileFont',
* or any of their inherited classes (awFont1, awTuffy, awTTFFont, etc.)
* @package linea21.externals
* @param awDriver $driver
* @param awPoint $p Draw text at this point
* @param awText $text The text
* @param int $width Text box width
public function draw(awDriver $driver, awPoint $point, awText $text, $width = NULL) {
$driver->string($this, $text, $point, $width);
* Class for fonts that cannot be transformed,
* like the built-in PHP fonts for example.
* @package linea21.externals
* The used font identifier
$this->font = (int) $font;
* Class for fonts that can be transformed (rotated, skewed, etc.),
* like TTF or FDB fonts for example.
* @package linea21.externals
* The name of the font, without the extension
* The font filename extension
* Set the name of the font. The $name variable can contain the full path,
* or just the filename. Artichow will try to do The Right Thing,
* as well as set the extension property correctly if possible.
if(strpos($fontInfo['dirname'], '/') !== 0) {
// Path is not absolute, use ARTICHOW_FONT
$this->name = $fontInfo['dirname']. DIRECTORY_SEPARATOR. $fontInfo['basename'];
if(array_key_exists('extension', $fontInfo) and $fontInfo['extension'] !== '') {
* Return the name of the font, i.e. the absolute path and the filename, without the extension.
* Set the size of the font, in pixels
$this->size = (int) $size;
* Return the size of the font, in pixels
* Set the extension, without the dot
* @param string $extension
* Get the filename extension for that font
* Class representing TTF fonts
* @package linea21.externals
for($i = 1; $i <= 5; $i++ ) {
class awFont'. $i. ' extends awPHPFont {
public function __construct() {
parent::__construct('. $i. ');
foreach($fonts as $font) {
class aw'. $font. ' extends awFileFont {
public function __construct($size) {
parent::__construct(\''. $font. '\', $size);
for($i = 1; $i <= 5; $i++) {
class awFont'.$i.' extends awPHPFont {
function awFont'.$i.'() {
parent::awPHPFont('.$i.');
if(ARTICHOW_PREFIX !== 'aw') {
class '.ARTICHOW_PREFIX.'Font'.$i.' extends awFont'.$i.' {
foreach($fonts as $font) {
class aw'.$font.' extends awFileFont {
function aw'.$font.'($size) {
parent::awFileFont(\''.$font.'\', $size);
if(ARTICHOW_PREFIX !== 'aw') {
class '.ARTICHOW_PREFIX.$font.' extends aw'.$font.' {
* Environment modification for GD2 and TTF fonts
|