< prev index next >

src/java.desktop/share/native/libfontmanager/freetypeScaler.c

Print this page

        

*** 27,50 **** #include "jni_util.h" #include "jlong.h" #include "sunfontids.h" #include "sun_font_FreetypeFontScaler.h" ! #include <stdlib.h> ! #if !defined(_WIN32) && !defined(__APPLE_) ! #include <dlfcn.h> ! #endif #include <math.h> #include "ft2build.h" #include FT_FREETYPE_H #include FT_GLYPH_H #include FT_BBOX_H #include FT_SIZES_H #include FT_OUTLINE_H #include FT_SYNTHESIS_H #include FT_LCD_FILTER_H - #include FT_MODULE_H #include "fontscaler.h" #define ftFixed1 (FT_Fixed) (1 << 16) #define FloatToFTFixed(f) (FT_Fixed)((f) * (float)(ftFixed1)) --- 27,46 ---- #include "jni_util.h" #include "jlong.h" #include "sunfontids.h" #include "sun_font_FreetypeFontScaler.h" ! #include<stdlib.h> #include <math.h> #include "ft2build.h" #include FT_FREETYPE_H #include FT_GLYPH_H #include FT_BBOX_H #include FT_SIZES_H #include FT_OUTLINE_H #include FT_SYNTHESIS_H #include FT_LCD_FILTER_H #include "fontscaler.h" #define ftFixed1 (FT_Fixed) (1 << 16) #define FloatToFTFixed(f) (FT_Fixed)((f) * (float)(ftFixed1))
*** 206,261 **** memcpy(destBuffer, scalerInfo->fontData, numBytes); return numBytes; } } - typedef FT_Error (*FT_Prop_Set_Func)(FT_Library library, - const FT_String* module_name, - const FT_String* property_name, - const void* value ); - - /** - * Prefer the older v35 freetype byte code interpreter. - */ - static void setInterpreterVersion(FT_Library library) { - - char* props = getenv("FREETYPE_PROPERTIES"); - int version = 35; - const char* module = "truetype"; - const char* property = "interpreter-version"; - - /* If some one is setting this, don't override it */ - if (props != NULL && strstr(property, props)) { - return; - } - /* - * FT_Property_Set was introduced in 2.4.11. - * Some older supported Linux OSes may not include it so look - * this up dynamically. - * And if its not available it doesn't matter, since the reason - * we need it dates from 2.7. - * On Windows & Mac the library is always bundled so it is safe - * to use directly in those cases. - */ - #if defined(_WIN32) || defined(__APPLE__) - FT_Property_Set(library, module, property, (void*)(&version)); - #else - void *lib = dlopen("libfreetype.so", RTLD_LOCAL|RTLD_LAZY); - if (lib == NULL) { - lib = dlopen("libfreetype.so.6", RTLD_LOCAL|RTLD_LAZY); - if (lib == NULL) { - return; - } - } - FT_Prop_Set_Func func = (FT_Prop_Set_Func)dlsym(lib, "FT_Property_Set"); - if (func != NULL) { - func(library, module, property, (void*)(&version)); - } - dlclose(lib); - #endif - } - /* * Class: sun_font_FreetypeFontScaler * Method: initNativeScaler * Signature: (Lsun/font/Font2D;IIZI)J */ --- 202,211 ----
*** 291,301 **** error = FT_Init_FreeType(&scalerInfo->library); if (error) { free(scalerInfo); return 0; } - setInterpreterVersion(scalerInfo->library); #define TYPE1_FROM_JAVA 2 error = 1; /* triggers memory freeing unless we clear it */ if (type == TYPE1_FROM_JAVA) { /* TYPE1 */ --- 241,250 ----
< prev index next >