New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There was no fonts in Linux version #70
Comments
HI @JamesMung - I haven't used jasper before - do you have a quick set of instructions to reproduce the error? Also which Linux distribution are you using (it's unclear if this is a JDK issue or something that's supposed to be on the underlying OS). |
Hi @sxa555, I tried to use Oracle JDK of Linux version and it's no problem to print PDF. So I compare between Windows and Linux version. I found Windows version has fonts and config in And I tried to copy the font and config from Oracle JDK to Adopt JDK. but it's not work. Can you kindly give the solution to solve it ? And please fix it in further versions. Distribution : |
Moved this to a new issue as it seems different from the original issue adoptium/temurin-build#693 |
Hi @xinyi9, Thanks for your solution. BTW, @sxa555 I tried use these code in my program : try {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
File fontsDir = new File(System.getProperty("user.home") + "/fonts"); // fonts dir (*.ttf)
if(fontsDir.isDirectory()){
for(File file : fontsDir.listFiles()){
ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, file));
if(logger.isInfoEnabled()) {
logger.info("Load font " + file.getName());
}
}
}
} catch (Exception e) {
e.printStackTrace();
} And it appear Distribution : |
The fonts in jre/lib/fonts directory are taken from closed code in Oracle JDK and missing from openJDK. We need to understand why it is failing only on Linux and not on Windows. Which fonts were trying to create when the failure occurred. @mbvreddy FYI |
This might be similar to the porting issue we have for cacerts. I think the correct thing to do is to propose a patch for upstream 8u to add these. |
Initially commented on issue 693, but also relevant here: The NullPointerException in FontConfiguration.java:1264 is caused by a missing font configuration file, which is not included with the Linux version of AdoptOpenJDK. It is important to notice that the direct cause of the exception is a missing configuration file and not that actual font files are missing. When the AWT font subsystem is initialized, it will look for a font configuration file in $JAVA_HOME/lib following a naming scheme and priority as described here: https://docs.oracle.com/javase/8/docs/technotes/guides/intl/fontconfig.html Even if no fonts are provided by the JDK and use of OS provided fonts is not intented or configured, a minimal configuration is required by the AWT font subsystem to initialize without throwing exceptions. Providing a fontconfig.properties file in $JAVA_HOME/lib with the following two lines will at least, to start with, mitigate the problem with the NullPointerException:
Since we are only using fonts bundled with our application, this is a feasible workaround in our situation. It allows the font subsystem to initialize and we can later without issues load our own fonts from the classpath. I am not sure what happens and YMMV if you try to run an application, which relies on the JDK to provide actual fonts, either as bundled with the JDK or as provided by the operating system. |
- because adoptjdk currently leads to problems when generating excel files with apache POI (or when generating PDFs, also see https://github.com/AdoptOpenJDK/openjdk-build/issues/682)
- because adoptjdk currently leads to problems when generating excel files with apache POI (or when generating PDFs, also see https://github.com/AdoptOpenJDK/openjdk-build/issues/682)
I also encountered this issue with jdk8u181-b13 on centos 7. I was not able to resolve the issue using this adoptopenjdk. I agree, it would be nice if future releases of adoptopenjdk has font support. Another option, outside java seems to be getting the fonts loaded directly to the linux OS (as the os is the fallback if fonts are not available in java). We didn't test this yet. |
Installing packages fontconfig and urw-fonts on CentOS 6 & 7 fixed the issue. |
Just to add to the list of people who have experienced this, I hit this issue when using Apache POI (which uses fonts in the background to size Excel columns etc) on a headless server. In essence jarnbjo is right - the cause of the exception shown in the issue is the lack of the In my case this alone wasn't sufficient to remove the issue. For any task that needs an actual font to be present you need two things:
No. 1 can be provided by the Java Ideally (for my purposes) the JDK distribution would include the Java The upstream OpenJDK (as provided by the Centos repositories) solves this problem by introducing actual package dependencies on the extra packages needed, but that's probably not practical for Adopt OJDK. Edit: Minimal code to reproduce:
The above will fail at the |
I was struggling with this until I downloaded Adopt JDK8 with the OpenJ9 JVM. The Hotspot version does not work and that solved my problems. I wasn't getting many errors at all so finally started from scratch and noticed this. |
Does anyone know the progress of this issue? I see in the migration guide that "Relicensed Lucidia Fonts" are "coming soon". It also states Q2 2019. How is the progress on that? Is it planned to be part of the next Java 8 Update? Is there still potential to slip out of Q2 or is it basically already finished? |
@maxpg we have the May 2019 milestone label which means it's in the bucket of things that we want to look at next (May is false in terms of timing though). It's an unassigned issue so unless a volunteer picks it up beforehand we won't tackle it until some other priorities get sorted first. |
@karianna The issue is a major one if you want to ship your (on-premise) application with AdoptOpenJDK as the application may not work correctly on some Linux distributions. Considering this, I hope that you can give the issue a higher priority and a reliable milestone (waiting half a year because your page states "expected to complete in 2Q 2019" just to see that the issue is still unassigned is somewhat disappointing). |
We do our best to prioritize issues that impact the most folks, but this is a community/volunteer project. If you'd like this particular issue looked at more quickly then we're always looking for more help and/or there are support options listed at adoptopenjdk.net/support.html |
We're having issues here as well (on AdoptOpenJDK10):
It happens for us on vanilla Fedora 30 (just boot the live CD). Whenever AWT or Swing is used, things go bad... I have no idea what the problem is, libfontconfig.so.1 is present, so I guess it must be something else... I did test this with the reference build as well (https://jdk.java.net/java-se-ri/10), and this works. So it must be something with AdoptOpenJDK builds... but what? |
I upgraded to AdoptOpenJDK 11, and this fixed the issue for Fedora 30. I can confirm that fonts work out of the box where they did not with JDK10. We were unable to upgrad to 11 previously due to jersey not supporting it, but now it works :)
|
OK so it sounds like this is still an issue for AdoptOpenJDK 8 but not 11 (potentially) |
Adding this info in hopes it might help someone or provide some clues, although the exact scenario is a little different than above: Context: Short Story: Long Story: I deleted the contents of the 'fonts' folder and copied a single TTF font (webdings.ttf, which is not even used by the PDF) and things worked in both Corretto and AdoptOpenJDK. I then also added back all of the Oracle fonts (LucidaBrightDemiBold, LucidaBrightDemiItalic, LucidaBrightItalic, LucidaBrightRegular, LucidaSansDemiBold, LucidaTypewriterBold, LucidaTypewriterRegular, LucidaSansRegular) and things failed again. (All of these fonts were installed on the OS). I then deleted each Oracle font one by one until I discovered that deleting LucidaSansRegular alone was enough to make things work. Summary: |
Having this issue on Debian 10 while trying to run Jenkins 2.204.1 WAR with 11.0.5+10 JDK (I have not tested with the JRE) Using JDK release : https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.5%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.5_10.tar.gz The @jarnbjo solution worked for me. I use linux binaries and install them in
|
@lumpfish is this related to what you were working on recently? |
Some of it, yes. I was looking for any progress on the The AdoptOpenJDK migration guide (https://adoptopenjdk.net/MigratingtoAdoptOpenJDKfromOracleJava.pdf) statement "The Lucida fonts that are available in Oracle JDK 8 have a proprietary 3rd party license. AdoptOpenJDK intends to provide relicensed Lucida fonts. Work is ongoing to minimize any display issues when these fonts are rendered by Freetype and are expected to complete in 2Q2019." |
We are also having the same issue and wondering where we are in providing the re-licensed Lucida fonts. Its mentioned in the AdoptOpenJDK migration guide that these will be available by Q2 2019. Or if there is a known workaround that we can use for now. Thanks! |
@karianna - is there a plan for resolving this? There are a number of AdoptOpenJDK users requesting these fonts and currently the AdoptOpenJDK position is that they are to be included in the AdoptOpenJDK builds. I had interpreted the statement "The Lucida fonts that are available in Oracle JDK 8 have a proprietary 3rd party license. AdoptOpenJDK intends to provide relicensed Lucida fonts." to mean that the AdoptOpenJDK community would be seeking a license. Is that correct? If so when / how would that happen? |
Would including DejaVu suffice? Should be easier to package because it is free. |
That's a potential path forward. I'm not sure if there's a an OSS replacement that has the same L&F |
We see-sawed back and forth and we're back to providing a fontconfig.properties file to remove the NPE and maybe try to add a free font to remove one other class of problems. |
@karianna To save you some time, https://dejavu-fonts.github.io/ is the home of the DejaVu fonts, https://dejavu-fonts.github.io/License.html is their license. The tarball of Azul Zulu contains some fontconfig.properties templates with appropriate mappings. |
AdoptOpenJDK/openjdk-support Getting NULL pointer exception at sun.awt.FcFontManager.getDefaultPlatformFont(FcFontManager.java:76)#80 To just to update, We had raised this issue on Solaris platform (both x86 and sparc). Hope the fix will work for Solaris installers and binaries too. |
Also see adoptium/temurin-build#693 |
Hi, Any update on this, Can we expect something by this month end or early October? |
@madhu-broad Self-service instructions: #70 (comment) |
I did some further research:
Without Freetype, you get an error like:
Install the packages as recommended in #70 (comment) and the problem is gone and you get proper integration with the operating system. To sump up: I think we would get ourselves into trouble by providing font configuration or even fonts. Providing fonts and font configuration is not a problem to be tackeld on the level of the JDK but on the level of the operating system. |
TSC decided not to bundle any fonts and to relegate the font handling to the operating system for the reasons documented in #70 (comment). We're going to publish a blog post that explains how to install the fonts (AdoptOpenJDK/blog#498). We have instructions for Linux in #70 (comment). We need instructions for Solaris/AIX. We're also going to update the migration guide (AdoptOpenJDK/openjdk-website#799). Later on, we can decide whether we remove Freetype from the binary builds (adoptium/temurin-build#2133). Probably best to do this together with the move to Eclipse. |
From @JamesMung on October 23, 2018 3:54
JDK Version ; jdk8u181-b13
When I use jasper print PDF in Windows is fine, but for Linux found the error as follow:
Can you help for solve this problem in current version ? And please fix it in future version.
Copied from original issue: AdoptOpenJDK/openjdk8-releases#16
The text was updated successfully, but these errors were encountered: