Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Firefox don´s show very small font size

82 views
Skip to first unread message

Taciano Pinheiro

unread,
Jun 6, 2008, 5:08:33 PM6/6/08
to
I need to use very small font size in text element into SVG, such as:
0.00638870000000000

But when the font size is very small, her is not showed

Somebody knows what it is occurring?

Thanks,

Taciano Pinheiro

Boris Zbarsky

unread,
Jun 6, 2008, 6:44:56 PM6/6/08
to
Taciano Pinheiro wrote:
> Somebody knows what it is occurring?

You're asking the operating system for a font of that size. The operating
system font subsystem rounds font sizes; in this case it rounds to 0.

-Boris

Boris Zbarsky

unread,
Jun 6, 2008, 6:45:20 PM6/6/08
to
Taciano Pinheiro wrote:
> I need to use very small font size in text element into SVG, such as:
> 0.00638870000000000

Of course the real question here is why you think you need that....

-Boris

Taciano Pinheiro

unread,
Jun 8, 2008, 9:10:16 AM6/8/08
to

But in the Plugin Adobe SVG in Internet Explorer this font size
functions perfectly. I use this font size in a system of geographic
information to show the scale of a map in determined very high level
of zoom in.

Boris Zbarsky

unread,
Jun 8, 2008, 2:22:10 PM6/8/08
to
Taciano Pinheiro wrote:
> But in the Plugin Adobe SVG in Internet Explorer this font size
> functions perfectly.

They might be doing something different in terms of the font they actually ask
the OS for.

> I use this font size in a system of geographic
> information to show the scale of a map in determined very high level
> of zoom in.

Seems like it would make more sense to take a reasonable font-size and then
scale it down in your SVG if you just want "really small text"...

-Boris

rocal...@gmail.com

unread,
Jun 10, 2008, 1:59:12 PM6/10/08
to
I don't know which version Taciano is testing, but in Firefox 3 if you
specify a miniscule font size and then scale it up a lot, we ask the
OS for the scaled font size only.

