properties['name'] = 'sans-serif'; $this->properties['path'] = 'Graph/tests/data/font.ttf'; $this->properties['type'] = ezcGraph::TTF_FONT; $this->properties['minFontSize'] = 6; $this->properties['maxFontSize'] = 96; $this->properties['minimalUsedFont'] = 96; $this->properties['lineSpacing'] = .1; $this->properties['color'] = ezcGraphColor::fromHex( '#000000' ); $this->properties['background'] = false; $this->properties['border'] = false; $this->properties['borderWidth'] = 1; $this->properties['padding'] = 0; $this->properties['minimizeBorder'] = true; parent::__construct( $options ); } /** * Set an option value * * @param string $propertyName * @param mixed $propertyValue * @throws ezcBasePropertyNotFoundException * If a property is not defined in this class * @return void */ public function __set( $propertyName, $propertyValue ) { switch ( $propertyName ) { case 'minFontSize': $this->properties['minFontSize'] = max(1, (float) $propertyValue); break; case 'maxFontSize': $this->properties['maxFontSize'] = max(1, (float) $propertyValue); break; case 'minimalUsedFont': $propertyValue = (float) $propertyValue; if ( $propertyValue < $this->minimalUsedFont ) { $this->properties['minimalUsedFont'] = $propertyValue; } break; case 'color': if ( $propertyValue instanceof ezcGraphColor ) { $this->properties['color'] = $propertyValue; } else { throw new ezcBaseValueException( $propertyName, $propertyValue, 'ezcGraphColor' ); } break; case 'background': if ( $propertyValue instanceof ezcGraphColor ) { $this->properties['background'] = $propertyValue; } else { throw new ezcBaseValueException( $propertyName, $propertyValue, 'ezcGraphColor' ); } break; case 'border': if ( $propertyValue instanceof ezcGraphColor ) { $this->properties['border'] = $propertyValue; } else { throw new ezcBaseValueException( $propertyName, $propertyValue, 'ezcGraphColor' ); } break; case 'borderWidth': $this->properties['borderWidth'] = (int) $propertyValue; break; case 'padding': $this->properties['padding'] = (int) $propertyValue; break; case 'minimizeBorder': $this->properties['minimizeBorder'] = (bool) $propertyValue; break; case 'name': if ( is_string( $propertyValue ) ) { $this->properties['name'] = $propertyValue; } else { throw new ezcBaseValueException( $propertyName, $propertyValue, 'string' ); } break; case 'path': if ( is_file( $propertyValue ) && is_readable( $propertyValue ) ) { $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 { throw new ezcBaseFileNotFoundException( $propertyValue, 'font' ); } break; case 'type': if ( is_int( $propertyValue ) ) { $this->properties['type'] = $propertyValue; } else { throw new ezcBaseValueException( $propertyName, $propertyValue, 'int' ); } default: throw new ezcBasePropertyNotFoundException( $propertyName ); break; } } } ?>