RFR: 8233177: JTextField's size is computed incorrectly when it contains Indic or Thai characters

Phil Race prr at openjdk.org
Fri Jan 26 23:11:35 UTC 2024


On Wed, 24 Jan 2024 02:35:17 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Existing regression test is failing because textfield height is not as per test's expectation..Seems like the indic character being tried to render is not being loaded (probably because of missing glyphs) leading to 0 preferredSpan from [BoxView](https://github.com/openjdk/jdk/blame/5a74c2a67ebcb47e51732f03c4be694bdf920469/src/java.desktop/share/classes/javax/swing/text/BoxView.java#L545-L552) which is superclass for `i18nFieldVIew`, the field view for Indic characters.
>> Tried block character in the test which is now being loaded properly leading to correct height..
>
> test/jdk/javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java line 58:
> 
>> 56: 
>> 57:                 textField1 = new JTextField("\u2588");
>> 58:                 textField2 = new JTextField("\u2588");
> 
> You do not need to test the same character twice

This isn't right. The test MUST use the Indic and Thai characters else the test is pointless.
The problem of them being unavailable in the font should be solved by using Font.canDisplay(char)
to find a font that DOES support them.
If no font supports them, then it becomes a question of policy .. do you want the test to silently pass
or should the test fail because the system running this test really should have those fonts.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17528#discussion_r1468227213


More information about the client-libs-dev mailing list