Fix C89_BUILD

This commit is contained in:
twinaphex 2021-02-03 10:11:33 +01:00
parent 55410cf407
commit c40943374b
2 changed files with 38 additions and 22 deletions

View File

@ -249,24 +249,34 @@ static void *font_renderer_ft_init(const char *font_path, float font_size)
/* if fallback font is requested, instead of loading it, we find the full font in the system */
if (!*font_path || strstr(font_path, "fallback"))
{
FcValue locale_boxed;
FcPattern *found = NULL;
FcConfig* config = FcInitLoadConfigAndFonts();
FcResult result = FcResultNoMatch;
FcChar8* font_path = NULL;
int face_index = 0;
/* select Sans fonts */
FcPattern* pattern = FcNameParse((const FcChar8*)"Sans");
/* since fontconfig uses LL-TT style, we need to normalize locale names */
/* since fontconfig uses LL-TT style, we need to normalize
* locale names */
FcChar8* locale = FcLangNormalize((const FcChar8*)get_user_language_iso639_1(false));
/* box the locale data in a FcValue container */
FcValue locale_boxed = {.type = FcTypeString, {locale}};
/* configure fontconfig substitute policies, this will increase the search scope */
/* configure fontconfig substitute policies, this
* will increase the search scope */
FcConfigSubstitute(config, pattern, FcMatchPattern);
/* pull in system-wide defaults, so the font selection respects system (or user) configurations */
/* pull in system-wide defaults, so the
* font selection respects system (or user) configurations */
FcDefaultSubstitute(pattern);
/* override locale settins, since we are not using the system locale */
/* Box the locale data in a FcValue container */
locale_boxed.type = FcTypeString;
locale_boxed.u.s = locale;
/* Override locale settins, since we are not using the system locale */
FcPatternAdd(pattern, FC_LANG, locale_boxed, false);
/* let's find the best matching font given our search criteria */
FcPattern* found = FcFontMatch(config, pattern, &result);
/* Let's find the best matching font given our search criteria */
found = FcFontMatch(config, pattern, &result);
/* uh-oh, for some reason, we can't find any font */
if (result != FcResultMatch)
goto error;
@ -274,14 +284,18 @@ static void *font_renderer_ft_init(const char *font_path, float font_size)
goto error;
if (FcPatternGetInteger(found, FC_INDEX, 0, &face_index) != FcResultMatch)
goto error;
/* initialize font renderer */
err = FT_New_Face(handle->lib, (const char*)font_path, face_index, &handle->face);
/* Initialize font renderer */
err = FT_New_Face(handle->lib, (const char*)font_path,
face_index, &handle->face);
/* free up fontconfig internal structures */
FcPatternDestroy(pattern);
FcPatternDestroy(found);
FcStrFree(locale);
FcConfigDestroy(config);
} else
}
else
#endif
{
if (!path_is_valid(font_path))

View File

@ -292,6 +292,7 @@ static int action_get_title_dropdown_item(
(enum_idx < MENU_ENUM_LABEL_INPUT_PLAYER_ANALOG_DPAD_MODE_LAST))
enum_idx = MENU_ENUM_LABEL_VALUE_INPUT_ADC_TYPE;
{
const char *title = msg_hash_to_str(enum_idx);
if (s && !string_is_empty(title))
@ -300,6 +301,7 @@ static int action_get_title_dropdown_item(
return 1;
}
}
}
break;
}
}