Export to GitHub

svgweb - issue #440

Text with large font-size displays smaller


Posted on Dec 11, 2009 by Massive Giraffe

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>

Attachments

Comment #1

Posted on Dec 11, 2009 by Massive Giraffe

I should have noted that the problem is with native fonts, not SVG fonts.

Comment #2

Posted on Dec 11, 2009 by Massive Giraffe

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.

Attachments

Comment #3

Posted on Feb 27, 2010 by Grumpy Dog

Patch integrated from Issue 405 in r1048.

Status: Fixed

Labels:
Type-Defect Priority-Low