There is still a problem in the style system, which is that 'font-
size' is stored as an nscoord in appunits (1/60 of a CSS px). So 0.006
rounds down to 0 appunits :-(. The only way to fix this would be to
store the style data as unrounded floats... Even the far-off
conversion of nscoord to float wouldn't help since with that plan,
nscoords are still rounded to whole appunits.

Rob

Klaus Förster

unread,
Jun 18, 2008, 5:53:52 AM6/18/08
to

Maybe he's placing labels on a worldmap that uses geographic
coordinates within a viewbox?

-Klaus

Boris Zbarsky

unread,
Jun 18, 2008, 11:22:41 AM6/18/08
to
Klaus Förster wrote:
> Maybe he's placing labels on a worldmap that uses geographic
> coordinates within a viewbox?

That doesn't answer my question. One can use a reasonable-sized font and then
scale the text in the SVG to be very small...

-Boris

Klaus Förster

unread,
Jun 19, 2008, 3:01:35 AM6/19/08
to

Isn't the font-size within the following example quite reasonable if
you want the text to be as big as the circle?

<svg xmlns="http://www.w3.org/2000/svg" viewBox="9.50227 -47.24023
0.10806 0.17379">
<title>Map of Liechtenstein</title>
<rect x="9.5022" y="-47.24023" width="0.10806" height="0.17379"
fill="silver"/>
<circle cx="9.52209" cy="-47.13935" r="0.002" />
<text x="9.52209" y="-47.13935" font-size="0.004">Vaduz</text>
</svg>

The circle has a radius of 0.002 and is scaled up for display
according to the viewBox. That's what I would expect for the text as
well making a font-size of 0.0063887 completely valid. How should one
solve this issue with FF?

-Klaus

Boris Zbarsky

unread,
Jun 19, 2008, 11:48:59 AM6/19/08
to
Klaus Förster wrote:
> Isn't the font-size within the following example quite reasonable

It depends on whether you actually want a "0.004px" font (with the right hinting
for that font size!) scaled to your bigger size, or whether you want something
readable.

Keep in mind that scaling a 6px font by a factor of 2 using an affine
transformation is NOT the same as using a 12px font.

-Boris

Klaus Förster

unread,
Jun 19, 2008, 12:28:10 PM6/19/08
to

according to section 7.10 Units (http://www.w3.org/TR/SVG/
coords.html#Units) within the SVG 1.1 specification "all coordinates
and lengths in SVG can be specified with or *without* a unit
identifier" and further on "when a coordinate or length value is a
number without a unit identifier (e.g., "25"), then the given
coordinate or length is assumed to be in user units (i.e., a value in
the current user coordinate system). For example: <text style="font-
size: 50">Text size is 50 user units</text>".

Doesn't this imply that the font-size="0.004" should *not* be
interpreted as "px" but rather as size hint within the established
viewPort? Is it impossible to "scale" a font-size in a similar way as
the circle radius? I'm not really into font-metrics math but I think
there should be a way to accomplish it - at least it's been done for
ASV3 as Taciano confirmed.

-Klaus

Ken Stacey

unread,
Jun 19, 2008, 9:13:52 PM6/19/08
to dev-te...@lists.mozilla.org
Boris Zbarsky wrote:

> Keep in mind that scaling a 6px font by a factor of 2 using an affine
> transformation is NOT the same as using a 12px font.

Like this ?

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 30">
<text transform="translate(0,12) scale(12)" font-size="1">1px*12</text>
<text transform="translate(0,25)" font-size="12">12px</text>
</svg>

The 1px font-size scaled by 12 looks the same as the 12px font-size. As
you would expect.

It "shouldn't" matter what the font-size is nor the scaling. The only
thing that matters is the font-size in initial viewPort coordinates (eg
screen pixels) after applying the CTM. Then the viewing agent renders
that size.

There are limitations in Firefox - the viewPort font-size is rounded,
and there is the limit placed on nscoord (as described by Robert
O'Callahan earlier).

I think that Klaus' font-size is victim of the nscoord limit. If you
just play with the font-size in Klaus' recent message, (using Firefox
2.0.0.14) the text is not rendered at 0.032, but is rendered at 0.033.

Klaus, is it unreasonable for you to multiply all your coordinates by 1000?

<svg xmlns="http://www.w3.org/2000/svg"
viewBox="9502.27 -47240.23 108.06 0173.79">


<title>Map of Liechtenstein</title>

<rect x="9502.2" y="-47240.23" width="108.06" height="173.79"
fill="silver"/>
<circle cx="9522.09" cy="-47139.35" r="2" />
<text x="9522.09" y="-47139.35" font-size="4">Vaduz</text>
</svg>

(I mistakenly sent this message to www-svg and got an informative reply
from Dr Olaf Hoffman. He points out that the numbers in this example
where I blindly multiplied by 1000 are outside the number range for SVG
Tiny - '-32,767.9999 to +32,767.9999' )

Ken

Boris Zbarsky

unread,
Jun 20, 2008, 12:29:07 AM6/20/08
to
Ken Stacey wrote:
> Like this ?
>
> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 30">
> <text transform="translate(0,12) scale(12)" font-size="1">1px*12</text>
> <text transform="translate(0,25)" font-size="12">12px</text>
> </svg>
>
> The 1px font-size scaled by 12 looks the same as the 12px font-size. As
> you would expect.

As Robert said, we now scale before rendering. That is, we do NOT scale
the font using an affine transformation.

> It "shouldn't" matter what the font-size is nor the scaling. The only
> thing that matters is the font-size in initial viewPort coordinates (eg
> screen pixels) after applying the CTM. Then the viewing agent renders
> that size.

That implies a non-affine transformation from the "specified" size, is
all. Sure.

> I think that Klaus' font-size is victim of the nscoord limit.

Yep.

-Boris

Klaus Förster

unread,
Jun 20, 2008, 5:06:36 AM6/20/08
to
will the victim be released from jail in FF 3.1?

-Klaus

Boris Zbarsky

unread,
Jun 20, 2008, 5:29:56 PM6/20/08
to
Klaus Förster wrote:
> will the victim be released from jail in FF 3.1?

You mean, will we do a complete rewrite of all code that works with
coordinates?

Unlikely.

-Boris

Klaus Förster

unread,
Jun 21, 2008, 6:13:32 AM6/21/08
to

Of course you won't rewrite all of the code and I didn't intend to ask
you to do so ;-)

font-size within SVG is special as it may be affected by a viewBox.
Are there any changes to handle this extra step as well?

-Klaus

Chris Lilley

unread,
Jun 23, 2008, 10:55:14 AM6/23/08
to Boris Zbarsky, dev-te...@lists.mozilla.org
On Thursday, June 19, 2008, 5:48:59 PM, Boris wrote:

BZ> Klaus Förster wrote:
>> Isn't the font-size within the following example quite reasonable

BZ> It depends on whether you actually want a "0.004px" font (with the right hinting
BZ> for that font size!) scaled to your bigger size, or whether you want something
BZ> readable.

The example didn't say a font size of "0.004px". It said a font size of "0.004" in the current local coordinate system.

Lets give that example an actual physical size as well for the purposes of discussion. Slightly odd sizes used for simplicity to calculate the scale value. (I note in passing that using degrees of latitude and longitude as a coordinate system, which this example does, is fairly common for large scale maps).

<svg xmlns="http://www.w3.org/2000/svg" viewBox="9.50227

-47.24023 0.10806 0.17379" width="10.806in" height="17.379in">


<title>Map of Liechtenstein</title>
<rect x="9.5022" y="-47.24023" width="0.10806" height="0.17379"
fill="silver"/>
<circle cx="9.52209" cy="-47.13935" r="0.002" />
<text x="9.52209" y="-47.13935" font-size="0.004">Vaduz</text>
</svg>

So a font-size of 0.004 in that coordinate system comes out at 0.4 inches (28.8pt, or 10.16mm).


BZ> Keep in mind that scaling a 6px font by a factor of 2 using an affine
BZ> transformation is NOT the same as using a 12px font.

Affine transformations are hopefully applied to vector geometry, not to rasterised results. Otherwise there are going to be some blurry, blocky renderings.


--
Chris Lilley mailto:ch...@w3.org
Interaction Domain Leader
W3C Graphics Activity Lead
Co-Chair, W3C Hypertext CG

rocal...@gmail.com

unread,
Jun 23, 2008, 11:19:21 PM6/23/08
to

Conceivably we could just change font-size in the style system to use
float instead of nscoord. It might not even be that hard.

Rob

sebasti...@locarise.com

unread,
Aug 22, 2014, 11:24:56 PM8/22/14
to
Does this has been fixed or there is maybe a workaround I missed? I have a similar issue with my svg text of font-size < 0.01px well displaying in Chrome, Safari and IE but not Firefox.
0 new messages