Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Unicode fonts in Java

Reply
Thread Tools

Unicode fonts in Java

 
 
maxwell@ldc.upenn.edu
Guest
Posts: n/a
 
      03-19-2007
(I confess to having posted this query last week. I got no
responses. I don't believe this is off-topic, and I'm puzzled why I
didn't get any responses. So I'm trying again, under a different
subject line. I'll shut up if I don't hear anything.)

I'm using a Java-based application (XMLmind) on MsWindows XP SP2,
which is relevant, because the support for rendering Bengali Unicode
was fixed in SP2. However, I'm unable to get the fix to be used by
this Java app.

Specifically, I want the app to use a particular font, the Vrinda.ttf
font, for Unicode Bengali (but not for other regions of Unicode).
Can't seem to make it work.

I've been advised to edit the fontconfig file, using the instructions
at http://java.sun.com/j2se/1.5.0/docs/...ontconfig.html.
The instructions seem (to me) a bit unclear; apparently Java looks for
a file with a name like 'fontconfig.properties' (there are no
fontconfig.XP.properties files, etc. on my PC). I don't have such a
file, only the compiled version, but I also have the source for that
compiled version, namely fontconfig.properties.src. If I'm
understanding the instructions correctly, you just copy that
fontconfig.properties.src file to fontconfig.properties, and edit the
latter; I guess Java then reads the fontconfig.properties file at
startup rather than the fontconfig.properties.bfc file, which
presumably means starting takes fractionally longer. If on the other
hand I need to compile my modified fontconfig.properties file, that
probably explains my lack of results--but I don't know how to compile
it.

I'm also not certain what I have to do to make Java re-load the
fontconfig.properties file. I'm assuming that if I shut down XMLmind,
and re-start it, that Java also shuts down and re-starts, and in re-
starting it reads in the modified fontconfig.properties file.
(Actually, I just checked that with the Windows Task Manager, and
indeed Java is shutting down when I close XMLmind. Whether Java is
reading in my munged fontconfig.properties file, I can't tell.)

Assuming I've guessed right thus far, I made the following changes to
the fontconfig.properties file, following the existing code for
Devanagari:

--Added a line at the top of the 'Component Font Mappings':
allfonts.bengali=Vrinda
--Modifed the UTF-8 Search Sequence line to include Bengali:
sequence.allfonts.UTF-8.hi=alphabetic/
1252,devanagari,bengali,dingbats,symbol
--Added a line at the top of the 'Font File Names':
filename.Vrinda=VRINDA.TTF
(The vrinda.ttf file is indeed in my Windows/fonts directory.)

This has no effect; XMLmind is still not using the Vrinda font to
render UTF-8 Bengali text.

A couple things occur to me. How does Java know what to do with the
string 'bengali'? Does it in fact know that this refers to the
Unicode range U+0980 to U+09FF? Does Java actually read the
fontconfig.properties file, i.e. is fontconfig.properties.src the
correct format, or do I need to compile this file? If so, how? Or is
it perhaps the case that XMLmind overrides what Java thinks it's
supposed to do for rendering Bengali text? (The XMLmind people are
the ones who told me to mung the fontconfig.properties file, so I
don't think this is the case; but how could I test it, i.e. how can I
get raw Java to render some Bengali text for me?)

Suggestions?

Mike Maxwell
CASL/ U MD

 
Reply With Quote
 
 
 
 
Thomas Fritsch
Guest
Posts: n/a
 
      03-19-2007
schrieb:
> (I confess to having posted this query last week. I got no
> responses. I don't believe this is off-topic, and I'm puzzled why I
> didn't get any responses. So I'm trying again, under a different
> subject line. I'll shut up if I don't hear anything.)
>
> I'm using a Java-based application (XMLmind) on MsWindows XP SP2,
> which is relevant, because the support for rendering Bengali Unicode
> was fixed in SP2. However, I'm unable to get the fix to be used by
> this Java app.
>
> Specifically, I want the app to use a particular font, the Vrinda.ttf
> font, for Unicode Bengali (but not for other regions of Unicode).
> Can't seem to make it work.
>
> I've been advised to edit the fontconfig file, using the instructions
> at http://java.sun.com/j2se/1.5.0/docs/...ontconfig.html.

[...]
>
> Suggestions?


I checked the bengali characters on my system (WindowsXP, with SP2) with
my "Unicode Character Table" applet at
<http://www.myjavaserver.com/~thomasfritsch/unicode.html> (selected font
"Vrinda" in the toolbar, and selected block "980:BENGALI" from the
"Block" menu).
As far as I can say (without knowing any bengali), the bengali
characters are rendered correctly.

