SVGBasics

<script type="text/javascript"><!-- google_ad_client = "pub-1870854262600725"; google_alternate_color = "ffffff"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text"; google_ad_channel ="6819119528"; google_color_border = "FFFFFF"; google_color_link = "006699"; google_color_bg = "FFFFFF"; google_color_text = "006699"; google_color_url = "006699"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
Turn SVG On

Plain Text with SVG

Text

Text in SVG gets the best treatment possible. It is rendered as a graphic so all your graphic transforms apply to it and it still acts like text - that is, it can be selected and copied as text by a user.

Text can be used in different ways depending on the author's goals. Broadly speaking, text can be decorative, such as a logo, or it can be practical with the intent of conveying simple data like names and phone numbers. Sometimes we think of text as serving the function of labelling or identifying.

Simple Applications of Text

The text element is used to write text at a location. The location is given in absolute terms with the x and y attributes or a relative location with dx and dy attributes.

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg viewBox = "0 0 200 200" version = "1.1">
    <text x = "10" y = "25" fill = "navy" font-size = "15">
        It was the best of times
    </text>
    <text x = "10" y = "25" dx = "5" dy = "15" fill = "navy" font-size = "15">
        It was the worst of times.
    </text>
</svg>

The tspan allows ranges of text to be reformatted, repositioned or otherwise adjusted while inheriting the attributes of the text element that they're contained in.

Text contained in separate tspans, but the same text element, can all be selected at once. Text in separate text elements can't be selected at the same time (when you click and drag, only text from the first text element will be selected).

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg viewBox = "0 0 200 200" version = "1.1">
    <g fill = "navy" font-size = "15">
        <text x = "10" y = "25">
            <tspan>
                It was the best of times
            </tspan>
            <tspan dx = "-140" dy = "15">
                It was the worst of times.
            </tspan>
        </text>
    </g>
</svg>
<script type="text/javascript"><!-- google_ad_client = "pub-1870854262600725"; google_alternate_color = "ffffff"; google_ad_width = 200; google_ad_height = 90; google_ad_format = "200x90_0ads_al"; google_ad_channel ="7003876230"; google_color_border = "FFFFFF"; google_color_bg = "FFFFFF"; google_color_link = "006699"; google_color_url = "006699"; google_color_text = "006699"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
©2004 Late Night PC Service | About Us | Site Map | Contact Us