Closed Bug 291785 Opened 19 years ago Closed 19 years ago

rendered text size within an svg image depends on browser text-zoom value

Categories

(Core :: SVG, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bugzilla.mozilla.org, Assigned: scootermorris)

References

Details

Attachments

(1 file, 2 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050418
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050418

the size of text contained in an SVG image <svg:text>some text</svg:text>
changes with increasing/decreasing the "Text-Zoom" value in the browser

Since the Text is part of an Image (svg image) it should remain as defined in
the SVG (CSS) and only change if the whole SVG image gets scaled up/down

Reproducible: Always

Steps to Reproduce:
1. load an SVG containing some text
2. increase7decrease text-zoom (via menu or keyboard <ctrl><+>/<ctrl><->)
3. reload SVG image

Actual Results:  
text size is different than at initial load

Expected Results:  
text size should remain unaffected
Attached patch Unzoom the fonts in SVG (obsolete) — Splinter Review
Assignee: general → scootermorris
Status: UNCONFIRMED → ASSIGNED
Attachment #181910 - Flags: review?(tor)
Attachment #181910 - Attachment is obsolete: true
Attachment #181911 - Flags: review?(tor)
Attachment #181910 - Flags: review?(tor)
Has anyone tried this on libart?  The font logic is a little different and I
don't have a libart build. 
Attachment #181911 - Flags: review?(tor) → review+
Attachment #181911 - Flags: approval1.8b2?
Attachment #181911 - Flags: approval1.8b2?
Attachment #181911 - Flags: superreview?(roc)
Comment on attachment 181911 [details] [diff] [review]
Same patch (unzoom SVG fonts), with comments :-)

why do we care about libart at all?
Attachment #181911 - Flags: superreview?(roc) → superreview+
Attachment #181911 - Flags: approval1.8b2?
Comment on attachment 181911 [details] [diff] [review]
Same patch (unzoom SVG fonts), with comments :-)

moving request out to b3. we're wrapped on b2.
Attachment #181911 - Flags: approval1.8b3?
Attachment #181911 - Flags: approval1.8b2?
Attachment #181911 - Flags: approval1.8b2-
Comment on attachment 181911 [details] [diff] [review]
Same patch (unzoom SVG fonts), with comments :-)

Not approving for now while we gather feedback, as it seems that text-zoom as a
user request should affect all text on the page.  Added an entry on the Mozilla
SVG blog.
Attachment #181911 - Flags: approval1.8b3? → approval1.8b3-
*** Bug 298800 has been marked as a duplicate of this bug. ***
(In reply to comment #6)
> (From update of attachment 181911 [details] [diff] [review] [edit])
> Not approving for now while we gather feedback, as it seems that text-zoom as a
> user request should affect all text on the page.  Added an entry on the Mozilla
> SVG blog.
> 

See the testcase at http://www.dtmf.com/svgt/x.xml

In this particular case, the entire svg image is placed in a container whose
size is specified in ems, thereby scaling the image with the user's text-zoom. 
If the <text> within the image is further scaled (as things are without the
proposed patch), that causes double-scaling of the <text>.

IMHO, if the page author wishes the text contained in an <svg> to scale for the
user under text-zoom, the <svg> containing the text should be sized to ems as in
my example, and the patch proposed is the right solution.  Text font sizes
inside of an svg object are relative to the svg itself, not to the page
containing the svg.

I'm not entirely sure whether the SVG and/or XHTML and/or CSS specs have
anything to say on the matter definitively.
(In reply to comment #6)
> (From update of attachment 181911 [details] [diff] [review] [edit])
> Not approving for now while we gather feedback, as it seems that text-zoom as a
> user request should affect all text on the page.  Added an entry on the Mozilla
> SVG blog.
> 

Now that we have the feedback, can we make a decision on this?  I think its time
to move ahead and get this patch checked in.
As discussed on IRC, this patch should go ahead until we have page scaling in place.
Flags: blocking1.8b4?
Flags: blocking1.8b4? → blocking1.8b4-
Attachment #181911 - Flags: approval1.8b4?
Whiteboard: looking for dbaron's input
This is really the wrong fix, although the fundamental problem is that SVG's
notion of scalability never fit in with existing Web standards (and doesn't
really fit in with the Web in the first place).

The first step to fixing this would be propagating either SVG's transform or 
through the style system (although what we really care about is how much scaling
is done, but that can be different in different dimensions).  That would help in
fixing this and other bugs (minimum font size), since the style system code
should know how much scaling is happening.

Text zoom really should affect SVG content iff the transform is derived from
units not based on the default font size.  That's basically the way text zoom
works for everything else.

That said, this is hard to fix because the SVG model doesn't really fit in with
the CSS model and in fact violates many of the rules CSS specifies regarding units.
That said, this patch is probably better than not having it, although only slightly.
Whiteboard: looking for dbaron's input
Attachment #181911 - Flags: approval1.8b4? → approval1.8b4+
*** This bug has been confirmed by popular vote. ***
Ever confirmed: true
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
, too
Flags: blocking1.8.1?
*** Bug 318716 has been marked as a duplicate of this bug. ***
I've been watching this bug for quite a while and tend to agree with Comment #12, even though, to me and probably many Web developers, this is a *critical* limitation: I require my graphics to either scale or not with the text. I can do both with raster images, but not - paradoxically - with "Scalable" Vector Graphics (neither make them scale consistently, nor prevent them from scaling)!
To be able to do my work until a quick-fix patch is applied or a real solution is found, I came up with a Javascript workaround that undoes text-zoom scaling. Watch it it action at http://www.montefiore.ulg.ac.be/~piater/code/x.xhtml (adapted from http://www.dtmf.com/svgt/x.xml from Comment #8); you have to reload the page to trigger the SVG text scale correction after zooming.
I welcome comments on my Javascript workaround, especially on how to make it work with external SVG (in <object/>), and on how to avoid having to reload the page to trigger the Javascript.
Better yet, I'd really like to see this bug fixed. Given that Gecko is just about the only quality solution to SVG on the Web, the current non-scalability of SVG is likely a considerable obstacle to a wider adoption of SVG on the Web. Fix this and Bug 288276, and turn on SVG by default...
Attachment #181911 - Attachment is obsolete: true
Attachment #208800 - Flags: review?(tor)
Attachment #208800 - Flags: review?(tor) → review+
Checked in on trunk:
cvs commit layout/svg/renderer/src/cairo/nsSVGCairoGlyphMetrics.cpp
Checking in layout/svg/renderer/src/cairo/nsSVGCairoGlyphMetrics.cpp;
/cvsroot/mozilla/layout/svg/renderer/src/cairo/nsSVGCairoGlyphMetrics.cpp,v  <--  nsSVGCairoGlyphMetrics.cpp
new revision: 1.12; previous revision: 1.11
done

Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Problem remains in Firefox 1.5.0.2
Why is it marked as "RESOLVED FIXED" ?

Please don't scale SVG-text with ctrl+/- there's abolutely no need for that !
You can scale the complete SVG image with "em" notation.

This BUG could as well be solved by a full page zoom like in IE7 !
Problem remains in Firefox 1.5.0.3 and 1.5.0.4 rc3 , Bon Echo alpha2

If there is a working patch, why is it not built-in the next Version of Firefox ?
Not going to block 1.8.1 for this bug, but feel free to request approval to land this on the 1.8 branch.
Flags: blocking1.8.1? → blocking1.8.1-
Do we have any further clarification on this from the SVG or CSS WGs?

it's evident to me at least that users may wish to zoom text, image or both.
and it's important that the UI is transparent or natural and easy to use.

whilst in reality we are a long way from this....

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: