Closed Bug 358032 Opened 13 years ago Closed 13 years ago

SVG text too big when minimum font size set

Categories

(Core :: SVG, defect)

x86
Windows XP
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: jpsa, Assigned: longsonr)

References

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0

I have a minimum font size (Tools>Options>Content>Fonts&Colours>Advanced>Minimum font size) of 18. When I view the attached SVG file the text is much larger than expected (much bigger than the minimum applied to ordinary text in web pages).

Reproducible: Always

Steps to Reproduce:
1. Set a minimum font size of 18
2. Open the attached SVG file
3. Note that the text is very large

Actual Results:  
The text in SVG is about 4 times the size of text on ordinary web pages.

Expected Results:  
I was not actually expecting my chosen minimum text size to affect SVG text at all, but assuming this behaviour to be deliberate, I was expecting the size to be the same as that of text on ordinary web pages.
duplicate of bug 291785 perhaps?
(In reply to comment #2)
> duplicate of bug 291785 perhaps?
> 

Different issue on investigation.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch patchSplinter Review
Assignee: general → longsonr
Status: NEW → ASSIGNED
Attachment #243894 - Flags: review?(jwatt)
I'm not sure why we'd want to use our computed size instead of our actual size. I think we more likely want to just remove the horrible SVG hack to font sizes in SVG.
(In reply to comment #5)
> I'm not sure why we'd want to use our computed size instead of our actual size.
> I think we more likely want to just remove the horrible SVG hack to font sizes
> in SVG.
> 

From nsStyleStruct.h

  nsFont  mFont;        // [inherited]
  nscoord mSize;        // [inherited] Our "computed size". Can be different from mFont.size
                        // which is our "actual size" and is enforced to be >= the user's
                        // preferred min-size. mFont.size should be used for display purposes
                        // while mSize is the value to return in getComputedStyle() for example.

I don't think we want to be affected by the min-size setting in SVG just as we ignore the zoom setting.
Attachment #243894 - Flags: review?(jwatt) → review?(tor)
Tor,

I can see that nsRuleNode::SetDefaultOnRoot puts in a minimum size to mFont.size.

Jonathan told me he thought that mSize might differ from mFont.size in more ways than minimum size (in which case this fix is operating on incorrect assumptions and may be wrong) but that he wasn't sure. Accordingly I've made you the reviewer and cc'd bzbarsky.

This fix is in the same vein as bug 291785 which stopped zoom affecting svg text.
Hey, don't ask me about this stuff.  It's confusing.  ;)  dbaron and roc might know...
Attachment #243894 - Flags: review?(tor) → review+
Attachment #243894 - Flags: superreview?(roc)
Comment on attachment 243894 [details] [diff] [review]
patch

I don't really know either but I think we should give it a go. Most likely any other corrections would also not be wanted for SVG.
Attachment #243894 - Flags: superreview?(roc) → superreview+
checked in.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Robert drew my attention to this bug.

the attachment is overly complex as a test for font size.

For OS X with camino or minefield

It's not clear to me that this is resolved satisfactorily at all.

I can barely see the font in the SVG attachment.

changing the default application font size has no effect

should the scope be widened to all OS and reopened?
(In reply to comment #11)
> Robert drew my attention to this bug.
> 
> the attachment is overly complex as a test for font size.
> 
> For OS X with camino or minefield
> 
> It's not clear to me that this is resolved satisfactorily at all.
> 
> I can barely see the font in the SVG attachment.
> 
> changing the default application font size has no effect
> 
> should the scope be widened to all OS and reopened?
> 

When I display the testcase on firefox on XP the numbers fill the box.

Changing the default application font size should not have any effect on text in SVG. If you want to open another bug about font sizing on Macs that's up to you. I don't think this one should be reopened, the issue raised in it is fixed.. 


Blocks: 290044
This bug is still present in version 30.0 on OSX. It's trivially easy to reproduce given the original SVG attachment. The fundamental problem is that minimum font sizes are specified in points (or perhaps pixels), while the SVG font-size attribute is given in units of the current viewbox coordinate system. When SVG font-size is specified, Firefox applies the minimum clamp BEFORE the viewbox units are transformed to pixels, but it should be applied AFTER that transformation.
bug 935056 is tracking the regression with minimum font size.
You need to log in before you can comment on or make changes to this bug.