Arabic Typesetting font slowers my JTextArea, JTex

2019-02-20 12:54发布

I am using JTextArea to show heavy text in Urdu, Arabic and English language in Java. The problem is that my GUI freezes for 12-15sec when I use Arabic Typesetting font for JTextArea. I am getting text from XML and then showing in textarea, also using linewrap. My window also freezes for about 5sec when I re-size my window. Although on the console I am told that time taken for setting the text : 7.005 but when message shown it did not immediately show text in JTextArea but after about 5sec. The case is same for JTextArea, JTextPane and JTextEditor.

Interestingly the above problems did not occur when I use other fonts. Also text appeared immediately after when time taken for setting text message appeared on the console. I tested this for many time but the case is same.

I am doing in a way

//note time for start parsing
String text=getTextFromXML();
//show parsed time
System.out.print("Setting text.");
textarea.setText(text);
System.out.println("Setting text done.");
//show time taken to set text

Here are some sample outputs for different fonts, time is in seconds:

**Arabic typesetting**//Arabic font
Parsing Time: 0.171 Setting text. Setting text done.
Time taken for setting text: 7.005 //much time taken relevant to others
Text size: 57124   //string length text.length();

**Adobe Arabic**//Arabic font
Parsing Time: 0.172 Setting text. Setting text done.
Time taken for setting text: 0.499
Text size: 57124

**Andalus**//Arabic font
Parsing Time: 0.109 Setting text. Setting text done.
Time taken for setting text: 1.388
Text size: 57124

**Thoma**
Parsing Time: 0.172 Setting text. Setting text done.
Time taken for setting text: 0.655
Text size: 57124

**Times New Roman** 
Parsing Time: 0.125 Setting text. Setting text done.
Time taken for setting text: 0.515
Text size: 57124

I am not going on the factor Parsing Time but the factor Time taken for setting text does matter for me. Now I want to know

what is the technical problem with Arabic typesetting font, is it not compatible or heavy?

  1. As settext takes much time than others.
  2. Also text did not appeared immediately after the message appeared.
  3. Also GUI freezes for some time when resizing window. And how to resolve that?

0条回答
登录 后发表回答