Re: i18n megapatch to AW


Subject: Re: i18n megapatch to AW
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Fri Oct 06 2000 - 00:53:07 CDT


On Thu, 5 Oct 2000, Vlad Harchev wrote:

> On Thu, 5 Oct 2000, Martin Sevior wrote:
>
> >
> > Just some quick questions. Where do I get Russion Fonts? Do I just place
> > them in a subdirectory of the Unixfonts directory?
>
> You can get the fonts here:
> ftp://ftp.ice.ru/pub/freeware/abiword/AbiWord-fonts-KOI8.tar.bz2
>
> Just unpack them into "fonts" directory - this will create several
> subdirectories in it. Everything should work out of the box.
>
> These fonts are in KOI8-R encoding. In order to test them, you'll have to set
> $LANG to ru_RU.KOI8-R.

Thanks. I still hven't tried this yet. If someone else succeeds please let
us know.

<snip>
>
> > Until I have Russian fonts I can't do much more testing excpet to try out
> > other foreign language spelling files.
> >
> > One problem I immediately see is that bullet list items show up as "?"
> > characters. I don't have any more time today to track this down.
>
> The code that does this is in
> GR_Graphics::remapGlyph()
> It should be fixed this way (tested):
> - const UT_UCSChar actual = m_pApp->getEncodingManager()->UToNative(actual_);
> + UT_UCSChar actual = m_pApp->getEncodingManager()->try_UToNative(actual_);
> + if (!actual)
> + actual = actual_;
> This is pseudo-diff for already patched /src/af/gr/xp/gr_Graphics.cpp
>

This fixes the proble nicely. Thanks!

> Another fix (that fixes competely another problem) is required too - to
> xap_UnixFontManager.cpp:XAP_UnixFontManager::_addFont
> (so that registry and encoding of xlfd won't be used for decision which
> font should replace which).
> Here is a real diff for already patched file:
>
> --- xap_UnixFontManager.cpp-old Thu Oct 5 14:38:14 2000
> +++ xap_UnixFontManager.cpp Thu Oct 5 14:41:45 2000
> @@ -457,7 +457,6 @@
> void XAP_UnixFontManager::_addFont(XAP_UnixFont * newfont)
> {
> // we index fonts by a combined "name" and "style"
> - const char* native_encoding = XAP_EncodingManager::instance->getNativeEncodingName();
> const char* fontkey = newfont->getFontKey();
> UT_HashEntry* curfont_entry = m_fontHash.findEntry(fontkey);
> if (!curfont_entry || !curfont_entry->pData)
> @@ -465,43 +464,14 @@
> m_fontHash.addEntry(fontkey, NULL, (void *) newfont);
> } else {
> /*
> - we already have the same font but with different encoding.
> - Try to figure out which one suits our locale better.
> + since "standard fonts" folder is read first and then
> + current charset-specific subdirectory, it's obvious that
> + the recent version is current charset-specific font,
> + so we replace original font (that is standard)
> + unconditionally.
> */
> - XAP_UnixFont* curfont = static_cast<XAP_UnixFont*>(curfont_entry->pData);
> - char curcharset[200];
> - char newcharset[200];
> - for(int i=0;i<2;++i)
> - {
> - char* outbuf = i ? newcharset : curcharset;
> - XAP_UnixFont* afont = i ? newfont : curfont;
> - XAP_UnixFontXLFD lfd(afont->getXLFD());
> - if (*lfd.getEncoding()!='*')
> - sprintf(outbuf,"%s-%s",lfd.getRegistry(),lfd.getEncoding());
> - else
> - strcpy(outbuf,lfd.getRegistry());
> - }
> - UT_Bool leave_cur = 1;
> - if (!UT_stricmp(curcharset,native_encoding))
> - leave_cur = 1;
> - else if (!UT_stricmp(newcharset,native_encoding))
> - leave_cur = 0;
> - else if (!UT_stricmp(curcharset,"adobe-fontspecific"))
> - leave_cur = 1;
> - else if (!UT_stricmp(newcharset,"adobe-fontspecific"))
> - leave_cur = 0;
> - else
> - {
> - /* advanced logic could be put here like pattern matching */
> - leave_cur = 1;
> - }
> - UT_DEBUGMSG(("Favouring font '%s' in %s over %s\n",newfont->getName(),
> - leave_cur ? curcharset : newcharset, !leave_cur ? curcharset : newcharset) );
> - if (leave_cur)
> - delete newfont;
> - else {
> - delete curfont;
> - curfont_entry->pData = (void*)newfont;
> - };
> + XAP_UnixFont* curfont = static_cast<XAP_UnixFont*>(curfont_entry->pData);
> + delete curfont;
> + curfont_entry->pData = (void*)newfont;
> }
> }
> I've put an updated version of the patch on my site, but these are the only
> 2 differences between the old one.
>

I applied this to your patch and Abi compiles and builds as before. I have
put a tarball of Vlads updated patch together on my anonymous ftp site.
It's located at:

ftp://seviorpc.ph.unimelb.edu.au/pub/abi-ru.tar.gz

Since patch appears to be barfing on Vlads' code, could a Windows
developer copy this and try it out? Please let us know about compiler
errors and your estimate of the difficulty of fixing things.

Thanks

Martin

<snip>



This archive was generated by hypermail 2b25 : Fri Oct 06 2000 - 00:53:23 CDT