fontcache.c
changeset 5240 60cbd11d714c
parent 5222 4f4cfb2e248e
child 5267 af4a6aa071a7
equal deleted inserted replaced
5239:f1d51fcc0aa7 5240:60cbd11d714c
    66 		char *s;
    66 		char *s;
    67 		DWORD vbuflen = lengthof(vbuffer);
    67 		DWORD vbuflen = lengthof(vbuffer);
    68 		DWORD dbuflen = lengthof(dbuffer);
    68 		DWORD dbuflen = lengthof(dbuffer);
    69 
    69 
    70 		ret = RegEnumValue(hKey, index, vbuffer, &vbuflen, NULL, NULL, dbuffer, &dbuflen);
    70 		ret = RegEnumValue(hKey, index, vbuffer, &vbuflen, NULL, NULL, dbuffer, &dbuflen);
    71 		if (ret != ERROR_SUCCESS) break;
    71 		if (ret != ERROR_SUCCESS) goto registry_no_font_found;
    72 
    72 
    73 		/* The font names in the registry are of the following 3 forms:
    73 		/* The font names in the registry are of the following 3 forms:
    74 		 * - ADMUI3.fon
    74 		 * - ADMUI3.fon
    75 		 * - Book Antiqua Bold (TrueType)
    75 		 * - Book Antiqua Bold (TrueType)
    76 		 * - Batang & BatangChe & Gungsuh & GungsuhChe (TrueType)
    76 		 * - Batang & BatangChe & Gungsuh & GungsuhChe (TrueType)
    95 	}
    95 	}
    96 
    96 
    97 	/* Some fonts are contained in .ttc files, TrueType Collection fonts. These
    97 	/* Some fonts are contained in .ttc files, TrueType Collection fonts. These
    98 	 * contain multiple fonts inside this single file. GetFontData however
    98 	 * contain multiple fonts inside this single file. GetFontData however
    99 	 * returns the whole file, so we need to check each font inside to get the
    99 	 * returns the whole file, so we need to check each font inside to get the
   100 	 * proper font. If not found, we will use the last font in the ttc.
   100 	 * proper font.
   101 	 * Also note that FreeType does not support UNICODE filesnames! */
   101 	 * Also note that FreeType does not support UNICODE filesnames! */
   102 #if defined(UNICODE)
   102 #if defined(UNICODE)
   103 	font_path = malloc(MAX_PATH);
   103 	font_path = malloc(MAX_PATH);
   104 	font_path = convert_from_fs(vbuffer, font_path, MAX_PATH);
   104 	font_path = convert_from_fs(vbuffer, font_path, MAX_PATH);
   105 #else
   105 #else
   121 #if defined(UNICODE)
   121 #if defined(UNICODE)
   122 	free(font_path);
   122 	free(font_path);
   123 #endif
   123 #endif
   124 
   124 
   125 folder_error:
   125 folder_error:
       
   126 registry_no_font_found:
   126 	RegCloseKey(hKey);
   127 	RegCloseKey(hKey);
   127 	return err;
   128 	return err;
   128 }
   129 }
   129 #else
   130 #else
   130 # ifdef WITH_FONTCONFIG
   131 # ifdef WITH_FONTCONFIG
   239 			if (found != NULL) {
   240 			if (found != NULL) {
   240 				error = FT_Set_Charmap(*face, found);
   241 				error = FT_Set_Charmap(*face, found);
   241 				if (error == FT_Err_Ok) return;
   242 				if (error == FT_Err_Ok) return;
   242 			}
   243 			}
   243 		}
   244 		}
   244 
   245 	}
   245 		FT_Done_Face(*face);
   246 
   246 		*face = NULL;
   247 	FT_Done_Face(*face);
   247 	}
   248 	*face = NULL;
   248 
   249 
   249 	ShowInfoF("Unable to use '%s' for %s font, FreeType reported error 0x%X, using sprite font instead", font_name, type, error);
   250 	ShowInfoF("Unable to use '%s' for %s font, FreeType reported error 0x%X, using sprite font instead", font_name, type, error);
   250 }
   251 }
   251 
   252 
   252 
   253