Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

How to display special (unicode) characters

Thread view: 
Jürgen Gerstacker - 15 May 2007 09:58 GMT
Hello,
I work on a program to display European (Unicode) characters.

Graphics2D g2 = (Graphics2D) g;
g2.setFont(new Font("monospaced",0,16));
g2.drawString();

'Normal' Greek characters work fine, like

b303 b503 c903 c103 b303 (Unicode, low byte first)
gamma epsilon omega rho gamma

Special Greek characters, like
411f (Unicode, low byte first),
'GREEK LETTER OMICRON WITH DASIA' (U+1F41)

are NOT displayed with this monospaced font.

How can those characters be displayed?

Thank you for your answers!!

Juergen
Hendrik Maryns - 15 May 2007 10:27 GMT
Jürgen Gerstacker schreef:
> Hello,
> I work on a program to display European (Unicode) characters.
[quoted text clipped - 15 lines]
>
> How can those characters be displayed?

By choosing an appropriate font, i.e. one that contains glyphs for those
symbols.  That is not a Java matter, but rather, you have to have such a
font installed and then have to look into how to make Java use that font
(I have no idea, to be honest).

HTH, H.
- --
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Jürgen Gerstacker - 15 May 2007 10:54 GMT
> By choosing an appropriate font, i.e. one that contains glyphs for those
> symbols.  That is not a Java matter, but rather, you have to have such a

Yes, I know

This page

http://www.idevelopment.info/data/Programming/character_encodings/PROGRAMMING_ch
aracter_encodings.shtml


states, that
"The following character encodings are supported by JDK 1.1.7a and JDK
1.2"
And
\u1F00      \u1FFF      Greek Extended
is part of this list.
As I have installed JDK 6 on my system, I should be able to render
Greek Extended character.
But how??
Juergen
Lew - 15 May 2007 14:05 GMT
>> By choosing an appropriate font, i.e. one that contains glyphs for those
>> symbols.  That is not a Java matter, but rather, you have to have such a
[quoted text clipped - 14 lines]
> Greek Extended character.
> But how??

By doing what Hendrik suggested.

Signature

Lew

Joshua Cranmer - 15 May 2007 22:02 GMT
>> By choosing an appropriate font, i.e. one that contains glyphs for those
>> symbols.  That is not a Java matter, but rather, you have to have such a
[quoted text clipped - 15 lines]
> But how??
> Juergen

Your question has been answered twice correctly, and the fact that you
still do not understand what is wrong means that you do not understand
what's going on.

When Java (or any application) is displaying text, it basically goes to
the font definition and looks up the pixels to draw each character. It
is the responsibility of the user to have appropriate fonts to be able
to draw said character, not the application in question.

For example, many GUI implementations have the ability to parse
character 10, LF. But if you were to look at any font, you would not see
a glyph defined for the LF character. In this case, the application is
setting new lines when it sees LF characters -- it supports the newline
character but most fonts cannot display them because of this special
processing. Similarly, most characters from 0-31 are not defined in font
definitions.

The fact that JDK 1.1.7a, etc., can support the character encoding means
that it is capable of recognizing the characters and properly handling
them; it does not mean that it is guaranteed to have fonts installed to
use them. I can just as well parse Tamil font, but since I don't have a
Tamil font installed, I can't actually display it.

In short, get a monospaced font that has definitions for Greek Extended
characters and look up the font system for JDK 6.

NOTE: I understand that my explanation is oversimplified.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.