This commit is contained in:
Kathy Ruffing 2012-03-30 10:53:10 +00:00
parent 189e2e64a7
commit f90dfb4908

View File

@ -244,11 +244,14 @@ namespace fmtxml
private static void AddEllipse(StringBuilder sb, string text) private static void AddEllipse(StringBuilder sb, string text)
{ {
Match ellipseMatch = regEllipse.Match(text); Match ellipseMatch = regEllipse.Match(text);
// code in the new veproms that draws the ellipse must use the 'y' location differently. So
// add in the radius to the 'y' to get the correct value.
float yadj = TwipsToPointsEllipse(ellipseMatch.Groups[4].Value);
sb.Append(string.Format(" <ellipse cx=\"{0}\" cy=\"{1}\" rx=\"{2}\" ry=\"{3}\" fill=\"none\" stroke=\"black\" stroke-width=\"{4}\" />\r\n", sb.Append(string.Format(" <ellipse cx=\"{0}\" cy=\"{1}\" rx=\"{2}\" ry=\"{3}\" fill=\"none\" stroke=\"black\" stroke-width=\"{4}\" />\r\n",
TwipsToPointsX(ellipseMatch.Groups[1].Value), TwipsToPointsX(ellipseMatch.Groups[1].Value),
TwipsToPointsY(ellipseMatch.Groups[2].Value), yadj + TwipsToPointsY(ellipseMatch.Groups[2].Value),
TwipsToPoints(ellipseMatch.Groups[3].Value), TwipsToPointsEllipse(ellipseMatch.Groups[3].Value),
TwipsToPoints(ellipseMatch.Groups[4].Value), TwipsToPointsEllipse(ellipseMatch.Groups[4].Value),
TwipsToPoints(ellipseMatch.Groups[5].Value))); TwipsToPoints(ellipseMatch.Groups[5].Value)));
} }
private static Regex regBox = new Regex(@"BOX ([-0-9]*) ([-0-9]*) ([-0-9]*) ([-0-9]*) ([-0-9]*)", RegexOptions.Multiline); private static Regex regBox = new Regex(@"BOX ([-0-9]*) ([-0-9]*) ([-0-9]*) ([-0-9]*) ([-0-9]*)", RegexOptions.Multiline);
@ -322,6 +325,13 @@ namespace fmtxml
{ {
return float.Parse(twips) / 20; return float.Parse(twips) / 20;
} }
private static float TwipsToPointsEllipse(string twips)
{
// divide the ellipse by 40. This is the 20 to convert from twips to points
// and an addition divide by 2 since the definition in 16bit is diameter &
// in 32 is radius.
return float.Parse(twips) / 40;
}
private static float TwipsToPointsX(string twips) private static float TwipsToPointsX(string twips)
{ {
return (_Xoff + float.Parse(twips)) / 20; return (_Xoff + float.Parse(twips)) / 20;