src/java.desktop/share/native/libfontmanager/freetypeScaler.c
changeset 54590 98473958d49a
parent 54239 0804f29e8be7
child 55369 18629738b64b
child 58678 9cf78a70fa4f
equal deleted inserted replaced
54509:6c291f12969f 54590:98473958d49a
    67 
    67 
    68     unsigned char* fontData;
    68     unsigned char* fontData;
    69     unsigned fontDataOffset;
    69     unsigned fontDataOffset;
    70     unsigned fontDataLength;
    70     unsigned fontDataLength;
    71     unsigned fileSize;
    71     unsigned fileSize;
    72     TTLayoutTableCache* layoutTables;
       
    73 } FTScalerInfo;
    72 } FTScalerInfo;
    74 
    73 
    75 typedef struct FTScalerContext {
    74 typedef struct FTScalerContext {
    76     FT_Matrix  transform;     /* glyph transform, including device transform */
    75     FT_Matrix  transform;     /* glyph transform, including device transform */
    77     jboolean   useSbits;      /* sbit usage enabled? */
    76     jboolean   useSbits;      /* sbit usage enabled? */
   249 
   248 
   250     error = 1; /* triggers memory freeing unless we clear it */
   249     error = 1; /* triggers memory freeing unless we clear it */
   251     if (type == TYPE1_FROM_JAVA) { /* TYPE1 */
   250     if (type == TYPE1_FROM_JAVA) { /* TYPE1 */
   252         scalerInfo->fontData = (unsigned char*) malloc(filesize);
   251         scalerInfo->fontData = (unsigned char*) malloc(filesize);
   253         scalerInfo->directBuffer = NULL;
   252         scalerInfo->directBuffer = NULL;
   254         scalerInfo->layoutTables = NULL;
       
   255         scalerInfo->fontDataLength = filesize;
   253         scalerInfo->fontDataLength = filesize;
   256 
   254 
   257         if (scalerInfo->fontData != NULL) {
   255         if (scalerInfo->fontData != NULL) {
   258             bBuffer = (*env)->NewDirectByteBuffer(env,
   256             bBuffer = (*env)->NewDirectByteBuffer(env,
   259                                               scalerInfo->fontData,
   257                                               scalerInfo->fontData,
   864     }
   862     }
   865 
   863 
   866     return ptr_to_jlong(glyphInfo);
   864     return ptr_to_jlong(glyphInfo);
   867 }
   865 }
   868 
   866 
   869 
       
   870 /*
       
   871  * Class:     sun_font_FreetypeFontScaler
       
   872  * Method:    getLayoutTableCacheNative
       
   873  * Signature: (J)J
       
   874  */
       
   875 JNIEXPORT jlong JNICALL
       
   876 Java_sun_font_FreetypeFontScaler_getLayoutTableCacheNative(
       
   877         JNIEnv *env, jobject scaler, jlong pScaler) {
       
   878     FTScalerInfo *scalerInfo = (FTScalerInfo*) jlong_to_ptr(pScaler);
       
   879 
       
   880     if (scalerInfo == NULL) {
       
   881         invalidateJavaScaler(env, scaler, scalerInfo);
       
   882         return 0L;
       
   883     }
       
   884 
       
   885     // init layout table cache in font
       
   886     // we're assuming the font is a file font and moreover it is Truetype font
       
   887     // otherwise we shouldn't be able to get here...
       
   888     if (scalerInfo->layoutTables == NULL) {
       
   889         scalerInfo->layoutTables = newLayoutTableCache();
       
   890     }
       
   891 
       
   892     return ptr_to_jlong(scalerInfo->layoutTables);
       
   893 }
       
   894 
       
   895 /*
   867 /*
   896  * Class:     sun_font_FreetypeFontScaler
   868  * Class:     sun_font_FreetypeFontScaler
   897  * Method:    disposeNativeScaler
   869  * Method:    disposeNativeScaler
   898  * Signature: (J)V
   870  * Signature: (J)V
   899  */
   871  */