This commit is contained in:
Kathy Ruffing 2008-03-13 12:55:47 +00:00
parent 3b05362ba2
commit 859851d499

View File

@ -58,6 +58,14 @@ namespace VEPROMS.CSLA.Library
FormatInfo format = itemInfo.ActiveFormat;
if (epMode == E_EditPrintMode.Print || vwMode == E_ViewMode.View) text = DoReplaceWords(text, format);
// as a precaution, convert any \~ to \u160?. This is for Hard spaces.. see the commentary in the
// save portion of this code for an explanation.
text = text.Replace(@"\~", @"\u160?");
// replace the dash/hyphen or whatever you want to call it, with a hard hyphen. The 16-bit program
// treated the dash/hyphen as such. Translate back on any data saves.
text = text.Replace(@"-", @"\u8209?");
// displayTextElement List items are created for anything that is handled differently in RTB, i.e.
// symbols, ros, trans, text.
int startIndex = 0;
@ -272,14 +280,31 @@ namespace VEPROMS.CSLA.Library
}
private void RtfToDisplayTextElements(RichTextBox rtb)
{
// For hardspaces, the windows richtextbox does some 'quirky' things:
// A unicode representation of \u160? is sent INTO the rtb. Coming out,
// that \u160? was translated to a \~ (by the underlying windows rtb).
// Note that if the \~ is sent to the rtb, it is treated as a regular space,
// i.e. no longer a hardspace, and actually is converted to a regular space.
// SO, on the way out, convert any \~ to \u160?
string noExtraRtfStr = rtb.Rtf.Replace(@"\~", @"\u160?");
// GetFontTable returns a non-negative number font number in the
// font table for the unicode font, if it is used (otherwise -1)
//int unicodeFont = GetFontTable(rtb.Rtf);
// strip off all rtf commands...
string noExtraRtfStr = StripRtfCommands(rtb.Rtf);
noExtraRtfStr = StripRtfCommands(noExtraRtfStr);
//Console.WriteLine("StripRtf: {0}", noExtraRtfStr);
// Also, set back the hard dash to a regular dash... Do this after the removal
// of other rtf commands though since the \u8209 was surrounded by font commands
// that, without there removal first, was also removing the dash. Have it with
// a space & without because if it is at the end, there will be no space (leave
// it to rtf processing to make it more complicated)
noExtraRtfStr = noExtraRtfStr.Replace(@"\u8209? ", @"-");
noExtraRtfStr = noExtraRtfStr.Replace(@"\u8209?", @"-");
DisplayTextElementList.Clear();
int startIndex = 0;
int index = -1;