From bed5d4f4fbb2a654aee0ab6a1c3297c35219a1b6 Mon Sep 17 00:00:00 2001 From: agc Date: Thu, 31 May 2001 11:04:56 +0000 Subject: Apply patches from PR 12971 from Ben Collver (collver@linuxfreemail.com) "1) rtf-tools has its own way of switching between symbols and normal characters when converting to groff. This patch fixes rtf-tools to honor the assumption that the \plain command resets to the normal font. This unscrambles the formatting of some RTF->groff documents. http://msdn.microsoft.com/library/specs/rtfspec_16.htm#rtfspec_fontcharformat only mentions resetting font format properties, not the font itself. It also says that the default properties are application-specific. 2) rtf-tools specifies the column separation for every column. Since it is meaningless for the last column of a table, the tbl command outputs messages to stderr. This patch removes column separation from the last column of the table to keep groff quiet." --- textproc/rtf-tools/patches/patch-ae | 83 ++++++++++++++++++++++++++++++++++--- textproc/rtf-tools/patches/patch-af | 15 +++++++ 2 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 textproc/rtf-tools/patches/patch-af (limited to 'textproc/rtf-tools/patches') diff --git a/textproc/rtf-tools/patches/patch-ae b/textproc/rtf-tools/patches/patch-ae index a4929b43c8e..ff72ab083a6 100644 --- a/textproc/rtf-tools/patches/patch-ae +++ b/textproc/rtf-tools/patches/patch-ae @@ -1,8 +1,81 @@ -$NetBSD: patch-ae,v 1.1.1.1 2001/04/27 12:18:33 agc Exp $ +$NetBSD: patch-ae,v 1.2 2001/05/31 11:04:56 agc Exp $ ---- lib/reader.c.orig Sun Apr 8 14:53:30 2001 -+++ lib/reader.c Sun Apr 8 14:54:58 2001 -@@ -1194,6 +1194,7 @@ +--- lib/reader.c.orig Tue Apr 5 12:14:55 1994 ++++ lib/reader.c Wed May 16 22:10:17 2001 +@@ -587,38 +587,45 @@ + if (autoCharSetFlags == 0) + return; + +- if ((autoCharSetFlags & rtfReadCharSet) +- && RTFCheckCM (rtfControl, rtfCharSet)) ++ if (autoCharSetFlags & rtfReadCharSet) + { +- ReadCharSetMaps (); +- } +- else if ((autoCharSetFlags & rtfSwitchCharSet) +- && RTFCheckCMM (rtfControl, rtfCharAttr, rtfFontNum)) +- { +- if ((fp = RTFGetFont (rtfParam)) != (RTFFont *) NULL) ++ if (RTFCheckCM (rtfControl, rtfCharSet)) + { +- if (strncmp (fp->rtfFName, "Symbol", 6) == 0) +- curCharSet = rtfCSSymbol; +- else +- curCharSet = rtfCSGeneral; +- RTFSetCharSet (curCharSet); ++ ReadCharSetMaps (); + } +- } +- else if ((autoCharSetFlags & rtfSwitchCharSet) && rtfClass == rtfGroup) +- { +- switch (rtfMajor) ++ else if (RTFCheckCMM (rtfControl, rtfCharAttr, rtfFontNum)) + { +- case rtfBeginGroup: +- if (csTop >= maxCSStack) +- RTFPanic ("_RTFGetToken: stack overflow"); +- csStack[csTop++] = curCharSet; +- break; +- case rtfEndGroup: +- if (csTop <= 0) +- RTFPanic ("_RTFGetToken: stack underflow"); +- curCharSet = csStack[--csTop]; ++ if ((fp = RTFGetFont (rtfParam)) != (RTFFont *) NULL) ++ { ++ if (strncmp (fp->rtfFName, "Symbol", 6) == 0) ++ curCharSet = rtfCSSymbol; ++ else ++ curCharSet = rtfCSGeneral; ++ RTFSetCharSet (curCharSet); ++ } ++ } ++ /* so \plain will revert to normal character set -Ben */ ++ else if (RTFCheckCMM (rtfControl, rtfCharAttr, rtfPlain)) ++ { ++ curCharSet = rtfCSGeneral; + RTFSetCharSet (curCharSet); +- break; ++ } ++ else if (rtfClass == rtfGroup) ++ { ++ switch (rtfMajor) ++ { ++ case rtfBeginGroup: ++ if (csTop >= maxCSStack) ++ RTFPanic ("_RTFGetToken: stack overflow"); ++ csStack[csTop++] = curCharSet; ++ break; ++ case rtfEndGroup: ++ if (csTop <= 0) ++ RTFPanic ("_RTFGetToken: stack underflow"); ++ curCharSet = csStack[--csTop]; ++ RTFSetCharSet (curCharSet); ++ break; ++ } + } + } + } +@@ -1194,6 +1201,7 @@ char buf[rtfBufSiz], *bp; int old = -1; char *fn = "ReadFontTbl"; @@ -10,7 +83,7 @@ $NetBSD: patch-ae,v 1.1.1.1 2001/04/27 12:18:33 agc Exp $ for (;;) { -@@ -1311,11 +1312,30 @@ +@@ -1311,11 +1319,30 @@ RTFPanic ("%s: missing \"}\"", fn); } } diff --git a/textproc/rtf-tools/patches/patch-af b/textproc/rtf-tools/patches/patch-af new file mode 100644 index 00000000000..a011ff19cb3 --- /dev/null +++ b/textproc/rtf-tools/patches/patch-af @@ -0,0 +1,15 @@ +$NetBSD: patch-af,v 1.1 2001/05/31 11:06:01 agc Exp $ + +--- rtf2troff/trf-table.c.orig Wed May 16 18:24:58 2001 ++++ rtf2troff/trf-table.c Wed May 16 18:26:07 2001 +@@ -120,7 +120,9 @@ + if (i > 0) + cwid -= its->cellPos[i-1]; + cwid -= EnWidth (); +- fprintf (f, "l1w(%gi) ", cwid); ++ fprintf (f, "l%sw(%gi) ", ++ (i + 1 == its->nCells) ? "" : "1", ++ cwid); + } + if ((p = VCellBorderStr (VCellBorderType (its->nCells))) + != (char *) NULL) -- cgit v1.2.3