AW: 0 values for Font.getStringBounds()

Peter Felix felix at imagic.ch
Wed Aug 12 06:22:25 UTC 2020


Hi David,

thanks a lot for your answer. What have to be done that JDK-8233097 will be backported into 8?

Thanks,
Peter

Peter Felix
Software-Entwickler

Telefon:
+41 44 809 40 60
E-Mail: felix at imagic.ch  

Imagic Bildverarbeitung AG 
Europa-Strasse 27
CH-8152 Glattbrugg

www.imagic.ch
  


-----Ursprüngliche Nachricht-----
Von: David Alvarez <alvdavi at amazon.com> 
Gesendet: Mittwoch, 12. August 2020 00:13
An: Peter Felix <felix at imagic.ch>; jdk8u-dev at openjdk.java.net
Betreff: Re: 0 values for Font.getStringBounds()

Hi,

We have seen this can cause characters to overlap on swing when using large fonts too. It seems JDK-8225286, which was backported into 8, introduced the issue.

It seems to me we might need to backport JDK-8233097 [1] in order to fix this.

--
David

[1] https://bugs.openjdk.java.net/browse/JDK-8233097

On 2020-08-10 02:15, Peter Felix wrote:
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.
> 
> 
> 
> I’d like to report a bug based on Font.getStringBounds().
> 
> With the following lines it is reproducible:
> 
> String test = "abcdefghijklmnopqrstuvwxyz "; Font f = new 
> Font("Arial", 0, 1560); int[] widths = new int[test.length()]; for 
> (int i = 0; i < widths.length; i++) {
>     FontRenderContext context = new FontRenderContext(new AffineTransform(1, 0, 0, 1, 0, 0), true, true);
>     double w = f.getStringBounds(test, i, i + 1, context).getWidth();
>      widths[i] = (int) w;
> }
> 
> for (int i = 0; i < widths.length; i++) {
>     System.out.print(widths[i] + " "); }
> 
> 
> Output ok (with Amazon Corretto 8.202):
> 867 867 780 867 867 433 867 867 346 346 780 346 1299 867 867 867 867 
> 519 780 433 867 780 1126 780 780 780 433 If I set the font size to 
> 3000 instead of 1560 then the output is
> 1668 1668 1500 1668 1668 833 1668 1668 666 666 1500 666 2499 1668 1668 
> 1668 1668 999 1500 833 1668 1500 2166 1500 1500 1500 833 If I set the 
> font size to 100 instead of 1560 then the output is
> 55 55 50 55 55 27 55 55 22 22 50 22 83 55 55 55 55 33 50 27 55 50 72 
> 50 50 50 27
> 
> 
> Output nok (with Amazon Corretto 8.232, 8.252, 8.265 and with AdoptOpenJDK 8.265):
> 867 0 780 0 867 0 0 0 0 0 0 0 0 867 867 0 0 519 780 0 867 780 0 780 0 
> 780 433 If I set the font size to 3000 instead of 1560 then the output 
> is
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 833 If I set the 
> font size to 100 instead of 1560 then the output is (with this size 
> the values are ok)
> 55 55 50 55 55 27 55 55 22 22 50 22 83 55 55 55 55 33 50 27 55 50 72 
> 50 50 50 27
> 
> Thanks,
> 
> Peter Felix
> 
> Software-Entwickler
> 
> 
> 
> Telefon:
> 
> +41 44 809 40 60
> 
> E-Mail: felix at imagic.ch<mailto:felix at imagic.ch>
> 
> 
> 
> Imagic Bildverarbeitung AG
> 
> Europa-Strasse 27
> 
> CH-8152 Glattbrugg
> 
> 
> 
> www.imagic.ch<http://www.imagic.ch>
> 
> [LinkedIn]<https://www.linkedin.com/company/imagic-ch/>  
> [xing_share_button3] 
> <https://www.xing.com/companies/imagicbildverarbeitungag/updates>
> 
> 
> 


More information about the jdk8u-dev mailing list