On 2017-08-28 01:25 AM, Joachim Durchholz wrote:
I see that XY positioning uses dimensionless numbers, while font sizes are given in pixels. If the browser interprets the XY values as something different than pixels, this would explain what migmit is seeing. I don't know whether the SVG or the browser is wrong.
In SVG, lack of unit is taken to mean the px unit. So <text font-size="6px" x="5" y="7" ...> means the same thing as <text font-size="6" x="5px" y="7px" ...>. Next, the fun part is the beginning <svg width="8.5in" height="11in" viewBox="0 0 170 220" ...> which means: 1px horizontal means 8.5in/170 = 0.05in 1px vertical means 11in/220 = 0.05in Lastly, to be sure, a web browser is going to have its own twisted idea of what 1in means, but empirically desktop web browsers use the simpifying assumption 96dpi (configurable by poorly documented ways IIRC) so they're going to use 96 physical pixels per "1in". (Indeed, I have used 3 desktop monitors, including 1 CRT, during the last 20 years and they all did/do approximately 96dpi, and today I just tested an SVG of a 5in-by-5in square and it does measure almost 5 inches. To be sure, Apple products that boast "retina display" and Microsoft Surface Pro are another story, 220-400dpi.) So I think this SVG code is pretty robust to scaling. And real web browsers are actually pretty close to theory in this regard.