-
Notifications
You must be signed in to change notification settings - Fork 221
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
Generic Linux distro requires Fontconfig for font support #64
Comments
@jinsihou19 |
Thank you for your feedback. If you do install fontconfig, you might encounter a new problem. please note that both fontmanager and fonts are provided by your system. In your platform information, the Ubuntu version is blank. Could you give us more information about your platform? if you're using docker, you can point us to the docker image. Is your application using GUI? if yes, you need to install some fonts. Otherwise, try to set your JRE headless mode.
|
Thank you, I will try it next time. |
Let's re-open this to see if it's practical to declare
Also, here's a minimal repro case: public class Fonts {
public static void main(String... args) {
java.awt.GraphicsEnvironment
.getLocalGraphicsEnvironment()
.getAvailableFontFamilyNames();
}
} |
if you really put fontconfig in spec file, we can only declare it in headful part? |
What about spending some time on Issue #65 to provide a headless variant that doesn't NEED fonts to be installed? |
@csbodine, interestingly, this issue is arising because the generic Linux RPM is headless, in the sense that it doesn't declare RPM dependencies on packages that are typically associated with headful activities. In this case, the NPE is fixed if the @navyxliu, your question is the heart of this issue. Another way of phrasing it is: should our headless variants support loading fonts? To get another datapoint, I installed |
We are experiencing this error when installing our product bundled with Corretto 8 on a headless Linux environment. Is this bug being investigated or is there a workaround not published here? |
@andydkelly-ig : Are you deploying to an RPM-based system? If so, running We're exploring a few long term options. One is to add |
@EricEdens thanks for this. We are working on giving this a go today/tomorrow and will report back to confirm it resolved for us. Thanks for responding. |
Got the same error on |
@EricEdens - FYI - installing fontconfig alone didn't fix the issue for me on RHEL 7. I also had to install package urw-fonts. |
@tanayjha - Thanks for the Ubuntu 18.04 datapoint. No ETA yet, but we're busy brainstorming! Given that you ship on Ubuntu, it'd be good to get your feedback on #29. (Vending the @declankilker -- Can you post repro steps? The following worked for me on a RHEL 7.6 EC2 instance using ami-036affea69a1101c9. The $ sudo rpm -i https://d2znqt9b1bc64u.cloudfront.net/java-1.8.0-amazon-corretto-devel-1.8.0_202.b08-2.x86_64.rpm
$ sudo yum install fontconfig
$ cat Fonts.java
import java.awt.GraphicsEnvironment;
public class Fonts {
public static void main(String... args) {
String[] fonts = GraphicsEnvironment
.getLocalGraphicsEnvironment()
.getAvailableFontFamilyNames();
for (String font : fonts) {
System.out.println(font);
}
}
}
$ javac Fonts.java
$ java Fonts
DejaVu Sans
DejaVu Sans Condensed
DejaVu Sans Light
Dialog
DialogInput
Monospaced
SansSerif
Serif |
@EricEdens - In our case we bundle the Corretto JDK in our Install4j installer. At installation, Install4j unpacks the JRE and attempts to run the installer. We were encountering the NPE at this point when the fontconfigs and urw-fonts packages were not present. We only encountered this issue after moving from a Sun JDK. Hope this helps. |
So, I've thought about this issue for a while. Here are the potential solutions that I've thought of. Let me know if you have additional thoughts or ideas! Potential solution 1: Update the RPM and DEB to express dependencies on I have three problems with this solution. First, we're adding footprint to the installation, and we've received feedback from resource-constrained users such as our Docker users wanting to decrease footprint. Second, the solution only addresses RPM and DEB users, but not tarball users. Third, I'm not 100% confident that all RPM and DEB systems have consistent naming for Potential solution 2: Bundle pre-built versions of I have two problems with this solution. First, it adds resource, and the aforementioned resource-constrained users have been asking us to decrease our footprint. Second, we're trying to stay cognizant and respectful to the overall Linux community, many of whom have concerns about bundling pre-built dependencies. Potential solution 3: Update our installation instructions to say that This feels like a good compromise. Resource-constrained users will be able to avoid the extra dependencies, while users who need fonts will have steps to install them on their own. We'll be able to give one-line solutions for yum and apt that will make it easy for users to install the dependencies. Lastly, @declankilker, I looked into an app that used Installer4j and it bundled the Corretto 8 runtime. When attempting to install it in an |
@EricEdens thanks for working on this. We are in the same boat as @declankilker and I think I speak for the both of us when I say that |
@tanayjha : How about updating your installer to check for |
@EricEdens sorry was discussing this on a separate ticket. But the answer to that question is that we have considered that option but the issue is that we will have to consider different cases for different linux flavours that we support which has its own set of challenges. Hence we were looking at the possibility of bundling the fonts ourselves with our installer. (basically option 2 in your post above) |
@tanayjha, bundling fonts with Amazon Corretto is one solution that we've discussed. There are challenges to this approach, as you've described in your post. Given that we have various ideas of how to solve this problem, each with their own tradeoffs, we're not ready to commit to a solution at this point. It would be helpful, though, to learn about your experiences in this area. Since it sounds like you're interested in building Corretto, I've created #117 to document how to do this. I'll put in a comment with some tips to get you started. |
we had same issue while registering fonts with AWT Graphics Environment + Corretto 8 JRE on CentOS 7.3. After installing the |
I am facing issue upgrading my application from oracle java 1.8 to corretto jdk8.202.08.2_64bit and jdk8.212.04.2_64bit. Then I figured out it was the missing font libraries. Just for the sake of investigation, I created my own fontconfig.properties in corretto jre/lib I also find the fontmanager rpm package, needed by fontconfig, is also installed in my servers: And I copied the following fonts from jdk1.8/jre/lib to corretto jre/lib: Now I see the rectangles and lines in the diagram alright, but the text is not getting displayed. |
Hi, There is no need to create a fontconfig.properties nor to copy the lucida fonts from other JDKs. Once fontconfig is installed in the system, Corretto should be able to get the fonts from it. A way to confirm fontconfig is working is to run:
If you get no answer, that probably means there are no fonts installed on the system that fontconfig can use. Dejavu fonts are the most common ones to install. Finally, I strongly recommend the usage of a newer version of Corretto, https://github.com/corretto/corretto-8/releases/tag/8.252.09.1 being our latest release, as it contains plenty of fixes, including security ones, not present in 202 or 212. |
hi @navyxliu @EricEdens , we are using corretto 8 for lambda and we are also facing this issue. We recently migrated our Lambda runtime from openjdk java 8 to corretto 8 and this causes a regression issue in our application. Our application generates an Excel file, and the Excel library that we are using (apache-poi) uses this class. There is a workaround mentioned here, but I don't think it's a very good permanent solution. I would like to know if you have already decided on an approach on how to solve this problem, especially when using Corretto in AWS Lambda. Since in AWS Lambda we cannot touch the runtime, there is nothing much that we can do. Exception trace: |
I'm experiencing similar challenges running a silent mode Install Anywhere Windchill installer on RedHat 7.9 using Corretto 8. I've applied all the work arounds I've found here and elsewhere, but can't get past the failure. The RedHat 7 bug related to this issue was closed with release of an OpenJDK fix.
I've experienced no problems with the CentOS 7.9 server that is built using the same IaC as the RedHat server. I have applied none of the work arounds to CentOS. Any other suggestions for someone way in over their head? Thanks, Mike RedHat Vitals
RedHat State of Fonts
Fails with or without this file:
CentOS Vitals
CentOS State of Fonts
|
Hi @ocind . We meet the same problem with you, and we try the workaround to add a layer for our lambda, but we get another error which is " Code uncompressed size is greater than max allowed size of 272629760". Do you have any new udpate for this problem? Or the still there is only workaround (add layer) for this problem? |
Hi all, could you please try it out, it should work now |
Using Amazon Corretto-8.322.06.2. We are facing NPE at java.lang.NullPointerException Tried with Installing FontConfig, fontconfig.properties, setting Java_Font Path but NO Luck Please Help us |
----- OS : Red Hat Enterprise Linux release 8.5 (Ootpa) |
Platform information
The text was updated successfully, but these errors were encountered: