Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Displaying Hebrew text in a console application

1,090 views
Skip to first unread message

Mottel

unread,
Jan 27, 2009, 6:56:31 PM1/27/09
to
I am writing a console application in which I would like SOME of the output
text to be in Hebrew. This should be possible by setting the codepage for
console output to 862, and using Lucida Console as the font for the console
window. But it is not working. I have read that although Lucida Console is a
Unicode font and contains the Hebrew character set, that character set is not
usable because the table for codepage 862 is missing from the font file. A
full discussion of the problem with examples, a link to the source of the
information just quoted, and links to related information is at:
http://www.programming.gutnick.net
Any help or enlightening feedback would be appreciated.

Mihai N.

unread,
Jan 29, 2009, 2:19:36 AM1/29/09
to
> I have read that although Lucida Console is a
> Unicode font and contains the Hebrew character set

Lucida Console does not contain Hebrew characters.


> Lucida Console is a Unicode font

...


> table for codepage 862 is missing from the font file.

This does not matter. If the font's cmap contains
a Unicode table there is not need to have tables
for any code page.
(disclaimer: yes, I know there can be more than one
type of "Unicode tables", just keeping things simple).

--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

Mihai N.

unread,
Jan 29, 2009, 2:29:50 AM1/29/09
to

> Lucida Console does not contain Hebrew characters.

More precise: what kind of Lucide Console are you using?

Some of the screen-shots on the web site you indicated
contain info on Lucide Console 0.91
Where is that version comming from?
My Vista machine has a version 5.00.

The fact that Hebrew characters show in some GUI applications using
Lucida Console does not necesarily means they are there.
Windows does a lot of "magic" to do that (font mapping/substitution/
fallback/linking) at all kind of levels (to tell what exactly happens
one must know more about the API used, flags, system configuration, etc.)

But thing is: if you see a glyph on screen it does not mean it's in the font.

Try this: http://www.mihai-nita.net/article.php?artID=charmapex
If the glyhps show in black, they are in the font.
If not, then it is "Windows magic" at work.
(on my machine the Hebrew glyphs are red)

Other possibly important questions:
- do you set the *system locale* to Hebrew, or not?
- is your application Unicode?
- what API you use?

Mottel

unread,
Feb 1, 2009, 10:24:01 PM2/1/09
to

"Mihai N." wrote:
> Some of the screen-shots on the web site you indicated
> contain info on Lucide Console 0.91
> Where is that version comming from?
> My Vista machine has a version 5.00.

That info is just from links on Microsoft's site.
I only have have Lucida Console version 1.62 (that came with Windows XP) and
version 5.00 (that came with Vista). I have tried both under Win XP (SP3),
with the same results.

> But thing is: if you see a glyph on screen it does not mean it's in the font.

...
> Try this: http://www.mihai-nita.net/article.php?artID=charmapex

Thanks for that information and for the link to CharMapEx

> Other possibly important questions:
> - do you set the *system locale* to Hebrew, or not?

No I don't, but when I tried that, it made no difference to the output of my
little test utility. I may be wrong about this but in my (limited)
understanding of this, this is because my .FON (raster) console fonts does
not contain the Hebrew character set in the upper-ASCII area.

> - is your application Unicode?

