Printing Arabic Text

Post Reply
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Printing Arabic Text

Post by Davide »

Hello all,

I have a text file containing some Arabic strings in Ansi format (saved with Notepad)

When "Regional And Language Options (RLO)" are set for english, I see them as, for example:

Code: Select all

#define TXT_LANG     "ÚÑÈí"
but when RLO are set for Arabic I see the right glyps in Notepad.
So far, so good.

My problem is that when RLO=Arabic I can correctly put and see that text in Messageboxes, Windows, menus etc., BUT in print jobs:

Code: Select all

oPrn:Say(row,col,TXT_LANG)
It seems that the text in oPrn:say() does not follow the RLO rules (I always see it as in English: "ÚÑÈí")

Should I manually apply some kind of conversion ?
(The source file is already Ansi, but I've tried all the combinations I know: OEMtoAnsi() - AnsiToWide() and viceversa)

Thanks
Davide
FWH27 - xH 0.99.60 - Bcc
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: Printing Arabic Text

Post by hua »

Sorry for this necro post, but I'd like to share and record the knowledge of what have I found out while researching this issue just recently.

1. Most MS-Windows nowadays can be enabled to write Arabic characters. You could follow the instructions here or just simply google it.

In XP, this means playing around with Regional and Languages settings.

Image

2. For printing, define a font that supports the arabic character set. Specifying the character set wanted is a must. e.g. instead of just

Code: Select all

oFnt := TFont():New( "Courier New", 0, -11,,,,, 700,,,,, 3, 2, 1, oPrn )
it must be specified as,

Code: Select all

#define ARABIC_CHARSET 178

oFnt := TFont():New( "Courier New", 0, -11,,,,, 700,,,, ARABIC_CHARSET, 3, 2, 1, oPrn )

Detailed description on CreateFont() can be found at MSDN.

p.s. Antonio, would it be possible for DEFINE FONT to be enhanced so we could pass the character set too? TIA
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Printing Arabic Text

Post by nageswaragunupudi »

p.s. Antonio, would it be possible for DEFINE FONT to be enhanced so we could pass the character set too? TIA
Will be available from 11.07
Regards

G. N. Rao.
Hyderabad, India
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: Printing Arabic Text

Post by hua »

Thanks Rao.
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Printing Arabic Text

Post by Davide »

Dear Rao,
hua wrote:#define ARABIC_CHARSET 178

oFnt := TFont():New( "Courier New", 0, -11,,,,, 700,,,, ARABIC_CHARSET, 3, 2, 1, oPrn )
thank you. Would this work even for 2-bytes languages, such as chinese for example ?

Tnx,
Davide
Post Reply