在Swing中使用乌尔都语字体输入文本时不显示英文字符 [英] English characters don't show up when entering text with Urdu fonts in Swing
问题描述
这类似于我自己以前的问题,但是这个解决方案在这里不起作用。
正如上一个问题所提到的,我正在开发一个跨平台(Windows / Ubuntu)的应用程序,该应用程序必须将英语音译为几种印度语官方语言之一。该应用程序有一个自定义的输入法,输入英文和按空格键将输入的文本转换成特定的本地语言。乌尔都语不同于其他人,如阿拉伯语/希伯来语。
我设法找到开放许可的乌尔都语字体有英文和乌尔都语字形,但是当我用英文输入字符时,什么也没有显示出来。
我不明白这是字体绘画的问题,还是与输入法有关。到目前为止,如果我禁用这种语言的自定义输入法( InputMethod.dispatchEvent()
),我可以看到英文文本(但当然没有音译发生)。
我的发现: b 我无法理解 解决方法 如果我让文本字段的方向与常规的从左到右的语言方向一样,我可以看到英文文本。但是,这对乌尔都语的用户是不可接受的。 有人能指点我吗? 我将语言环境设置为 , This is similar to my own previous question, but that solution didn't work here.
As mentioned in the previous question, I'm working on a cross platform(Windows/Ubuntu) application that has to transliterate English into one of several official Indian languages. The application has a custom input method, and typing in English and pressing space will transliterate the typed text into the specific local language. Urdu is different from the others in being right to left, like Arabic/Hebrew.
I managed to find an open licensed Urdu font that has both English and Urdu glyphs, but when I type characters in English, nothing shows up. I don't understand whether it's a font painting issue, or related to the input method. So far, if I disable the custom input method ( My findings: I'm unable to understand what happens after the Workaround If I let the text field's orientation be as it is for regular left to right languages, I can see the English text. However, this would not be acceptable to an Urdu speaking user. Can someone point me in the right direction? I set the locale to Sadly, 这篇关于在Swing中使用乌尔都语字体输入文本时不显示英文字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
$ b
ComponentOrientation
来对齐文本字段中的文本,当语言环境是乌尔都语时, setHorizontalAlignment
。同样的结果。
sun.awt.windows.WInputMethod
)。在这里我看到 dispatchEvent()
调用操作系统的本地调用来处理IME。我不能这样做。
dispatchEvent()
基本上是一样的。
JTextField
的代码 - 无法在 AbstractDocument
和子类中找到任何东西。 AbstractDocument.insertUpdate()
方法检查并更新双向文本输入,但是没有其他任何重要的东西。
dispatchEvent()
调用后发生了什么。字符正在注册,即音译引擎能够检测到键入的字符并处理它们,但它们只是不显示在屏幕上。
ur_IN
。
ur_IN
不在支持的语言环境;我只看到 en_IN
和 hi_IN
。在引用的示例中,我使用下面的代码来获取如下图:
pre $ spinner.setLocale(new locale(hi,IN));
InputMethod.dispatchEvent()
) for this language, I am able to see the English text (but of course no transliteration takes place).
ComponentOrientation
to align text in the text field, I used setHorizontalAlignment
for when the locale is Urdu. Same result.sun.awt.windows.WInputMethod
). Here I see the dispatchEvent()
makes a native call to the OS for handling IME. I can't do that here.dispatchEvent()
is essentially the same.JTextField
in Eclipse - wasn't able to find anything in the AbstractDocument
and subclasses. The AbstractDocument.insertUpdate()
method checks for and updates bidirectional text input, but there wasn't anything else significant.dispatchEvent()
call. The characters are being registered, i.e. the transliteration engine is able to detect the typed characters and process them, but they just don't show up on screen.
ur_IN
.ur_IN
is not among the supported locales; I only see en_IN
and hi_IN
. In the example cited, I used the following code to get the image below:spinner.setLocale(new Locale("hi", "IN"));