mustang2247 / svgweb

Automatically exported from code.google.com/p/svgweb
Other
0 stars 0 forks source link

Text with large font-size displays smaller #440

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
While switching between flash rendering and native rendering of the
attachment to Issue 439 I noticed that the flash rendered text was smaller.
 After some trial and error I produced the attached test case to show the
problem better.

The test is a line of increasing font-size values.  The displayed text is
the actual font-size in the SVG.  The rectangles are just for reference to
show where the text should be positioned.

What should be seen is increasing sized text from left to right.  With
flash rendering, the displayed text maxes out at around 128.

--
Tested with Xp, Vista, Opera, Firefox, Webkit,... Flash 10 and
Gelatinous-Cube. The attached example embeds svg via the script tag and
references svg.js:
<script src="../src/svg.js" data-path="../src"></script>

Original issue reported on code.google.com by k...@svgmaker.com on 11 Dec 2009 at 6:55

Attachments:

GoogleCodeExporter commented 8 years ago
I should have noted that the problem is with native fonts, not SVG fonts.

Original comment by k...@svgmaker.com on 11 Dec 2009 at 7:16

GoogleCodeExporter commented 8 years ago
After some searching it appears that there is a limit to the value which can be
assigned to TextFormat.size (127).   I made the attached patch as a workaround 
to
this apparent limit.

Essentially, in SVGTextNode.setAttributes(), set textFormat.size to a nominal 
value
(I chose 72.0).  Do all the positioning calculations based on the nominal 
value, then
later scale the _textField by the amount fontSizeNum/72.0.  Some repositioning 
of
_textField.x and y is also required.

This patch appears to also fix the problem with Issue 264: Text with fractional
font-size not displayed.

Original comment by k...@svgmaker.com on 11 Dec 2009 at 7:29

Attachments:

GoogleCodeExporter commented 8 years ago
Patch integrated from Issue 405 in r1048.

Original comment by grick23@gmail.com on 27 Feb 2010 at 11:01