diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-09-06 09:34:53 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-09-06 09:34:53 +0000 |
commit | b7b8d6da07309da4e16397f662a4e2db46c0869a (patch) | |
tree | a76a982bef0844f6d3d0eeb7089a7e8a5dfb2ee0 /src/options | |
parent | 4e50ab6291dc2430ef9ce4cc42c100c021e1a3b0 (diff) | |
download | zetacomponents-graph-b7b8d6da07309da4e16397f662a4e2db46c0869a.zip zetacomponents-graph-b7b8d6da07309da4e16397f662a4e2db46c0869a.tar.gz |
- Enhanced font configuration
- Use Free Type 2 by default now, fallback to native ttf, if not available
- Use t1lib for PostScript Type1 fonts
- Throw an exception, if some texts could not be rendered with minimum font
size
Diffstat (limited to 'src/options')
-rw-r--r-- | src/options/font.php | 15 | ||||
-rw-r--r-- | src/options/gd_driver.php | 6 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/options/font.php b/src/options/font.php index 9f3b744..2da92ad 100644 --- a/src/options/font.php +++ b/src/options/font.php @@ -106,8 +106,19 @@ class ezcGraphFontOptions extends ezcBaseOptions case 'path': if ( is_file( $propertyValue ) && is_readable( $propertyValue ) ) { - $this->properties['path'] = $propertyValue; - // @TODO: Autodetect font type + $this->properties['path'] = realpath( $propertyValue ); + $parts = pathinfo( $this->properties['path'] ); + switch ( strtolower( $parts['extension'] ) ) + { + case 'pfb': + $this->properties['type'] = ezcGraph::PS_FONT; + break; + case 'ttf': + $this->properties['type'] = ezcGraph::TTF_FONT; + break; + default: + throw new ezcGraphUnknownFontTypeException( $propertyValue, $parts['extension'] ); + } } else { diff --git a/src/options/gd_driver.php b/src/options/gd_driver.php index a6e756d..2faddd7 100644 --- a/src/options/gd_driver.php +++ b/src/options/gd_driver.php @@ -21,6 +21,8 @@ * Background image to put the graph on * @property string $resampleFunction * Function used to resample / resize images + * @property bool $forceNativeTTF + * Force use of native ttf functions instead of free type 2 * * @package Graph */ @@ -41,6 +43,7 @@ class ezcGraphGdDriverOptions extends ezcGraphDriverOptions $this->properties['supersampling'] = 2; $this->properties['background'] = false; $this->properties['resampleFunction'] = 'imagecopyresampled'; + $this->properties['forceNativeTTF'] = false; parent::__construct( $options ); } @@ -95,6 +98,9 @@ class ezcGraphGdDriverOptions extends ezcGraphDriverOptions throw new ezcBaseValueException( $propertyName, $propertyValue, 'function' ); } break; + case 'forceNativeTTF': + $this->properties['forceNativeTTF'] = (bool) $propertyValue; + break; default: parent::__set( $propertyName, $propertyValue ); break; |