SVGBasics

Decorating Text with SVG - Bold, Underline, Overline and Strikethrough

Bold, Underline, Italic and the rest

To make text bold with SVG, set the weight of the font with font-weight="bold". The font-weight can also be set to 100, 200, ... 900 with higher values corresponding to a greater "boldness."

<?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 500 300" version = "1.1">
    <desc>
        Text example
    </desc>
    <g fill = "navy">
        <text x = "10" y = "25" font-size = "20">
            <tspan font-family = "serif">
                Normal weight.
            </tspan>
            <tspan x = "10" dy = "20" font-family = "serif" font-weight = "bold">
                Bold type.
            </tspan>
            <tspan x = "10" dy = "20" font-family = "serif" font-weight = "100">
                font-weight set to 100.
            </tspan>
            <tspan x = "10" dy = "20" font-family = "serif" font-weight = "200">
                font-weight set to 200.
            </tspan>
            <tspan x = "10" dy = "20" font-family = "serif" font-weight = "600">
                font-weight set to 600.
            </tspan>
            <tspan x = "10" dy = "20" font-family = "serif" font-weight = "700">
                font-weight set to 700.
            </tspan>
            <tspan x = "10" dy = "20" font-family = "serif" font-weight = "900">
                font-weight set to 900.
            </tspan>
        </text>
    </g>
</svg>

The text-decoration attribute can be set to "underline" to underline text.

<?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 500 300" version = "1.1">
    <desc>
        Text example
    </desc>
    <g fill = "navy">
        <text x = "10" y = "25" font-size = "20">
            <tspan x = "10" y = "20" text-decoration = "underline">
                 Underline turned on by text-decoration.
            </tspan>
            <tspan x = "10" y = "80" text-decoration = "overline">
                 Overline turned on by text-decoration.
            </tspan>
            <tspan x = "10" y = "140" text-decoration = "line-through">
                 Line-through turned on by text-decoration.
            </tspan>
            <tspan x = "10" y = "200" text-decoration = "line-through,underline">
                Several decorations turned on at once.
            </tspan>
        </text>
    </g>
</svg>
©2004 Late Night PC Service | About Us | Site Map | Contact Us