1
0
Fork 0

Codechange: OS-specific data for font search is not used outside of searching.

pull/8671/head
Michael Lutz 2021-01-04 15:20:34 +01:00
parent 84636fc2af
commit 2b0200d429
4 changed files with 2 additions and 9 deletions

View File

@ -217,7 +217,7 @@ struct FreeTypeSubSetting {
uint size; ///< The (requested) size of the font. uint size; ///< The (requested) size of the font.
bool aa; ///< Whether to do anti aliasing or not. bool aa; ///< Whether to do anti aliasing or not.
const void *os_handle = nullptr; ///< Optional native OS font info. const void *os_handle = nullptr; ///< Optional native OS font info. Only valid during font search.
}; };
/** Settings for the freetype fonts. */ /** Settings for the freetype fonts. */

View File

@ -344,9 +344,7 @@ static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *logfont, const NEWTEXT
const char *english_name = font_name; const char *english_name = font_name;
#endif /* WITH_FREETYPE */ #endif /* WITH_FREETYPE */
PLOGFONT os_data = MallocT<LOGFONT>(1); info->callback->SetFontNames(info->settings, font_name, &logfont->elfLogFont);
*os_data = logfont->elfLogFont;
info->callback->SetFontNames(info->settings, font_name, os_data);
if (info->callback->FindMissingGlyphs()) return 1; if (info->callback->FindMissingGlyphs()) return 1;
DEBUG(freetype, 1, "Fallback font: %s (%s)", font_name, english_name); DEBUG(freetype, 1, "Fallback font: %s (%s)", font_name, english_name);
return 0; // stop enumerating return 0; // stop enumerating

View File

@ -2078,7 +2078,6 @@ class LanguagePackGlyphSearcher : public MissingGlyphSearcher {
strecpy(settings->medium.font, font_name, lastof(settings->medium.font)); strecpy(settings->medium.font, font_name, lastof(settings->medium.font));
strecpy(settings->large.font, font_name, lastof(settings->large.font)); strecpy(settings->large.font, font_name, lastof(settings->large.font));
free(settings->medium.os_handle); // Only free one, they are all the same pointer.
settings->small.os_handle = os_data; settings->small.os_handle = os_data;
settings->medium.os_handle = os_data; settings->medium.os_handle = os_data;
settings->large.os_handle = os_data; settings->large.os_handle = os_data;
@ -2116,9 +2115,6 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
bad_font = !SetFallbackFont(&_freetype, _langpack.langpack->isocode, _langpack.langpack->winlangid, searcher); bad_font = !SetFallbackFont(&_freetype, _langpack.langpack->isocode, _langpack.langpack->winlangid, searcher);
free(_freetype.mono.os_handle);
free(_freetype.medium.os_handle);
memcpy(&_freetype, &backup, sizeof(backup)); memcpy(&_freetype, &backup, sizeof(backup));
if (!bad_font) { if (!bad_font) {

View File

@ -196,7 +196,6 @@ void TextfileWindow::SetupScrollbars()
{ {
#if defined(WITH_FREETYPE) || defined(_WIN32) #if defined(WITH_FREETYPE) || defined(_WIN32)
strecpy(settings->mono.font, font_name, lastof(settings->mono.font)); strecpy(settings->mono.font, font_name, lastof(settings->mono.font));
free(settings->mono.os_handle);
settings->mono.os_handle = os_data; settings->mono.os_handle = os_data;
#endif #endif
} }