(Freetype) Fix warnings 'local variable hides a parameter of the same name'
This commit is contained in:
parent
98ca6232aa
commit
37bb66ef6e
|
@ -259,25 +259,27 @@ static void *font_renderer_ft_init(const char *font_path, float font_size)
|
||||||
calloc(1, sizeof(*handle));
|
calloc(1, sizeof(*handle));
|
||||||
|
|
||||||
if (!handle)
|
if (!handle)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (font_size < 1.0)
|
if (font_size < 1.0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
err = FT_Init_FreeType(&handle->lib);
|
if ((err = FT_Init_FreeType(&handle->lib)))
|
||||||
if (err)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
#ifdef WIIU
|
#ifdef WIIU
|
||||||
if (!*font_path)
|
if (!*font_path)
|
||||||
{
|
{
|
||||||
void* font_data = NULL;
|
void* font_data = NULL;
|
||||||
uint32_t font_size = 0;
|
uint32_t font_data_size = 0;
|
||||||
|
|
||||||
if (!OSGetSharedData(SHARED_FONT_DEFAULT, 0, &font_data, &font_size))
|
if (!OSGetSharedData(SHARED_FONT_DEFAULT, 0,
|
||||||
|
&font_data, &font_data_size))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
err = FT_New_Memory_Face(handle->lib, (const FT_Byte*)font_data, (FT_Long)font_size, (FT_Long)0, &handle->face);
|
if ((err = FT_New_Memory_Face(handle->lib, (const FT_Byte*)font_data,
|
||||||
|
(FT_Long)font_data_size, (FT_Long)0, &handle->face)))
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#elif defined(HAVE_FONTCONFIG_SUPPORT)
|
#elif defined(HAVE_FONTCONFIG_SUPPORT)
|
||||||
|
@ -286,7 +288,7 @@ static void *font_renderer_ft_init(const char *font_path, float font_size)
|
||||||
{
|
{
|
||||||
FcValue locale_boxed;
|
FcValue locale_boxed;
|
||||||
uint8_t* font_data = NULL;
|
uint8_t* font_data = NULL;
|
||||||
int64_t font_size = 0;
|
int64_t font_data_size = 0;
|
||||||
FcPattern *found = NULL;
|
FcPattern *found = NULL;
|
||||||
FcConfig* config = FcInitLoadConfigAndFonts();
|
FcConfig* config = FcInitLoadConfigAndFonts();
|
||||||
FcResult result = FcResultNoMatch;
|
FcResult result = FcResultNoMatch;
|
||||||
|
@ -317,43 +319,49 @@ static void *font_renderer_ft_init(const char *font_path, float font_size)
|
||||||
/* uh-oh, for some reason, we can't find any font */
|
/* uh-oh, for some reason, we can't find any font */
|
||||||
if (result != FcResultMatch)
|
if (result != FcResultMatch)
|
||||||
goto error;
|
goto error;
|
||||||
if (FcPatternGetString(found, FC_FILE, 0, &_font_path) != FcResultMatch)
|
if (FcPatternGetString(found, FC_FILE, 0,
|
||||||
|
&_font_path) != FcResultMatch)
|
||||||
goto error;
|
goto error;
|
||||||
if (FcPatternGetInteger(found, FC_INDEX, 0, &face_index) != FcResultMatch)
|
if (FcPatternGetInteger(found, FC_INDEX, 0,
|
||||||
|
&face_index) != FcResultMatch)
|
||||||
goto error;
|
goto error;
|
||||||
if (!filestream_read_file((const char*)_font_path, (void**)&font_data, &font_size))
|
if (!filestream_read_file((const char*)_font_path,
|
||||||
|
(void**)&font_data,
|
||||||
|
&font_data_size))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Initialize font renderer */
|
/* Initialize font renderer */
|
||||||
err = FT_New_Memory_Face(handle->lib, (const FT_Byte*)font_data, (FT_Long)font_size, (FT_Long)face_index, &handle->face);
|
err = FT_New_Memory_Face(handle->lib, (const FT_Byte*)font_data,
|
||||||
|
(FT_Long)font_data_size, (FT_Long)face_index, &handle->face);
|
||||||
|
|
||||||
/* free up fontconfig internal structures */
|
/* free up fontconfig internal structures */
|
||||||
FcPatternDestroy(pattern);
|
FcPatternDestroy(pattern);
|
||||||
FcPatternDestroy(found);
|
FcPatternDestroy(found);
|
||||||
FcStrFree(locale);
|
FcStrFree(locale);
|
||||||
FcConfigDestroy(config);
|
FcConfigDestroy(config);
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
uint8_t* font_data = NULL;
|
uint8_t* font_data = NULL;
|
||||||
int64_t font_size = 0;
|
int64_t font_data_size = 0;
|
||||||
if (!path_is_valid(font_path))
|
if (!path_is_valid(font_path))
|
||||||
goto error;
|
goto error;
|
||||||
if (!filestream_read_file(font_path, (void**)&font_data, &font_size))
|
if (!filestream_read_file(font_path,
|
||||||
|
(void**)&font_data, &font_data_size))
|
||||||
|
goto error;
|
||||||
|
if ((err = FT_New_Memory_Face(handle->lib, (const FT_Byte*)font_data,
|
||||||
|
(FT_Long)font_data_size, (FT_Long)0, &handle->face)))
|
||||||
goto error;
|
goto error;
|
||||||
err = FT_New_Memory_Face(handle->lib, (const FT_Byte*)font_data, (FT_Long)font_size, (FT_Long)0, &handle->face);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err)
|
if ((err = FT_Select_Charmap(handle->face, FT_ENCODING_UNICODE)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
err = FT_Select_Charmap(handle->face, FT_ENCODING_UNICODE);
|
if ((err = FT_Set_Pixel_Sizes(handle->face, 0, font_size)))
|
||||||
if (err)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
err = FT_Set_Pixel_Sizes(handle->face, 0, font_size);
|
|
||||||
if (err)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!font_renderer_create_atlas(handle, font_size))
|
if (!font_renderer_create_atlas(handle, font_size))
|
||||||
|
|
Loading…
Reference in New Issue