mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JRE-29 fontconfig lib crashes CLion on OSX
Disabled fontconfig usage on OSX (cherry picked from commit431e14429c) (cherry picked from commit534d184416)
This commit is contained in:
@@ -30,9 +30,13 @@
|
||||
#include "sun_font_FreetypeFontScaler.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#if defined(_WIN32) || defined(MACOSX)
|
||||
#define DISABLE_FONTCONFIG
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE_)
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
#include <dlfcn.h>
|
||||
#include "jvm.h"
|
||||
#else
|
||||
@@ -52,7 +56,7 @@
|
||||
#include FT_MODULE_H
|
||||
#include FT_LCD_FILTER_H
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
/* Use bundled fontconfig.h for now */
|
||||
#include "fontconfig.h"
|
||||
#endif
|
||||
@@ -76,7 +80,7 @@
|
||||
#define MAX_DPI 1024
|
||||
#define ADJUST_FONT_SIZE(X, DPI) (((X)*DEFAULT_DPI + ((DPI)>>1))/(DPI))
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
#define FONTCONFIG_DLL JNI_LIB_NAME("fontconfig")
|
||||
#define FONTCONFIG_DLL_VERSIONED VERSIONED_JNI_LIB_NAME("fontconfig", "1")
|
||||
#endif
|
||||
@@ -145,7 +149,7 @@ static jclass tkClass;
|
||||
static jmethodID getScreenResolutionMID;
|
||||
static jfieldID platNameFID;
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
typedef FcBool (*FcPatternAddPtrType) (FcPattern *p, const char *object, FcValue value, FcBool append);
|
||||
typedef FcBool (*FcPatternAddBoolPtrType) (FcPattern *p, const char *object, FcBool b);
|
||||
typedef FcBool (*FcPatternAddDoublePtrType) (FcPattern *p, const char *object, double d);
|
||||
@@ -162,7 +166,7 @@ static void *libFontConfig = NULL;
|
||||
static jboolean logFC = JNI_FALSE;
|
||||
static jboolean logFFS = JNI_FALSE;
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
static FcPatternAddPtrType FcPatternAddPtr;
|
||||
static FcPatternAddBoolPtrType FcPatternAddBoolPtr;
|
||||
static FcPatternAddDoublePtrType FcPatternAddDoublePtr;
|
||||
@@ -177,7 +181,7 @@ static FcPatternGetIntegerPtrType FcPatternGetIntegerPtr;
|
||||
|
||||
static void* openFontConfig() {
|
||||
void* libfontconfig = NULL;
|
||||
#ifndef _WIN32
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
char *fcLogEnabled = getenv("OPENJDK_FFS_LOG_FC");
|
||||
|
||||
if (fcLogEnabled != NULL && !strcmp(fcLogEnabled, "yes")) {
|
||||
@@ -226,7 +230,7 @@ Java_sun_font_FreetypeFontScaler_initIDs(
|
||||
tkClass = (*env)->NewGlobalRef(env, TKClass);
|
||||
platNameFID = (*env)->GetFieldID(env, PFClass, "platName", "Ljava/lang/String;");
|
||||
libFontConfig = openFontConfig();
|
||||
#ifndef _WIN32
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
if (libFontConfig) {
|
||||
FcPatternAddPtr = (FcPatternAddPtrType) dlsym(libFontConfig, "FcPatternAdd");
|
||||
FcPatternAddBoolPtr = (FcPatternAddBoolPtrType) dlsym(libFontConfig, "FcPatternAddBool");
|
||||
@@ -830,7 +834,7 @@ static int setupFTContext(JNIEnv *env, jobject font2D, FTScalerInfo *scalerInfo,
|
||||
context->renderFlags = FT_LOAD_TARGET_MODE(context->loadFlags);
|
||||
return 0;
|
||||
}
|
||||
#ifndef _WIN32
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
FcPattern *fcPattern = 0;
|
||||
fcPattern = (*FcPatternCreatePtr)();
|
||||
FcValue fcValue;
|
||||
@@ -1321,7 +1325,6 @@ static jlong
|
||||
GlyphInfo *glyphInfo;
|
||||
int target;
|
||||
FT_GlyphSlot ftglyph;
|
||||
FT_LcdFilter lcdFilter = FT_LCD_FILTER_NONE;
|
||||
FT_Library library;
|
||||
|
||||
FTScalerContext* context =
|
||||
@@ -2096,7 +2099,7 @@ Java_sun_font_FreetypeFontScaler_getGlyphPointNative(
|
||||
JNIEXPORT void JNICALL
|
||||
JNI_OnUnload(JavaVM *vm, void *reserved) {
|
||||
if (libFontConfig != NULL) {
|
||||
#ifndef _WIN32
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
dlclose(libFontConfig);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user