[OpenJDK 2D-Dev] Setting the FreeType LCD filter

Laurent Bourgès bourges.laurent at gmail.com
Thu Oct 11 12:31:45 UTC 2018


Hi John & Phil,

I propose the following patch against jdk/client (openjdk12):
diff -r ac510fd737eb
src/java.desktop/share/native/libfontmanager/freetypeScaler.c
--- a/src/java.desktop/share/native/libfontmanager/freetypeScaler.c     Thu
Oct 11 14:19:36 2018 +0530
+++ b/src/java.desktop/share/native/libfontmanager/freetypeScaler.c     Thu
Oct 11 13:47:04 2018 +0200
@@ -38,6 +38,7 @@
 #include FT_SIZES_H
 #include FT_OUTLINE_H
 #include FT_SYNTHESIS_H
+#include FT_LCD_FILTER_H

 #include "fontscaler.h"

@@ -316,6 +317,8 @@
         free(scalerInfo);
         return 0;
     }
+    /* enable LCD filter */
+    FT_Library_SetLcdFilter(scalerInfo->library, FT_LCD_FILTER_DEFAULT);

     return ptr_to_jlong(scalerInfo);
 }

I tested it against OpenJDK11 and it fixed the problem of color fringes on
my ubuntu 18.4 (see screenshot):
http://cr.openjdk.java.net/~lbourges/png/freetype_lcd_filter_jdk11_vs_jdk12.png
<http://www.google.com/url?q=http%3A%2F%2Fcr.openjdk.java.net%2F~lbourges%2Fpng%2Ffreetype_lcd_filter_jdk11_vs_jdk12.png&sa=D&sntz=1&usg=AFQjCNE0CAjfIZwQddrqcTNkQcg0sg4bOw>

Hope it helps,
Laurent

Le jeu. 11 oct. 2018 à 08:02, Laurent Bourgès <bourges.laurent at gmail.com> a
écrit :

> Hi john,
>
> I can sponsor you, preparing an official webrev in openjdk 12, as phil
> asked for.
>
> Laurent
>
> Le lun. 8 oct. 2018 à 22:24, John Neffenger <john at status6.com> a écrit :
>
>> Now that we fixed a font problem in JavaFX [1], let's fix the same
>> problem in Java. I would like your feedback on the Request for
>> Enhancement described below:
>>
>> OpenJDK FreeType Font Fix
>> https://github.com/jgneff/openjdk-freetype
>>
>> Thank you,
>> John
>>
>> [1] https://github.com/javafxports/openjdk-jfx/issues/229
>>
>

-- 
-- 
Laurent Bourgès
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20181011/a4a31ce3/attachment.html>


More information about the 2d-dev mailing list