[OpenJDK 2D-Dev] Printing to Postscript doesn't support dieresis

Mario Torre neugens at redhat.com
Fri Dec 12 18:00:28 UTC 2014

On Wed, 2014-12-10 at 15:36 -0800, Phil Race wrote:
> > the character is encoded as <c3a4> (which is correct ihmo)
> > but then mapped to ISOLatin1Encoding.
> \u00e4 (Umlaut) encoded as 8859 should just be "e4".
> What you have above is UTF-8, whereas the PS printing path is
> definitely expecting 8859-1. I looked and found that when I reviewed this change
> I commented it probably should be 8859-1 but didn't make a sufficient point of it :-(
> I thought that since we returned latin1 for the charset name we'd get the right encoding
> but apparently not, and I imagine what testing was done either didn't cover this range
> or the bug was overlooked.
> The following is the quick fix I think we need since I think printing and ONLY printing
> ever uses this code when we are using fontconfig :-
> diff --git a/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java b/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java
> --- a/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java
> +++ b/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java
> @@ -180,7 +180,7 @@
>           String[] componentFaceNames = cfi[idx].getComponentFaceNames();
>           FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
>           for (int i = 0; i < componentFaceNames.length; i++) {
> -            ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.UTF_8.newEncoder(), new int[0]);
> +            ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.ISO_8859_1.newEncoder(), new int[0]);
>           }
>           return ret;

Hi Phil,

Thanks for the reply!

I thought it was something along the lines, but I wasn't confident
enough for the fix.

I applied your fix and (of course!) I can confirm it worked, and created
a bug report:


I also went ahead and tweaked the test case so that there's no need to
print anymore:


This webrev contains the updated test case based on the PrintSE test and
your fix. I will be happy to push the fix myself if you prefer.


More information about the 2d-dev mailing list