adoptium / adoptium/adoptium-support

Backport of JDK-8273358 missing from Java 1.8.0_345

Open
#595 4 comments 1 reaction 0 assignees View on GitHub
bug jbs:needs-backport-to-8 keep
Dominant language
No language data
Stars
59
Forks
13
PR merge metrics
No merged PRs in 30d

Description

### Please provide a brief summary of the bug

The fix for the macOS 12 issue with missing "Times" font ([JDK-8273358](https://bugs.openjdk.org/browse/JDK-8273358)) supposedly was backported in 8u321 ([JDK-8273722](https://bugs.openjdk.org/browse/JDK-8273722)) but when I downloaded OpenJDK8U-jdk_x64_mac_hotspot_8u345b01.pkg today, I still get the warning about missing "Times".

I used the LogicalFontsTest.java from the ([JDK-8273358 fix](https://github.com/openjdk/jdk/commit/efe3ed1e705a6f3785761e64f7187de809daa731)) to test this.

### Please provide steps to reproduce where possible

```
% /usr/libexec/java_home -v 1.8 -exec javac LogicalFontsTest.java
% /usr/libexec/java_home -v 1.8 -exec java -d64 LogicalFontsTest -cp .
name=SansSerif
Warning: the fonts "Times" and "Lucida Bright" are not available for the Java logical font "Serif", which may have unexpected appearance or behavior. Re-enable the "Times" font to remove this warning.
font = java.awt.Font[family=SansSerif,name=SansSerif,style=plain,size=12]
name=Serif
font = java.awt.Font[family=Dialog,name=Serif,style=plain,size=12]
Exception in thread "main" java.lang.RuntimeException: Requested Serif but got java.awt.Font[family=Dialog,name=Serif,style=plain,size=12]
at LogicalFontsTest.test(LogicalFontsTest.java:48)
at LogicalFontsTest.main(LogicalFontsTest.java:37)
% /usr/libexec/java_home -v 1.8 -exec java -d64 -version
openjdk version "1.8.0_345"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_345-b01)
OpenJDK 64-Bit Server VM (Temurin)(build 25.345-b01, mixed mode)
% sw_vers
ProductName: macOS
ProductVersion: 12.6
BuildVersion: 21G115
% uname -a
Darwin MacBook-Pro 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64 x86_64
% cat LogicalFontsTest.java
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/*
* @test
* @bug 8273358
* @summary Verify logical fonts are as expected.
* @run main/othervm LogicalFontsTest
*/

import java.awt.Font;

public class LogicalFontsTest {

public static void main(String[] args) {
test(Font.SANS_SERIF);
test(Font.SERIF);
test(Font.MONOSPACED);
test(Font.DIALOG);
test(Font.DIALOG_INPUT);
}

static void test(String fontName) {
System.out.println("name="+fontName);
Font font = new Font(fontName, Font.PLAIN, 12);
System.out.println("font = " + font);
if (!fontName.equalsIgnoreCase(font.getFamily())) {
throw new RuntimeException("Requested " + fontName + " but got " + font);
}
}
}
%
```

### Expected Results

```
name=SansSerif
font = java.awt.Font[family=SansSerif,name=SansSerif,style=plain,size=12]
name=Serif
font = java.awt.Font[family=Serif,name=Serif,style=plain,size=12]
name=Monospaced
font = java.awt.Font[family=Monospaced,name=Monospaced,style=plain,size=12]
name=Dialog
font = java.awt.Font[family=Dialog,name=Dialog,style=plain,size=12]
name=DialogInput
font = java.awt.Font[family=DialogInput,name=DialogInput,style=plain,size=12]
```

### Actual Results

```
name=SansSerif
Warning: the fonts "Times" and "Lucida Bright" are not available for the Java logical font "Serif", which may have unexpected appearance or behavior. Re-enable the "Times" font to remove this warning.
font = java.awt.Font[family=SansSerif,name=SansSerif,style=plain,size=12]
name=Serif
font = java.awt.Font[family=Dialog,name=Serif,style=plain,size=12]
Exception in thread "main" java.lang.RuntimeException: Requested Serif but got java.awt.Font[family=Dialog,name=Serif,style=plain,size=12]
at LogicalFontsTest.test(LogicalFontsTest.java:48)
at LogicalFontsTest.main(LogicalFontsTest.java:37)

```

### What Java Version are you using?

% /usr/libexec/java_home -v 1.8 -exec java -d64 -version openjdk version "1.8.0_345" OpenJDK Runtime Environment (Temurin)(build 1.8.0_345-b01) OpenJDK 64-Bit Server VM (Temurin)(build 25.345-b01, mixed mode)

### What is your operating system and platform?

% sw_vers
ProductName: macOS
ProductVersion: 12.6
BuildVersion: 21G115
% uname -a
Darwin MacBook-Pro 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64 x86_64

### How did you install Java?

OpenJDK8U-jdk_x64_mac_hotspot_8u345b01.pkg from [Adoptium archive](https://adoptium.net/temurin/archive?version=8)

### Did it work before?

```shell
I have not tried earlier versions of Java 1.8.
```

### Did you test with other Java versions?

```shell
It works running the same .class file with Java 17 (also installed today):

% /usr/libexec/java_home -v 17 -exec java LogicalFontsTest -cp .
name=SansSerif
font = java.awt.Font[family=SansSerif,name=SansSerif,style=plain,size=12]
name=Serif
font = java.awt.Font[family=Serif,name=Serif,style=plain,size=12]
name=Monospaced
font = java.awt.Font[family=Monospaced,name=Monospaced,style=plain,size=12]
name=Dialog
font = java.awt.Font[family=Dialog,name=Dialog,style=plain,size=12]
name=DialogInput
font = java.awt.Font[family=DialogInput,name=DialogInput,style=plain,size=12]
% /usr/libexec/java_home -v 17 -exec java --version
openjdk 17.0.4.1 2022-08-12
OpenJDK Runtime Environment Temurin-17.0.4.1+1 (build 17.0.4.1+1)
OpenJDK 64-Bit Server VM Temurin-17.0.4.1+1 (build 17.0.4.1+1, mixed mode, sharing)
%
```

### Relevant log output

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied LogicalFontsTest.java on the affected OpenJDK 8 build and compare the result with Java 17. Read the linked JDK-8273358 fix and JDK-8273722 backport to determine what is missing from the 8u345 build. Done means the Java 8 test produces the expected logical font families without the missing-font warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, macos
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.