Unverified Commit 50e5d1f7 authored by mrbean-bremen's avatar mrbean-bremen
Browse files

Fixed intial font-size - now set to 1em

- added basic support for "medium", "small" etc. font-size values
- fixes #419
parent 02ce5a4f
......@@ -32,6 +32,23 @@ namespace Svg
if (unit == "none")
return SvgUnit.None;
// Note: these are ad-hoc values based on a factor of about 1.2 between adjacent values
// see https://www.w3.org/TR/CSS2/fonts.html#value-def-absolute-size for more information
if (unit == "medium")
unit = "1em";
else if (unit == "small")
unit = "0.8em";
else if (unit == "x-small")
unit = "0.7em";
else if (unit == "xx-small")
unit = "0.6em";
else if (unit == "large")
unit = "1.2em";
else if (unit == "x-large")
unit = "1.4em";
else if (unit == "xx-large")
unit = "1.7em";
for (int i = 0; i < unit.Length; i++)
{
// If the character is a percent sign or a letter which is not an exponent 'e'
......
......@@ -361,7 +361,7 @@ namespace Svg
var fontSizeUnit = this.FontSize;
if (fontSizeUnit == SvgUnit.None || fontSizeUnit == SvgUnit.Empty)
{
fontSize = 1.0f;
fontSize = new SvgUnit(SvgUnitType.Em, 1.0f);
}
else
{
......
......@@ -199,6 +199,7 @@ __issue-345-01
__issue-354-01
__issue-385-01_Test_text-anchor-middle
__issue-398-01
__issue-419-01
__pull_request-373-01
__pull_request-374-01
__pull_request-414-01
......
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="seatplan">
<rect id="stage" x="100" y="50" width="100" height="50" fill="white" stroke="black" />
<text x="130" y="80" text-anchor="middle" fill="black">Stage</text>
</svg>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment