This commit is contained in:
Kathy Ruffing 2012-05-03 12:43:46 +00:00
parent 052ae3d424
commit b76d2a0c46

View File

@ -88,11 +88,17 @@ namespace fmtxml
} }
private const string _TripleBang = "\xAD\xAD\xAD\xA8\xA8"; private const string _TripleBang = "\xAD\xAD\xAD\xA8\xA8";
Regex regLines = new Regex(@"([^\r\n]*)?\r?\n", RegexOptions.Singleline); Regex regLines = new Regex(@"([^\r\n]*)?\r?\n", RegexOptions.Singleline);
// If processing any of the RGE (except RGEDEV) C0 macros, adjust the x location of the ellipse, so that
// 32bit printing matches 16bit. This flag shows that we're in a format that needs this adjustment.
private static bool _InRge = false;
private static bool _DoingRgeC0 = false;
private string CreateSvg(FileInfo file, string buff) private string CreateSvg(FileInfo file, string buff)
{ {
IsGenMac = (buff.Substring(0, 5) == _TripleBang); IsGenMac = (buff.Substring(0, 5) == _TripleBang);
if(!IsGenMac) if(!IsGenMac)
return null; return null;
_InRge = (file.Name.ToUpper().Contains("RGE") && !file.Name.ToUpper().Contains("RGEDEV"));
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
MatchCollection lines = regLines.Matches(buff); MatchCollection lines = regLines.Matches(buff);
bool svg = false; bool svg = false;
@ -107,9 +113,15 @@ namespace fmtxml
else else
AddSvgSuffix(sb, hasC0); AddSvgSuffix(sb, hasC0);
else if (text.StartsWith("\xAD\xAD")) else if (text.StartsWith("\xAD\xAD"))
{
hasC0 |= AddGroupStart(sb, ref group, text).ToLower() == "c0"; hasC0 |= AddGroupStart(sb, ref group, text).ToLower() == "c0";
_DoingRgeC0 = (hasC0 && _InRge);
}
else if (text == "END") else if (text == "END")
{
group = AddGroupEnd(sb, group); group = AddGroupEnd(sb, group);
_DoingRgeC0 = false;
}
else if (text != "") else if (text != "")
ProcessCommand(sb, text, file); ProcessCommand(sb, text, file);
} }
@ -249,7 +261,7 @@ namespace fmtxml
// add in the radius to the 'y' to get the correct value. // add in the radius to the 'y' to get the correct value.
float yadj = TwipsToPointsEllipse(ellipseMatch.Groups[4].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), _DoingRgeC0?6.5:TwipsToPointsX(ellipseMatch.Groups[1].Value),
yadj + TwipsToPointsY(ellipseMatch.Groups[2].Value), yadj + TwipsToPointsY(ellipseMatch.Groups[2].Value),
TwipsToPointsEllipse(ellipseMatch.Groups[3].Value), TwipsToPointsEllipse(ellipseMatch.Groups[3].Value),
TwipsToPointsEllipse(ellipseMatch.Groups[4].Value), TwipsToPointsEllipse(ellipseMatch.Groups[4].Value),