But when the font size is very small, her is not showed
Somebody knows what it is occurring?
Thanks,
Taciano Pinheiro
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
Of course the real question here is why you think you need that....
-Boris
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.
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
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
Maybe he's placing labels on a worldmap that uses geographic
coordinates within a viewbox?
-Klaus
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
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
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
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
> 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
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
You mean, will we do a complete rewrite of all code that works with
coordinates?
Unlikely.
-Boris
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
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
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