Closed Bug 305961 Opened 19 years ago Closed 14 years ago

Inconsistent font-scaling behavior with SVG on Linux and Windows

Categories

(Core :: SVG, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: j.prevost, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+

On Windows, SVG text does not seem to scale as you adjust the display size
(using Ctrl-+ and Ctrl--.)  Whether sizes are defined in terms of absolute or
relative units, changing the UI's text size seems to have no impact.

On Linux, SVG font sizes do seem to scale.  This happens whether or not absolute
sizes are set in the SVG, even though one would expect that if an absolute "1in"
size box is always the same size in SVG, an absolute "12pt" (aka "0.1667in")
font would also be the same size.

I'd argue that the *right* thing to do here is to have the default font-size be
based on the page's font size (so using em and ex units for everything will
cause the image to scale), but to allow absolute units to be used (which will
cause things to always stay the same size, rather than scaling.)

Regardless, having this behave so very differently on different platforms is
clearly a problem.

Reproducible: Always

Steps to Reproduce:
1. Visit http://laurelin.dementia.org/~jprevost/badness-example.xml
2. On Windows, use Ctrl-+ and Ctrl-- to change the font size.
3. On Linux, use Ctrl-+ and Ctrl-- to change the font size.

Actual Results:  
On Windows, scaling the font size up and down results in an text that scales at
the same rate as the image.

On Linux, scaling the font size up and down increases the size of the image (the
image's scaling factor), and also increases the size of the font within the
image.  (So the image gets larger, and the text gets much larger.)

Expected Results:  
The two versions should have behaved consistently.  (Preferably, scaling em unit
sized text, not scaling absolute unit sized text.)
New info: On Windows, it looks like it does, in fact, scale--but only on page
reload.  So, on Linux, text in SVG rescales dynamically as you use Ctrl-+ and
Ctrl--.  On Windows, text in SVG rescales only after reloading a page.
Deer Park 1.6a1

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20050912
Firefox/1.6a1

-----

SVG text is scaled according to SVG graphics bounding box, so I don't feel this
as problem (I tested on Win2000 only).

I am confident than Windows build is OK.

-----
This is XSLT output code:
-----

    <div style="width: 20em; height: 3.333em;">
      <svg width="100%" height="100%" style="text-anchor: middle; font-size:
12pt;" viewBox="0 0 453.5 75.6" xmlns="http://www.w3.org/2000/svg">
        <desc>
          Example linecap - demonstrates three stroke-linecap values
        </desc>
        <rect x="1" y="1" width="451" height="73" style="fill: none; stroke:
blue;"/>
        <g transform="translate(75.6, 28.3)">
          <line x1="-47.2" x2="47.2" y1="0" y2="0" style="stroke: black;
stroke-width: 26.4; stroke-linecap: butt;"/>
          <line x1="-47.2" x2="47.2" y1="0" y2="0" style="stroke: rgb(255, 204,
204); stroke-width: 1.8;"/>
          <circle id="circle1" cx="-47.2" cy="0" r="3" style="fill: rgb(255,
204, 204); stroke: none;"/>
          <circle id="circle2" cx="47.2" cy="0" r="3" style="fill: rgb(255, 204,
204); stroke: none;"/>
          <text y="34">
            'butt' cap
          </text>
        </g>
...

      </svg>
    </div>

(In reply to comment #1)
> New info: On Windows, it looks like it does, in fact, scale--but only on page
> reload.  So, on Linux, text in SVG rescales dynamically as you use Ctrl-+ and
> Ctrl--.  On Windows, text in SVG rescales only after reloading a page.

RELOAD is no more needed on Windows OS

---

Deer Park 1.6a1

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20050912
Firefox/1.6a1
Font zoom affects CSS used font sizes (it's applied after the computation stage).  So resizing "12pt" fonts is correct.

Given that, is there still an issue here in current trunk builds?
I've tested this on Gentoo.

Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5

When scaling fonts in Japanese, I am only able to get two different font sizes,
regardless of what scale the fonts are presented at. 

I theorize it has something to do with the Japanese fonts provided; 
Perhaps they use bitmaps and are incapable of scaling?
This still looks very patchy, tested on Gentoo linux.

Basic display of svg is fine but but zooming the page seems only to affect text, ie it the same as changing page's text size: cf [cntl][sh]Z , [cntl]+ 

I have jet to manage to increase the size of any svg display which does rather defeat the object of this file format!

 
Assignee: general → nobody
QA Contact: ian → general
ff 3.0.8

I see this as completely resolved on linux. text in SVG and the surrounding html content scale correctly.

I have not done extensive testing but in the context I use it : svg embedded in html , this seems to work fine.
Resolving as WFM based on comment 7.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.