I'm not sure. (I don't know enough about this.) How can I tell? The source
code and the exe are both in the TestCP.zip file linked to the article in
http://www.programming.gutnick.net. It is coded in PowerBasic console
compiler for Windows, which creates 32-bit Windows console (text-mode) apps.
(http://www.powerbasic.com/products/pbcc/)

> - what API you use?

Get and SetConsoleOutputCP (that's all.)


Mihai N.

unread,
Feb 2, 2009, 2:29:25 AM2/2/09
to
> No I don't, but when I tried that, it made no difference to the output of
> my
> little test utility. I may be wrong about this but in my (limited)
> understanding of this, this is because my .FON (raster) console fonts does
> not contain the Hebrew character set in the upper-ASCII area.

When you set the font to Lucida, it is not raster font anymore.


> I'm not sure. (I don't know enough about this.) How can I tell? The source
> code and the exe are both in the TestCP.zip file linked to the article in
> http://www.programming.gutnick.net. It is coded in PowerBasic console
> compiler for Windows, which creates 32-bit Windows console (text-mode)
> apps.
> (http://www.powerbasic.com/products/pbcc/)

It does not look like a Unicode app
(using dumpbin (from Win SDK) all the functions imported are ANSI,
stuff like WriteConsoleOutputA, ScrollConsoleScreenBufferA, etc.
Unicode functions end in W (WriteConsoleOutputA, etc.)


Thing is, international support in console is not great.
The only supported way to output in a certain code page
is to set the system locale to that language and reboot.
(http://www.mihai-nita.net/article.php?artID=20050611a)

Other tricks might work, but all of them are hacks,
nothing official, so you are pretty much on your own.

In general setting the console code page seems to work,
but then you have fonts problems (as you notices).

You might also try to use the Everson Mono font
(http://www.evertype.com/emono/)
Has everything that's needed to be used for console
and has Hebrew characters "for real"
Be careful, the font is shareware, not free.

Mottel

unread,
Feb 5, 2009, 2:24:02 AM2/5/09
to
> When you set the font to Lucida, it is not raster font anymore.
Yes I know, I was just making the point that from what I've read, changing
the system locale only changes what happens when you are using raster fonts.
(But I could be wrong about that.)

> It does not look like a Unicode app
> (using dumpbin (from Win SDK) all the functions imported are ANSI,
> stuff like WriteConsoleOutputA, ScrollConsoleScreenBufferA, etc.
> Unicode functions end in W (WriteConsoleOutputA, etc.)

Ah... thank you for that analysis. It explains why it didn't work when I
set the console output code page to UTF-8 and tried sending a UTF-8 string to
the screen (didn't work). If it's not Unicode aware, it probably can't do
that.

> You might also try to use the Everson Mono font
> (http://www.evertype.com/emono/)
> Has everything that's needed to be used for console
> and has Hebrew characters "for real"
> Be careful, the font is shareware, not free.


I'm having trouble making it available as a console font. I'm following the
advice given here:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q247815

I have added it to the registry and it shows up in the system menu for
console windows together with Lucida Console, but when I select it, the
selection does not not "take" and the console always reverts back to using
Lucida Console instead of Everson Mono. I am using XP (SP3) and here is the
exported .reg file for the key I have modified:

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\Nls]
"00000409"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Console\TrueTypeFont]
"0"="Lucida Console"
"00"="Everson Mono"
"000"="Consolas"
"0000"="Courier New"

(None of the three fonts added can actually be used in a console window.)

Any suggestions anyone?

Mihai N.

unread,
Feb 5, 2009, 2:58:42 AM2/5/09
to
> I have added it to the registry and it shows up in the system menu for
> console windows together with Lucida Console, but when I select it, the
> selection does not not "take" and the console always reverts back to using
> Lucida Console instead of Everson Mono. I am using XP (SP3) and here is the
> exported .reg file for the key I have modified:

I think I have seen this before.
Go from Lucida Console to raster font (apply and all), then to Everson Mono.
Not sure what is going on, but seems to work this way.

Mottel

unread,
Feb 5, 2009, 5:08:32 AM2/5/09
to
> Go from Lucida Console to raster font (apply and all), then to Everson Mono.
> Not sure what is going on, but seems to work this way.

Doesn't work, I'm afraid. Just can't get the setting to "stick". If, while
the window is open, I bring up its system menu to check what font it is using
(even though I can see from the text that it looks like Lucida Console), I
get a pop-up error message dialog. Window title is "Font" Message is: "i"
"Point size should be between 5 and 72" (Pont size selected in the shortcut
was 24; it was highlighted when I pressed OK.) Have to press OK on the dialog
three times to dismiss it. (First two times it just keeps coming back.) Weird
goings on here. I'll keep trying and looking for info on this. If I come up
with anything will post here.

I even tried this with a newly created desktop shortcut to cmd.exe using the
hard-coded pathname to it (as opposed to env-var %SystemRoot%). It made no
difference.


Mihai N.

unread,
Feb 6, 2009, 2:06:25 AM2/6/09
to
> Doesn't work, I'm afraid. Just can't get the setting to "stick".
...

> I'll keep trying and looking for info on this. If I come up
> with anything will post here.

Sorry, but it does not ring any bell, I have no other ideas.
But if you figure something out, let us know.

Thanks.

0 new messages