diff --git a/reformat/AppleWorks.cpp b/reformat/AppleWorks.cpp index 756ccde..b45fdde 100644 --- a/reformat/AppleWorks.cpp +++ b/reformat/AppleWorks.cpp @@ -24,6 +24,20 @@ * array of line records * $ff $ff * optional tags + * + * AppleWorks 5.0 introduced inverse and MouseText characters. + * These just use previously-unused byte ranges. The full set + * of values is thus: + * 00-1f special + * 20-7f plain ASCII + * 80-9f inverse upper (map to 40-5f) + * a0-bf inverse symbols/numbers (map to 20-3f) + * c0-df MouseText + * e0-ff inverse lower (map to 60-7f) + * + * We can output MouseText as Unicode symbols. Inverse text can use the Rich + * Text "highlight" feature; the "background color" feature doesn't seem to + * have any effect. */ /* @@ -308,6 +322,7 @@ int ReformatAWP::HandleTextRecord(uint8_t lineRecData, uint8_t byteCountPlusCR; int byteCount = lineRecData; bool noOutput = false; + bool inverse = false; int ic; tabFlags = Read8(pSrcPtr, pLength); @@ -372,40 +387,40 @@ int ReformatAWP::HandleTextRecord(uint8_t lineRecData, break; case kSpecialCharEnterKeyboard: if (fShowEmbeds) { - RTFSetColor(kColorBlue); + TextColor oldColor = RTFSetColor(kColorBlue); BufPrintf(""); - RTFSetColor(kColorNone); + RTFSetColor(oldColor); } break; case kSpecialCharPrintPageNumber: if (fShowEmbeds) { - RTFSetColor(kColorBlue); + TextColor oldColor = RTFSetColor(kColorBlue); BufPrintf(""); - RTFSetColor(kColorNone); + RTFSetColor(oldColor); } break; case kSpecialCharStickySpace: /* MSWord uses "\~", but RichEdit ignores that */ - BufPrintf(" "); + BufPrintf("\u00a0"); // Unicode NO-BREAK SPACE break; case kSpecialCharMailMerge: if (fShowEmbeds) { - RTFSetColor(kColorBlue); + TextColor oldColor = RTFSetColor(kColorBlue); BufPrintf(""); - RTFSetColor(kColorNone); + RTFSetColor(oldColor); } case kSpecialCharPrintDate: if (fShowEmbeds) { - RTFSetColor(kColorBlue); + TextColor oldColor = RTFSetColor(kColorBlue); BufPrintf(""); - RTFSetColor(kColorNone); + RTFSetColor(oldColor); } break; case kSpecialCharPrintTime: if (fShowEmbeds) { - RTFSetColor(kColorBlue); + TextColor oldColor = RTFSetColor(kColorBlue); BufPrintf("