Source for file svgGrapher.internal.fontSizeEquiv.php
Documentation is available at svgGrapher.internal.fontSizeEquiv.php
* Plugin internal fontSizeEquiv.
* @version $Id: svgGrapher.internal.fontSizeEquiv.php,v 1.5 2007/10/23 09:22:53 geelweb Exp $
* @author Guillaume L. <guillaume@geelweb.org>
* @copyright Copyright © 2006, Guillaume Luchet.
* @license http://opensource.org/licenses/bsd-license.php BSD License
require_once SVGGRAPHER_CLASS_PATH .
'/mains/SvgStyle.php';
* svgGrapher_internal_fontSizeEquiv()
* @param mixed $font Object Style or svg string style
* @param integer $dpiDefault Screen resolution
$point =
1/
72; // 1 pt = 1/72 pouce.
$pica =
12 *
$point; // 1pc = 12pt.
$cm =
0.3937; // 1cm = 0.3937 pouce.
$mm =
0.03937; // 1mm = 0.03937 pouce.
$svgUnites =
array('pt', 'px', 'pc', 'cm', 'mm', 'in', 'em', 'ex', '%');
$rxFontSize =
'/(\d+)\s?([' .
implode('|', $svgUnites) .
']+)?/';
$fontSize =
($font->getAttribute('font-size') !==
false) ?
$font->getAttribute('font-size') :
12;
// Chaine de style complete.
if(preg_match($rxFontSize, $fontSize, $matches)) {
$fontUnite =
(isset
($matches[2])) ?
$matches[2] :
'px';
$tailleEnPixel =
($fontSize *
$point) *
$dpiDefault;
$tailleEnPixel =
($fontSize *
$pica) *
$dpiDefault;
$tailleEnPixel =
($fontSize *
$cm) *
$dpiDefault;
$tailleEnPixel =
($fontSize *
$mm) *
$dpiDefault;
$tailleEnPixel =
$fontSize *
$dpiDefault;
// unite relative, impossible d'en definir une taille equivalente en px...
$tailleEnPixel =
$fontSize;
return ($tailleEnPixel ===
false) ?
false :
ceil($tailleEnPixel);
Documentation generated on Tue, 23 Oct 2007 11:32:10 +0200 by phpDocumentor 1.4.0