As Dom asked, I'm forwarding a patch to wv to import CJK in word6 format.
Best regards,
-Vlad
---------- Forwarded message ----------
Date: Sun, 19 Nov 2000 11:42:22 +0800
From: ha shao <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: Commit: wv iconv fix
On Sat, Nov 18, 2000 at 12:59:58PM -0500, [EMAIL PROTECTED] wrote:
> >On Sat, Nov 18, 2000 at 02:54:10PM +0400, [EMAIL PROTECTED] wrote:
> > >
> > > Yes, I agree with the hack you propose.
> > > You should feel free to implement it and post a patch :)
> > >
> Feel free to do this. I'll definitely commit the work.
>
Okey, here is the patch against wv.h and text.c. It only
know 2 Chinese nLocale. People use other languages should
add the other correct ones.
It works for the word6.doc.
--
Best regard
ha_shao
Index: wv.h
===================================================================
RCS file: /cvsroot/wv/wv.h,v
retrieving revision 1.70
diff -u -r1.70 wv.h
--- wv.h 2000/11/14 20:46:26 1.70
+++ wv.h 2000/11/19 03:34:58
@@ -3194,6 +3194,7 @@
typedef size_t (*wvConvertToUnicode)(const char **, size_t *, char **, size_t *);
char *wvLIDToCodePageConverter(U16 lid);
+U16 wvnLocaleToLIDConverter(U8 nLocale);
typedef struct _MSOFBH
{
Index: text.c
===================================================================
RCS file: /cvsroot/wv/text.c,v
retrieving revision 1.58
diff -u -r1.58 text.c
--- text.c 2000/11/18 07:19:49 1.58
+++ text.c 2000/11/19 03:34:58
@@ -21,11 +21,27 @@
int wvOutputTextChar(U16 eachchar,U8 chartype,wvParseStruct *ps, CHP *achp)
{
- U16 lid;
+ U16 lid = 0;
+ version v;
+
+ v = wvQuerySupported(&ps->fib, NULL);
+
/* testing adding a language */
- lid = achp->lidDefault;
+
+ /* For version <= WORD7, The charset used could
+ * depend on the font's charset.
+ */
+ if((v <= WORD7) && (!ps->fib.fFarEast))
+ {
+ FFN currentfont;
+ currentfont = ps->fonts.ffn[achp->ftc];
+ /* Return 0 if no match */
+ lid = wvnLocaleToLIDConverter(currentfont.chs);
+ }
+ if(!lid)
+ lid = achp->lidDefault;
+
/* No lidDefault for ver < WORD6 */
- /* Should try achp->lid first? */
if (lid == 0x400 || lid == 0)
lid = ps->fib.lid;
@@ -46,7 +62,6 @@
/* Most Chars go through this baby */
if (charhandler)
{
- version v = wvQuerySupported(&ps->fib, NULL);
if(!((v == WORD7 || v == WORD6) && ps->fib.fFarEast))
if (v <= WORD7)
{
@@ -191,6 +206,22 @@
};
return("CP1252");
}
+
+U16 wvnLocaleToLIDConverter(U8 nLocale)
+{
+ switch(nLocale)
+ {
+ case 134: /* Chinese Simplified */
+ return (0x804);
+ case 136: /* Chinese Traditional */
+ return (0x404);
+
+ /* Add Japanese, Korean and whatever nLocale you see fit. */
+ default:
+ return (0x0);
+ }
+ return (0x0);
+}
static
U32 swap_iconv(U16 lid)