diff --git a/PROMS/fmtxml/RtfToSvg.cs b/PROMS/fmtxml/RtfToSvg.cs index abd16d26..2a225a7c 100644 --- a/PROMS/fmtxml/RtfToSvg.cs +++ b/PROMS/fmtxml/RtfToSvg.cs @@ -244,11 +244,14 @@ namespace fmtxml private static void AddEllipse(StringBuilder sb, string 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(" \r\n", TwipsToPointsX(ellipseMatch.Groups[1].Value), - TwipsToPointsY(ellipseMatch.Groups[2].Value), - TwipsToPoints(ellipseMatch.Groups[3].Value), - TwipsToPoints(ellipseMatch.Groups[4].Value), + yadj + TwipsToPointsY(ellipseMatch.Groups[2].Value), + TwipsToPointsEllipse(ellipseMatch.Groups[3].Value), + TwipsToPointsEllipse(ellipseMatch.Groups[4].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); @@ -322,6 +325,13 @@ namespace fmtxml { 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) { return (_Xoff + float.Parse(twips)) / 20;