SVG font-size is not correct while viewing.

Discuss SVG code, accessible via the XML Editor.
snayak
Posts: 2
Joined: Thu Jul 19, 2012 12:29 am

SVG font-size is not correct while viewing.

Postby snayak » Thu Jul 19, 2012 12:38 am

Dear Friends,

I have the following SVG code.

Code: Select all

<?xml version="1.0" standalone="yes"?>
<svg width="810" height="120" viewBox="0 0 810 120" xmlns="http://www.w3.org/2000/svg" version="1.1" baseProfile="full">
<text x="0" y="120" font-family="arial" font-size="120px" fill="blue" >Hello</text>
</svg>


I tried to view this file using
1. IE8+Adobe SVG Viewer
2. Mozilla Firefox 5.0.1
3. Inkskape in Ubuntu 9.04
4. GIMP in Ubuntu 9.04

In all places I found that actual text size is not 120 pixel !
How is this?

How to make its height 120 pixel?

Sincerely,
Srinivas Nayak

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: SVG font-size is not correct while viewing.

Postby chriswww » Thu Jul 19, 2012 2:53 pm

you should specify the units (e.g. px) for the width and height svg element.

snayak
Posts: 2
Joined: Thu Jul 19, 2012 12:29 am

Re: SVG font-size is not correct while viewing.

Postby snayak » Thu Jul 19, 2012 3:46 pm

I had specified px also. But no change.

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: SVG font-size is not correct while viewing.

Postby chriswww » Fri Jul 20, 2012 12:22 pm

how did you arrive at the conclusion that your text is not 120 pixels?
A lot of fonts specified at particular px size will look visibly different in height. That's because the designs are very different in height whilst still conforming to the specified X height. It's even allowed that a font specified with particular size can go over this, onto the leading. That's for print design though......for the web (web technologies, which includes svg) the font size actually specifies X height + leading.
Then there's also the display itself, where the DPI setting and other aspects of screen display...things displayed at 100% zoom are usually not displayed 100% actual size.


Return to “SVG / XML Code”