Source for file svgGrapher.internal.fontSizeEquivPt.php
Documentation is available at svgGrapher.internal.fontSizeEquivPt.php
* Plugin internal fontSizeEquivPt.
* @version $Id: svgGrapher.internal.fontSizeEquivPt.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_fontSizeEquivPt()
* @param mixed $font Object Style or svg string style
* @param integer $dpiDefault Screen definition.
$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) .
']+)?/';
$font =
new Style($font);
$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';
$tailleEnPoint =
($fontSize /
$dpiDefault) /
$point;
$tailleEnPoint =
$fontSize /
12;
$tailleEnPoint =
($fontSize *
$cm) /
$point;
$tailleEnPoint =
($fontSize *
$mm) /
$point;
$tailleEnPoint =
$fontSize /
$point;
// unite relative, impossible d'en definir une taille equivalente en px...
$tailleEnPoint =
$fontSize;
return ($tailleEnPoint ===
false) ?
false :
ceil($tailleEnPoint);
Documentation generated on Tue, 23 Oct 2007 11:32:10 +0200 by phpDocumentor 1.4.0