|
Hello my friends
It's time to let some knowledge wander the opposite direction:
How do I get Arabic fonts displayed correctly in a Java GUI (Swing and in this case also JFace/SWT) ?
regards
Torsten
I never finish anyth...
|
|
|
|
|
0. Ensure the font supports Aarbic, bit basic I know.
1. Make sure the resource strings are properly encoded. Try saving them externally to the application.
2. Look here[^]
3. Google is your friend, try "use Arabic fonts in Swing".
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
Have a bit more patience with newbies. Of course some of them act dumb -- they're often *students*, for heaven's sake. -- (Terry Pratchett, alt.fan.pratchett)
|
|
|
|
|
thanks Nagy. I'm already taking care of these things.
This seems to be a fairly common problem.
To get a bit more precise on what I'm doing right now:
- Eclipse RCP application
- Eclipse owned buttons / labels and JFace/SWT Components have to be displayed Arabic or English by preference.
It all depends pretty much on the charset I'm using. I changed the RCP based NLS to my own "MultiLanguageSupport":
public final class MultiLanguageSupport{
private final static String strPROPERTIES = "/resource/language/";
private static HashMap<String, String> oMap;
static{
loadMap();
}
private static void loadMap(){
oMap = new HashMap<String, String>();
try {
String strLanguage = "language.txt";
String strPref = AccountManager.getGeneralStore().getString(
GeneralPreferenceConstants.LANGUAGE
);
if(false == strPref.isEmpty()){
strLanguage = strPref;
}
ClassLoader oClassLoader = MultiLanguageSupport.class.getClassLoader();
URL oURL = oClassLoader.getResource(strPROPERTIES + strLanguage);
InputStream oInputStream = oClassLoader.getResourceAsStream( strPROPERTIES + strLanguage );
StringWriter writer = new StringWriter();
IOUtils.copy(oInputStream, writer, "UTF8");
String strValues = writer.toString();
StringTokenizer oLineTokenizer = new StringTokenizer(strValues, "\n");
while(oLineTokenizer.hasMoreElements()){
String strLine = oLineTokenizer.nextToken();
if (strLine.length()>0 &&
strLine.charAt(0) != '#' &&
strLine.charAt(0) != '{' &&
strLine.charAt(0) != '\\' ){
StringTokenizer oTokenizer = new StringTokenizer(strLine, "=");
if(2 == oTokenizer.countTokens()){
oMap.put(oTokenizer.nextToken().trim(), oTokenizer.nextToken().trim());
}
}
}
}
catch (FileNotFoundException e) { e.printStackTrace(); }
catch (IOException e) { e.printStackTrace(); }
}
public static final String getString(final String strKey){
return oMap.get(strKey);
}
}
Now I can load these Strings from a *.txt file. This is needed as *.properties are not able to hold Arabic characters (to my knowledge).
Now I'm struggling on the charset to be used. Word tells me, that ISO-8859-6 ("Window Arabic") is not capable to save the Arabic characters I was able to produce with word ( " ٰ١٢٣ٵڅکګڪ " - I hope my random selection of characters is nothing offensive )
So how can I achieve my goal to display Arabic text in my RCP-application? I also thought about loading another font, but also that one would need "some arabic command" to display the chars right (at least on my European Latin character based machine...)
regards
Torsten
I never finish anyth...
|
|
|
|
|
TorstenH. wrote: Now I can load these Strings from a *.txt file. This is needed as *.properties
are not able to hold Arabic characters (to my knowledge).
Pretty sure that you can create a unicode file for properties.
Then you run a tool on it which converts it to txt. It it called something like utf2ascii (something with 2 and ascii in it.) It is part of the jdk.
|
|
|
|
|
are you thinking of this one?[^]
i also did a little research:
Java internationalization[^]
supported Font @ Oracle.com[^]
and a lot of unanswered questions in the forums around the world.
I think I'll leave it as a first attempt this way and ask the interpreter, what he thinks would be the best way to do this. I hope he has some more info about this for me.
regards
Torsten
I never finish anyth...
|
|
|
|
|
There are a number of Arabic speaking CPians around - maybe try the question in the Lounge.
The best things in life are not things.
|
|
|
|
|
|
Ask any Arabic speaker's in the lounge to come here and read the thread. Also blame Richard.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
Have a bit more patience with newbies. Of course some of them act dumb -- they're often *students*, for heaven's sake. -- (Terry Pratchett, alt.fan.pratchett)
|
|
|
|
|
Do you still work in Woking?
The best things in life are not things.
|
|
|
|
|
For another three weeks.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
Have a bit more patience with newbies. Of course some of them act dumb -- they're often *students*, for heaven's sake. -- (Terry Pratchett, alt.fan.pratchett)
|
|
|
|
|
I assumed (and still believe) that with your knowledge and experience of CodeProject you would be able to formulate the question in a way that made it appear not as a programming question.
The best things in life are not things.
|
|
|
|
|
|
Additional problem: Eclipse RCP Bundle Localization is not able to read from UTF-8 encoded *.txt files Sometimes it's just fun...
regards
Torsten
I never finish anyth...
|
|
|
|
|
|
TorstenH. wrote: Now I'm dealing with the IDialogConstants , where the "OK" and
"Cancel" is read. Any ideas how to customize that
Don't. Instead of trying to reference the captions use control the names in your decision logic, see setName(String) and getName() , now the LOGIC and DISPLAY are nice and seperate.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
Have a bit more patience with newbies. Of course some of them act dumb -- they're often *students*, for heaven's sake. -- (Terry Pratchett, alt.fan.pratchett)
|
|
|
|
|
HI,
My Cron Expression is this 0 00 15 5 MAY ? 2011
Whats is START_TIME
Whats is END_TIME
Whats is NEXT_FIRE_TIME
Whats is PREV_FIRE_TIME
Please any one help me.
|
|
|
|
|
would this [^]help?
I looks like a single event to me.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
This is not a Java question; try posting in the correct forum.
The best things in life are not things.
|
|
|
|
|
hi how are you
<b>(sorry for my bad English)</b>
i want to built an IM program
i found that the Jabber Protocol is very useful
i want to learn about it
so please would you help me by how to write a simple program that sends a request from client to server using Jabber
thank you very much
|
|
|
|
|
The easiest thing would be to search for Jabber Tutorial using your search engine of choice. Try that and if you get stuck ask some more specific questions.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
Have a bit more patience with newbies. Of course some of them act dumb -- they're often *students*, for heaven's sake. -- (Terry Pratchett, alt.fan.pratchett)
|
|
|
|
|
Hi ,
Table 6.1. Quartz Requires the Following Tables for All JDBC-persistent JobStores, I know the all table names, but how to create the table structure i don't. if known any one please send me the table structures. it is urgent for me.
|
|
|
|
|
I don't know if this is the same quartz, but a bit of googling and i found;
"You can find table-creation SQL scripts in the "docs/dbTables" directory of the Quartz distribution."
on this page; http://www.quartz-scheduler.org/docs/tutorial/TutorialLesson09.html[^]
If it is not the same quartz, then you need to be more specific with the product you are using!
|
|
|
|
|
Hi DaveAuld,
Thank you for giving your ans. i got the table structures.
|
|
|
|
|
Your welcome, if my answer was helpful please vote / accept answer
|
|
|
|
|
I want to store connection information to Database (username, password, port ) into a file named "WebConfig".
Then I create a java class named "Connect" use these information to connect to MS SQL Server.
But I cann't read information from "WebConfig" because I don't know it's directory.
Can you help me ? (Don't use HttpSerletContext ! )
Thanks alot !
|
|
|
|