示例#1
0
</head>
<body>
    <div class="row">
        <div class="col-xs-12">

            <h1>EasySVG demo</h1>
            
            <h2>Text example</h2>
            <?php 
$svg = new EasySVG();
$svg->setFontSVG("paris-bold-webfont.svg");
//$svg->setFontSVG("swiss-924-bt-webfont.svg");
$svg->setFontSize(100);
$svg->setFontColor('#000000');
$def = $svg->addText("Hello");
$svg->addAttribute("width", "800px");
$svg->addAttribute("height", "100px");
$def = 'Hello';
//$rotated_def = $svg->defRotate($def, 40);
echo $svg->asXML();
?>
            <pre>
                $svg = new EasySVG();
                $svg->setFontSVG("paris-bold-webfont.svg");
                $svg->setFontSize(100);
                $svg->setFontColor('#000000');
                $svg->addText("Simple text display");
                $svg->addAttribute("width", "800px");
                $svg->addAttribute("height", "300px");
                echo $svg->asXML();</pre>
            <hr>
示例#2
0
	default:
		$svg->setFontSVG("fonts/paris-bold-webfont.svg");
		break;
}*/
//$svg->setFontSVG("fonts/GoodDog-webfont.svg");
//$svg->setFontSVG("fonts/swiss-924-bt-webfont.svg");
$svg->setFontSVG("fonts/paris-bold-webfont.svg");
$text_length = strlen($text);
$svg->setFontSize(100);
$svg->setFontColor('#000000');
//$svg->addAttribute("xmlns", "http://www.w3.org/2000/svg","http://www.w3.org/2001/XMLSchema-instance");
//$svg->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink","http://www.w3.org/2001/XMLSchema-instance");
$def = $svg->addText($text);
$width = ceil($svg->getWidth()) + 20;
$height = ceil($svg->getHeight()) + 20;
$svg->addAttribute("width", $width . "px");
$svg->addAttribute("height", $height . "px");
/*$svg->addElement('use',array(

	));*/
$svg->addElement('rect', array("x" => "0", "y" => "0", "width" => "100%", "height" => "100%", "stroke" => "white", "fill" => "white", "fill-opacity" => "0", "stroke-opacity" => "0"));
//$svg->addAttribute("width", "800px");
//$svg->addAttribute("height", "100px");
//$def = 'Hello';
//$rotated_def = $svg->defRotate($def, 40);
/*echo "<pre>";
print_r($svg);
echo "</pre>";*/
echo $svg->asXML();
/*echo "<pre>";
print_r($_REQUEST);
示例#3
0
    <div class="row">
        <div class="col-xs-12">

            <h1>EasySVG demo</h1>
            
            <?php 
$text = "Simple text display\netc.";
$svg = new EasySVG();
$svg->setFontSVG("paris-bold-webfont.svg");
$svg->setFontSize(100);
$svg->setFontColor('#000000');
$svg->setLineHeight(1.2);
$svg->addText($text);
// set width/height according to text
list($textWidth, $textHeight) = $svg->textDimensions($text);
$svg->addAttribute("width", $textWidth . "px");
$svg->addAttribute("height", $textHeight . "px");
echo $svg->asXML();
?>
            <br/><br/><br/>
            <pre>
    $text = "Simple text display\netc.";

    $svg = new EasySVG();
    $svg->setFontSVG("paris-bold-webfont.svg");
    $svg->setFontSize(100);
    $svg->setFontColor('#000000');
    $svg->setLineHeight(1.2);
    $svg->addText($text);
    // set width/height according to text
    list($textWidth, $textHeight) = $svg->textDimensions($text);