< prev index next >

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

Print this page




 241     error = FT_Init_FreeType(&scalerInfo->library);
 242     if (error) {
 243         free(scalerInfo);
 244         return 0;
 245     }
 246 
 247 #define TYPE1_FROM_JAVA        2
 248 
 249     error = 1; /* triggers memory freeing unless we clear it */
 250     if (type == TYPE1_FROM_JAVA) { /* TYPE1 */
 251         scalerInfo->fontData = (unsigned char*) malloc(filesize);
 252         scalerInfo->directBuffer = NULL;
 253         scalerInfo->layoutTables = NULL;
 254         scalerInfo->fontDataLength = filesize;
 255 
 256         if (scalerInfo->fontData != NULL) {
 257             bBuffer = (*env)->NewDirectByteBuffer(env,
 258                                               scalerInfo->fontData,
 259                                               scalerInfo->fontDataLength);
 260             if (bBuffer != NULL) {
 261                 (*env)->CallObjectMethod(env, font2D,
 262                                    sunFontIDs.readFileMID, bBuffer);
 263 
 264                 error = FT_New_Memory_Face(scalerInfo->library,
 265                                    scalerInfo->fontData,
 266                                    scalerInfo->fontDataLength,
 267                                    indexInCollection,
 268                                    &scalerInfo->face);
 269             }
 270         }
 271     } else { /* Truetype */
 272         scalerInfo->fontData = (unsigned char*) malloc(FILEDATACACHESIZE);
 273 
 274         if (scalerInfo->fontData != NULL) {
 275             FT_Stream ftstream = (FT_Stream) calloc(1, sizeof(FT_StreamRec));
 276             if (ftstream != NULL) {
 277                 scalerInfo->directBuffer = (*env)->NewDirectByteBuffer(env,
 278                                            scalerInfo->fontData,
 279                                            FILEDATACACHESIZE);
 280                 if (scalerInfo->directBuffer != NULL) {
 281                     scalerInfo->directBuffer = (*env)->NewGlobalRef(env,




 241     error = FT_Init_FreeType(&scalerInfo->library);
 242     if (error) {
 243         free(scalerInfo);
 244         return 0;
 245     }
 246 
 247 #define TYPE1_FROM_JAVA        2
 248 
 249     error = 1; /* triggers memory freeing unless we clear it */
 250     if (type == TYPE1_FROM_JAVA) { /* TYPE1 */
 251         scalerInfo->fontData = (unsigned char*) malloc(filesize);
 252         scalerInfo->directBuffer = NULL;
 253         scalerInfo->layoutTables = NULL;
 254         scalerInfo->fontDataLength = filesize;
 255 
 256         if (scalerInfo->fontData != NULL) {
 257             bBuffer = (*env)->NewDirectByteBuffer(env,
 258                                               scalerInfo->fontData,
 259                                               scalerInfo->fontDataLength);
 260             if (bBuffer != NULL) {
 261                 (*env)->CallVoidMethod(env, font2D,
 262                                    sunFontIDs.readFileMID, bBuffer);
 263 
 264                 error = FT_New_Memory_Face(scalerInfo->library,
 265                                    scalerInfo->fontData,
 266                                    scalerInfo->fontDataLength,
 267                                    indexInCollection,
 268                                    &scalerInfo->face);
 269             }
 270         }
 271     } else { /* Truetype */
 272         scalerInfo->fontData = (unsigned char*) malloc(FILEDATACACHESIZE);
 273 
 274         if (scalerInfo->fontData != NULL) {
 275             FT_Stream ftstream = (FT_Stream) calloc(1, sizeof(FT_StreamRec));
 276             if (ftstream != NULL) {
 277                 scalerInfo->directBuffer = (*env)->NewDirectByteBuffer(env,
 278                                            scalerInfo->fontData,
 279                                            FILEDATACACHESIZE);
 280                 if (scalerInfo->directBuffer != NULL) {
 281                     scalerInfo->directBuffer = (*env)->NewGlobalRef(env,


< prev index next >