FreeBSD Bugzilla – Attachment 189163 Details for
Bug 215636
java/openjdk8: Add fontconfig support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch file
openjdk8-8.152.16_2.patch (text/plain), 17.67 KB, created by
Dmitri Goutnik
on 2017-12-28 14:22:00 UTC
(
hide
)
Description:
patch file
Filename:
MIME Type:
Creator:
Dmitri Goutnik
Created:
2017-12-28 14:22:00 UTC
Size:
17.67 KB
patch
obsolete
>Index: java/openjdk8/Makefile >=================================================================== >--- java/openjdk8/Makefile (revision 457460) >+++ java/openjdk8/Makefile (working copy) >@@ -233,7 +233,7 @@ > CONFIGURE_SCRIPT= ../../configure > CONFIGURE_WRKSRC= ${WRKSRC}/common/autoconf > >-OPTIONS_DEFINE= ALSA POLICY TZUPDATE X11 >+OPTIONS_DEFINE= ALSA POLICY TZUPDATE X11 FONTCONFIG > OPTIONS_DEFINE_armv6= FPUHACK > OPTIONS_DEFINE_armv7= FPUHACK > OPTIONS_DEFAULT= ALSA POLICY TZUPDATE X11 >@@ -263,6 +263,10 @@ > MAKEFLAGS=X_CFLAGS="-I${LOCALBASE}/include" > X11_MAKE_ENV_ON= MAKEFLAGS="" > X11_USE= XORG=x11,xext,xi,xrender,xt,xtst >+FONTCONFIG_IMPLIES= X11 >+FONTCONFIG_EXTRA_PATCHES= ${PATCHDIR}/freetypeScaler-fontconfig.patch >+FONTCONFIG_EXTRA_PATCHES_OFF= ${PATCHDIR}/freetypeScaler-fontconfig-off.patch >+FONTCONFIG_LDFLAGS= -L${LOCALBASE}/lib -lfontconfig > > JAVAVMS_COMMENT= OpenJDK${JDK_MAJOR_VERSION} > >@@ -399,6 +403,8 @@ > ${WRKSRC}/jdk/make/lib/Awt2dLibraries.gmk \ > ${WRKSRC}/jdk/make/lib/CoreLibraries.gmk \ > ${WRKSRC}/jdk/make/lib/ServiceabilityLibraries.gmk >+ @${REINPLACE_CMD} -e 's|%%FONTCONFIG_LDFLAGS%%|${FONTCONFIG_LDFLAGS}|' \ >+ ${WRKSRC}/jdk/make/lib/Awt2dLibraries.gmk > .if defined(BUILD_JRE) > @${REINPLACE_CMD} -e 's|-f Images.gmk$$|& jre-image|' \ > -e 's|-f Images.gmk overlay-images$$|-f Images.gmk jre-overlay-image|' \ >@@ -410,6 +416,10 @@ > @${REINPLACE_CMD} '/EXTRA_SOUND_JNI_LIBS += jsoundalsa/d' \ > ${WRKSRC}/jdk/make/lib/SoundLibraries.gmk > >+post-patch-FONTCONFIG-off: >+ @${REINPLACE_CMD} 's|${FONTCONFIG_LDFLAGS}||' \ >+ ${WRKSRC}/jdk/make/lib/Awt2dLibraries.gmk >+ > post-build: > .if !defined(BUILD_JRE) > @${BOOTSTRAPJDKDIR}/bin/jar cfe \ >Index: java/openjdk8/files/freetypeScaler-fontconfig-off.patch >=================================================================== >--- java/openjdk8/files/freetypeScaler-fontconfig-off.patch (nonexistent) >+++ java/openjdk8/files/freetypeScaler-fontconfig-off.patch (working copy) >@@ -0,0 +1,52 @@ >+--- jdk/src/share/native/sun/font/freetypeScaler.c >++++ jdk/src/share/native/sun/font/freetypeScaler.c >+@@ -60,6 +60,7 @@ >+ JNIEnv* env; >+ FT_Library library; >+ FT_Face face; >++ FT_Stream faceStream; >+ jobject font2D; >+ jobject directBuffer; >+ >+@@ -107,15 +108,10 @@ >+ if (scalerInfo == NULL) >+ return; >+ >+- //apparently Done_Face will only close the stream >+- // but will not relase the memory of stream structure. >+- // We need to free it explicitly to avoid leak. >+- //Direct access to the stream field might be not ideal solution as >+- // it is considred to be "private". >+- //Alternatively we could have stored pointer to the structure >+- // in the scalerInfo but this will increase size of the structure >+- // for no good reason >+- stream = scalerInfo->face->stream; >++ // FT_Done_Face always closes the stream, but only frees the memory >++ // of the data structure if it was internally allocated by FT. >++ // We hold on to a pointer to the stream structure if we provide it >++ // ourselves, so that we can free it here. >+ >+ FT_Done_Face(scalerInfo->face); >+ FT_Done_FreeType(scalerInfo->library); >+@@ -128,8 +124,8 @@ >+ free(scalerInfo->fontData); >+ } >+ >+- if (stream != NULL) { >+- free(stream); >++ if (scalerInfo->faceStream != NULL) { >++ free(scalerInfo->faceStream); >+ } >+ >+ free(scalerInfo); >+@@ -302,6 +298,10 @@ >+ &ft_open_args, >+ indexInCollection, >+ &scalerInfo->face); >++ >++ if (!error) { >++ scalerInfo->faceStream = ftstream; >++ } >+ } >+ if (error || scalerInfo->directBuffer == NULL) { >+ free(ftstream); > >Property changes on: java/openjdk8/files/freetypeScaler-fontconfig-off.patch >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: java/openjdk8/files/freetypeScaler-fontconfig.patch >=================================================================== >--- java/openjdk8/files/freetypeScaler-fontconfig.patch (nonexistent) >+++ java/openjdk8/files/freetypeScaler-fontconfig.patch (working copy) >@@ -0,0 +1,265 @@ >+Based on original OpenJDK8 patches from Infinality project: >+http://www.infinality.net/forum/viewtopic.php?f=2&t=80#p395 >+and Fedora 21 OpenJDK8 patches by Steven Merrill: >+https://github.com/smerrill/fedora-21-openjdk8-infinality/blob/master/SOURCES/005_enable-infinality.patch >+--- jdk/src/share/native/sun/font/freetypeScaler.c.orig 2017-01-20 17:04:07 UTC >++++ jdk/src/share/native/sun/font/freetypeScaler.c >+@@ -38,6 +38,8 @@ >+ #include FT_SIZES_H >+ #include FT_OUTLINE_H >+ #include FT_SYNTHESIS_H >++#include FT_LCD_FILTER_H >++#include <fontconfig/fontconfig.h> >+ >+ #include "fontscaler.h" >+ >+@@ -60,6 +62,7 @@ typedef struct { >+ JNIEnv* env; >+ FT_Library library; >+ FT_Face face; >++ FT_Stream faceStream; >+ jobject font2D; >+ jobject directBuffer; >+ >+@@ -107,15 +110,10 @@ static void freeNativeResources(JNIEnv * >+ if (scalerInfo == NULL) >+ return; >+ >+- //apparently Done_Face will only close the stream >+- // but will not relase the memory of stream structure. >+- // We need to free it explicitly to avoid leak. >+- //Direct access to the stream field might be not ideal solution as >+- // it is considred to be "private". >+- //Alternatively we could have stored pointer to the structure >+- // in the scalerInfo but this will increase size of the structure >+- // for no good reason >+- stream = scalerInfo->face->stream; >++ // FT_Done_Face always closes the stream, but only frees the memory >++ // of the data structure if it was internally allocated by FT. >++ // We hold on to a pointer to the stream structure if we provide it >++ // ourselves, so that we can free it here. >+ >+ FT_Done_Face(scalerInfo->face); >+ FT_Done_FreeType(scalerInfo->library); >+@@ -128,8 +126,8 @@ static void freeNativeResources(JNIEnv * >+ free(scalerInfo->fontData); >+ } >+ >+- if (stream != NULL) { >+- free(stream); >++ if (scalerInfo->faceStream != NULL) { >++ free(scalerInfo->faceStream); >+ } >+ >+ free(scalerInfo); >+@@ -333,6 +331,10 @@ Java_sun_font_FreetypeFontScaler_initNat >+ &ft_open_args, >+ indexInCollection, >+ &scalerInfo->face); >++ >++ if (!error) { >++ scalerInfo->faceStream = ftstream; >++ } >+ } >+ if (error || scalerInfo->directBuffer == NULL) { >+ free(ftstream); >+@@ -693,6 +695,132 @@ static void CopyFTSubpixelVToSubpixel(co >+ } >+ } >+ >++typedef struct { >++ FT_Render_Mode ftRenderMode; >++ int ftLoadFlags; >++ FT_LcdFilter ftLcdFilter; >++} RenderingProperties; >++ >++static FcPattern* matchedPattern(const FcChar8* family, double ptSize) { >++ FcPattern* pattern = FcPatternCreate(); >++ if (!pattern) >++ return 0; >++ >++ FcPatternAddString(pattern, FC_FAMILY, family); >++ FcPatternAddBool(pattern, FC_SCALABLE, FcTrue); >++ FcPatternAddDouble(pattern, FC_SIZE, ptSize); >++ >++ FcConfigSubstitute(0, pattern, FcMatchPattern); >++ FcDefaultSubstitute(pattern); >++ >++ FcResult res; >++ FcPattern *match = FcFontMatch(0, pattern, &res); >++ FcPatternDestroy(pattern); >++ return (res == FcResultMatch) ? match : NULL; >++} >++ >++static void readFontconfig(const FcChar8* family, double ptSize, jint aaType, RenderingProperties* rp) { >++ FcPattern *pattern = matchedPattern(family, ptSize); >++ >++ FT_Render_Mode ftRenderMode = FT_RENDER_MODE_NORMAL; >++ int ftLoadFlags = FT_LOAD_DEFAULT; >++ FT_LcdFilter ftLcdFilter = FT_LCD_FILTER_DEFAULT; >++ FcBool fcAntialias = 0; >++ char horizontal = 1; >++ >++ // subpixel order >++ if (aaType == TEXT_AA_ON) >++ ftRenderMode = FT_RENDER_MODE_NORMAL; >++ else if (aaType == TEXT_AA_OFF) >++ ftRenderMode = FT_RENDER_MODE_MONO; >++ else { >++ int fcRGBA = FC_RGBA_UNKNOWN; >++ if (pattern) >++ FcPatternGetInteger(pattern, FC_RGBA, 0, &fcRGBA); >++ switch (fcRGBA) { >++ case FC_RGBA_NONE: >++ ftRenderMode = FT_RENDER_MODE_NORMAL; >++ break; >++ case FC_RGBA_RGB: >++ case FC_RGBA_BGR: >++ ftRenderMode = FT_RENDER_MODE_LCD; >++ horizontal = 1; >++ break; >++ case FC_RGBA_VRGB: >++ case FC_RGBA_VBGR: >++ ftRenderMode = FT_RENDER_MODE_LCD_V; >++ horizontal = 0; >++ break; >++ default: >++ ftRenderMode = FT_RENDER_MODE_NORMAL; >++ break; >++ } >++ } >++ >++ // loading mode >++ if (aaType == TEXT_AA_OFF) >++ ftLoadFlags |= FT_LOAD_TARGET_MONO; >++ else { >++ int fcHintStyle = FC_HINT_NONE; >++ if (pattern) >++ FcPatternGetInteger(pattern, FC_HINT_STYLE, 0, &fcHintStyle); >++ switch (fcHintStyle) { >++ case FC_HINT_NONE: >++ ftLoadFlags |= FT_LOAD_NO_HINTING; >++ break; >++ case FC_HINT_SLIGHT: >++ ftLoadFlags |= FT_LOAD_TARGET_LIGHT; >++ break; >++ case FC_HINT_MEDIUM: >++ ftLoadFlags |= FT_LOAD_TARGET_NORMAL; >++ break; >++ case FC_HINT_FULL: >++ if (aaType == TEXT_AA_ON) >++ ftLoadFlags |= FT_LOAD_TARGET_NORMAL; >++ else >++ ftLoadFlags |= horizontal ? FT_LOAD_TARGET_LCD : FT_LOAD_TARGET_LCD_V; >++ break; >++ default: >++ ftLoadFlags |= FT_LOAD_TARGET_NORMAL; >++ break; >++ } >++ } >++ >++ // autohinting >++ FcBool fcAutohint = 0; >++ if (pattern && FcPatternGetBool(pattern, FC_AUTOHINT, 0, &fcAutohint) == FcResultMatch) >++ if (fcAutohint) >++ ftLoadFlags |= FT_LOAD_FORCE_AUTOHINT; >++ >++ // LCD filter >++ int fcLCDFilter = FC_LCD_DEFAULT; >++ if (pattern) >++ FcPatternGetInteger(pattern, FC_LCD_FILTER, 0, &fcLCDFilter); >++ switch (fcLCDFilter) { >++ case FC_LCD_NONE: >++ ftLcdFilter = FT_LCD_FILTER_NONE; >++ break; >++ case FC_LCD_DEFAULT: >++ ftLcdFilter = FT_LCD_FILTER_DEFAULT; >++ break; >++ case FC_LCD_LIGHT: >++ ftLcdFilter = FT_LCD_FILTER_LIGHT; >++ break; >++ case FC_LCD_LEGACY: >++ ftLcdFilter = FT_LCD_FILTER_LEGACY; >++ break; >++ default: >++ ftLcdFilter = FT_LCD_FILTER_DEFAULT; >++ break; >++ } >++ >++ if (pattern) >++ FcPatternDestroy(pattern); >++ >++ rp->ftRenderMode = ftRenderMode; >++ rp->ftLoadFlags = ftLoadFlags; >++ rp->ftLcdFilter = ftLcdFilter; >++} >+ >+ /* >+ * Class: sun_font_FreetypeFontScaler >+@@ -726,32 +850,15 @@ Java_sun_font_FreetypeFontScaler_getGlyp >+ return ptr_to_jlong(getNullGlyphImage()); >+ } >+ >+- /* if algorithmic styling is required then we do not request bitmap */ >+- if (context->doBold || context->doItalize) { >+- renderFlags = FT_LOAD_DEFAULT; >+- } >+- >+- /* NB: in case of non identity transform >+- we might also prefer to disable transform before hinting, >+- and apply it explicitly after hinting is performed. >+- Or we can disable hinting. */ >+- >+- /* select appropriate hinting mode */ >+- if (context->aaType == TEXT_AA_OFF) { >+- target = FT_LOAD_TARGET_MONO; >+- } else if (context->aaType == TEXT_AA_ON) { >+- target = FT_LOAD_TARGET_NORMAL; >+- } else if (context->aaType == TEXT_AA_LCD_HRGB || >+- context->aaType == TEXT_AA_LCD_HBGR) { >+- target = FT_LOAD_TARGET_LCD; >+- } else { >+- target = FT_LOAD_TARGET_LCD_V; >+- } >+- renderFlags |= target; >++ RenderingProperties renderingProperties; >++ readFontconfig((const FcChar8 *) scalerInfo->face->family_name, >++ context->ptsz, context->aaType, &renderingProperties); >+ >+ glyph_index = FT_Get_Char_Index(scalerInfo->face, glyphCode); >+ >+- error = FT_Load_Glyph(scalerInfo->face, glyphCode, renderFlags); >++ FT_Library_SetLcdFilter(scalerInfo->library, renderingProperties.ftLcdFilter); >++ error = FT_Load_Glyph(scalerInfo->face, glyphCode, renderingProperties.ftLoadFlags); >++ >+ if (error) { >+ //do not destroy scaler yet. >+ //this can be problem of particular context (e.g. with bad transform) >+@@ -770,9 +877,7 @@ Java_sun_font_FreetypeFontScaler_getGlyp >+ >+ /* generate bitmap if it is not done yet >+ e.g. if algorithmic styling is performed and style was added to outline */ >+- if (ftglyph->format == FT_GLYPH_FORMAT_OUTLINE) { >+- FT_Render_Glyph(ftglyph, FT_LOAD_TARGET_MODE(target)); >+- } >++ FT_Render_Glyph(ftglyph, renderingProperties.ftRenderMode); >+ >+ width = (UInt16) ftglyph->bitmap.width; >+ height = (UInt16) ftglyph->bitmap.rows; >+@@ -1001,11 +1106,14 @@ static FT_Outline* getFTOutline(JNIEnv* >+ return NULL; >+ } >+ >+- renderFlags = FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP; >++ RenderingProperties renderingProperties; >++ readFontconfig((const FcChar8 *) scalerInfo->face->family_name, >++ context->ptsz, context->aaType, &renderingProperties); >+ >+ glyph_index = FT_Get_Char_Index(scalerInfo->face, glyphCode); >+ >+- error = FT_Load_Glyph(scalerInfo->face, glyphCode, renderFlags); >++ error = FT_Load_Glyph(scalerInfo->face, glyphCode, renderingProperties.ftLoadFlags); >++ >+ if (error) { >+ return NULL; >+ } > >Property changes on: java/openjdk8/files/freetypeScaler-fontconfig.patch >___________________________________________________________________ >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: java/openjdk8/files/patch-jdk-make-lib-Awt2dLibraries.gmk >=================================================================== >--- java/openjdk8/files/patch-jdk-make-lib-Awt2dLibraries.gmk (revision 457460) >+++ java/openjdk8/files/patch-jdk-make-lib-Awt2dLibraries.gmk (working copy) >@@ -1,5 +1,14 @@ > --- jdk/make/lib/Awt2dLibraries.gmk.orig 2015-07-18 14:30:01.000000000 -0700 > +++ jdk/make/lib/Awt2dLibraries.gmk 2015-07-18 14:30:08.000000000 -0700 >+@@ -943,7 +943,7 @@ >+ LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \ >+ LDFLAGS_SUFFIX_solaris := -lawt -lawt_headless -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \ >+ LDFLAGS_SUFFIX_aix := -lawt -lawt_headless $(LIBM) $(LIBCXX) -ljava -ljvm,\ >+- LDFLAGS_SUFFIX_bsd := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \ >++ LDFLAGS_SUFFIX_bsd := %%FONTCONFIG_LDFLAGS%% -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \ >+ LDFLAGS_SUFFIX_macosx := -lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup \ >+ -ljava -ljvm, \ >+ LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \ > @@ -1259,7 +1259,7 @@ > else ifeq ($(OPENJDK_TARGET_OS), bsd) > LIBSPLASHSCREEN_CFLAGS += -DWITH_X11 $(X_CFLAGS) -I$(PACKAGE_PATH)/include >Index: java/openjdk8/files/patch-jdk-src-share-native-sun-font-freetypeScaler.c >=================================================================== >--- java/openjdk8/files/patch-jdk-src-share-native-sun-font-freetypeScaler.c (revision 457460) >+++ java/openjdk8/files/patch-jdk-src-share-native-sun-font-freetypeScaler.c (nonexistent) >@@ -1,52 +0,0 @@ >---- jdk/src/share/native/sun/font/freetypeScaler.c >-+++ jdk/src/share/native/sun/font/freetypeScaler.c >-@@ -60,6 +60,7 @@ >- JNIEnv* env; >- FT_Library library; >- FT_Face face; >-+ FT_Stream faceStream; >- jobject font2D; >- jobject directBuffer; >- >-@@ -107,15 +108,10 @@ >- if (scalerInfo == NULL) >- return; >- >-- //apparently Done_Face will only close the stream >-- // but will not relase the memory of stream structure. >-- // We need to free it explicitly to avoid leak. >-- //Direct access to the stream field might be not ideal solution as >-- // it is considred to be "private". >-- //Alternatively we could have stored pointer to the structure >-- // in the scalerInfo but this will increase size of the structure >-- // for no good reason >-- stream = scalerInfo->face->stream; >-+ // FT_Done_Face always closes the stream, but only frees the memory >-+ // of the data structure if it was internally allocated by FT. >-+ // We hold on to a pointer to the stream structure if we provide it >-+ // ourselves, so that we can free it here. >- >- FT_Done_Face(scalerInfo->face); >- FT_Done_FreeType(scalerInfo->library); >-@@ -128,8 +124,8 @@ >- free(scalerInfo->fontData); >- } >- >-- if (stream != NULL) { >-- free(stream); >-+ if (scalerInfo->faceStream != NULL) { >-+ free(scalerInfo->faceStream); >- } >- >- free(scalerInfo); >-@@ -302,6 +298,10 @@ >- &ft_open_args, >- indexInCollection, >- &scalerInfo->face); >-+ >-+ if (!error) { >-+ scalerInfo->faceStream = ftstream; >-+ } >- } >- if (error || scalerInfo->directBuffer == NULL) { >- free(ftstream); > >Property changes on: java/openjdk8/files/patch-jdk-src-share-native-sun-font-freetypeScaler.c >___________________________________________________________________ >Deleted: fbsd:nokeywords >## -1 +0,0 ## >-yes >\ No newline at end of property >Deleted: svn:eol-style >## -1 +0,0 ## >-native >\ No newline at end of property >Deleted: svn:mime-type >## -1 +0,0 ## >-text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dmgk
:
maintainer-approval?
(
java
)
Actions:
View
|
Diff
Attachments on
bug 215636
:
178350
|
178351
|
178352
|
178353
|
178354
|
178355
|
178356
|
178357
|
178358
|
178637
|
179154
|
179959
|
188141
| 189163