Put in a fix for a new bug in Swing's RTF support. This bug is w.r.t. escapes

like \bullet, \emdash, etc., and this fix only works for Windows or OS/2 RTF
files, not for Mac RTF files.  So if you want a TM->TMW conversion to work,
use MS Word for Windows, not for the Mac.
This commit is contained in:
dchandler 2003-07-11 13:30:22 +00:00
parent d726bc0258
commit 85176cd9f3

View file

@ -1166,7 +1166,7 @@ public static DuffCode mapTMtoTMW(int font, int ordinal, int suggestedFont) {
return null; return null;
if (ordinal >= 255) { if (ordinal >= 255) {
DuffCode rv = getUnusualTMtoTMW(font, ordinal); DuffCode rv = getUnusualTMtoTMW(font, ordinal);
if (null != rv && !ThdlOptions.getBooleanOption("thdl.do.not.fix.rtf.hex.escapes")) if (false && /* DLC FIXME: we now have \bullet issues, etc. */ null != rv && !ThdlOptions.getBooleanOption("thdl.do.not.fix.rtf.hex.escapes"))
throw new Error("oddballs still found after fixing RTF hex escapes"); throw new Error("oddballs still found after fixing RTF hex escapes");
return rv; return rv;
} }
@ -1393,9 +1393,33 @@ private static DuffCode getUnusualTMtoTMW(int font, int code) {
case 8126: // 0=r-w case 8126: // 0=r-w
return TMtoTMW[font][149 - 32]; return TMtoTMW[font][149 - 32];
case 8211: // \endash, following number assumes this is a
// Windows or OS/2 RTF file, not a Mac RTF file:
return TMtoTMW[font][150 - 32];
case 8212: // \emdash, following number assumes this is a
// Windows or OS/2 RTF file, not a Mac RTF file:
return TMtoTMW[font][151 - 32];
case 8216: // \lquote, following number assumes this is a
// Windows or OS/2 RTF file, not a Mac RTF file:
return TMtoTMW[font][145 - 32];
case 8217: // \rquote, following number assumes this is a
// Windows or OS/2 RTF file, not a Mac RTF file:
return TMtoTMW[font][146 - 32];
case 8218: // 0=s-b-y 2=n-y case 8218: // 0=s-b-y 2=n-y
return TMtoTMW[font][130 - 32]; return TMtoTMW[font][130 - 32];
case 8220: // \ldblquote, following number assumes this is a
// Windows or OS/2 RTF file, not a Mac RTF file:
return TMtoTMW[font][147 - 32];
case 8221: // \rdblquote, following number assumes this is a
// Windows or OS/2 RTF file, not a Mac RTF file:
return TMtoTMW[font][148 - 32];
case 8222: // 0=s-k-r case 8222: // 0=s-k-r
return TMtoTMW[font][132 - 32]; return TMtoTMW[font][132 - 32];
@ -1405,6 +1429,10 @@ private static DuffCode getUnusualTMtoTMW(int font, int code) {
case 8225: // 0=s-p-r case 8225: // 0=s-p-r
return TMtoTMW[font][135 - 32]; return TMtoTMW[font][135 - 32];
case 8226: // \bullet, following number assumes this is a
// Windows or OS/2 RTF file, not a Mac RTF file:
return TMtoTMW[font][149 - 32];
case 8230: // 0=s-g-r case 8230: // 0=s-g-r
return TMtoTMW[font][133 - 32]; return TMtoTMW[font][133 - 32];