Closed liuwenru closed 6 years ago
Try using frolvlad/alpine-oraclejre8
/ frolvlad/alpine-oraclejdk8
images instead of building your own image. Where did you get glibc 1.2?
sorry, my error , i use the repository glibc and the version is glibc-2.23-r3.apk
, i want to know why it can not work? thinks
I have no idea, but you should try the latest glibc, which is already 2.27-r0. Give a try to the Docker images I referred above.
@frol i use the frolvlad/alpine-oraclejdk8
images to test code the same with worn
thks, i also test the 2.27-r0 version , it also do not work !
I have just read your comment between the two pictures and realized that there is no issue with the glibc, you are just missing the font. Alpine just doesn't ship too many fonts by default. You may try installing various ttf* packages from apk and see if that helps. Otherwise, just bundle your favorite font into the image.
@frol yes , i test the way that i drop the font file (ttf) to ${JRE_HOME}/lib/fonts/fallback
, it can works but i want use my own ttf
in my program, now i want know why it can not work , can give some debug methods ? thinks , my english is poor.
I want use my own ttf in my program
So you do, you use your own font from what I see, and it is working fine, isn't it? I don't understand what is your problem then.
the problem is :
in the env(centos+oracle jdk1.8)
, i run the code it can draw the picture use my own fonts,the reset is follow picture:
when i do not use the docker images(build with alpine3.4+ sgerrand/alpine-pkg-glibc + Oracle JDK1.8 )
, the same code , but it can not draw the picture
PS:
i use the sgerrand/alpine-pkg-glibc
with 2.27-r0
and use this images https://github.com/oracle/docker-images
, all of them is error!
This just means that CentOS has the necessary font by default and Alpine does not. You should create an image with the necessary font. You may want to start with copying all the fonts from the CentOS image to Alpine image and then, once you know which font you need, you may try to find a package in Alpine repository and install it in your Dockerfile.
but the font file is my own design, alpine repository do not have , so i will use Font.createFont("my own font file")
method to create it, but now it do not work
Thank you for filing this issue and apologies for the late reply. Unfortunately this issue as stated is related solely with your Java code and runtime environment, not this package.
Hi, when i use the images to write a string in picture,the method can run and no errors , but can not write string to picture , the code like this
the resoult is like
but when i add the font file in
${JRE_HOME}/lib/fonts/fallback/
, then useFont font =new Font("宋体",1,24);
it worksi want this
when i do not in docker all of the method is work ~
ENV:
alpine docker version 3.7
glibc 1.2
JDK: oracle jdk1.8_65
please give some suggest to solve this problem ~
thinks ~