Note that I did *not* touch any of Java's fontconfig files.
Having the "Vrinda.ttf" file in my Windows/fonts directory seems to be
just enough.

--
Thomas
 
Reply With Quote
 
 
 
 
Thomas Fritsch
Guest
Posts: n/a
 
      03-20-2007
Thomas Fritsch wrote:
> I checked the bengali characters on my system (WindowsXP, with SP2) with
> my "Unicode Character Table" applet at
> <http://www.myjavaserver.com/~thomasfritsch/unicode.html> (selected font
> "Vrinda" in the toolbar, and selected block "980:BENGALI" from the
> "Block" menu).
> As far as I can say (without knowing any bengali), the bengali
> characters are rendered correctly.
>
> Note that I did *not* touch any of Java's fontconfig files.
> Having the "Vrinda.ttf" file in my Windows/fonts directory seems to be
> just enough.
>

I'm afraid I have completely misunderstood your goal.

Now I think you want your application to correctly display the Bengali
characters (0980-09FF) when any Java's logical font (like "Dialog",
"Serif", "SansSerif") is selected.
When writing my previous answer I thought you wanted to display Bengali
characters when the selected font is "Vrinda" (which is almost trivial).

So I created a file "fontconfig.properties" (as a copy of
"fontconfig.properties.src") and did the 3 modifications you described:
> --Added a line at the top of the 'Component Font Mappings':
> allfonts.bengali=Vrinda
> --Modifed the UTF-8 Search Sequence line to include Bengali:
> sequence.allfonts.UTF-8.hi=alphabetic/1252,devanagari,bengali,dingbats,symbol
> --Added a line at the top of the 'Font File Names':
> filename.Vrinda=VRINDA.TTF

When checking it with
<http://www.myjavaserver.com/~thomasfritsch/unicode.html> (selecting
font "Dialog", and going to block "980:BENGALI"), the Bengali characters
were all rendered as a sqare box.
So far the same disappointing result like you got.

I made one further change to "fontconfig.properties":
--Modifed the Default Search Sequence line to include Bengali:
sequence.allfonts=alphabetic/default,bengali,dingbats,symbol
When again checking it with
<http://www.myjavaserver.com/~thomasfritsch/unicode.html> (selecting
font "Dialog", and going to block "980:BENGALI"), the Bengali
characters are rendered correctly!!!

--
Thomas







 
Reply With Quote
 
maxwell@ldc.upenn.edu
Guest
Posts: n/a
 
      03-20-2007
On Mar 20, 10:47 am, Thomas Fritsch <i.dont.like.s...@invalid.com>
wrote:
> I'm afraid I have completely misunderstood your goal.
>
> Now I think you want your application to correctly display the Bengali
> characters (0980-09FF) when any Java's logical font (like "Dialog",
> "Serif", "SansSerif") is selected.


Correct, although I guess I didn't explain it very well.

> So I created a file "fontconfig.properties" (as a copy of
> "fontconfig.properties.src") and did the 3 modifications you described
> ...
> I made one further change to "fontconfig.properties":
> --Modifed the Default Search Sequence line to include Bengali:
> sequence.allfonts=alphabetic/default,bengali,dingbats,symbol
> When again checking it with
> <http://www.myjavaserver.com/~thomasfritsch/unicode.html> (selecting
> font "Dialog", and going to block "980:BENGALI"), the Bengali
> characters are rendered correctly!!!


Thanks! I verified that this works using another applet that someone
gave me, and it works there too. Unfortunately, XMLmind still shows
blocks instead of Bengali characters (as does jEdit, another Java
app). But at least now I can go back to the XMLmind folks and tell
them what I found.

Mike Maxwell
CASL / U MD

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unicode labels, fonts for components? Peter Duniho Java 26 01-24-2008 11:55 AM
Fonts suddenly unreadable in IE 6.0 - All other system fonts appear normal Emily Computer Support 3 06-09-2005 04:52 AM
Swithing Unicode fonts Nik Firefox 3 04-30-2005 11:05 AM
asp fonts problems (chinese fonts become ??????) sam ASP General 0 06-06-2004 06:15 AM
Re: Unicode fonts in Windows Mike Computer Support 2 07-22-2003 05:49 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57