diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-01-04 15:20:34 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-02-13 20:09:14 +0100 |
commit | 2b0200d4297a67916cf3b955adc474e88e327cf0 (patch) | |
tree | c94614a1659bc0f5213a15aae3add3588ec17ab1 | |
parent | 84636fc2af4dfc77b43479909273ebadb4f9b7cb (diff) | |
download | openttd-2b0200d4297a67916cf3b955adc474e88e327cf0.tar.xz |
Codechange: OS-specific data for font search is not used outside of searching.
-rw-r--r-- | src/fontcache.h | 2 | ||||
-rw-r--r-- | src/fontdetection.cpp | 4 | ||||
-rw-r--r-- | src/strings.cpp | 4 | ||||
-rw-r--r-- | src/textfile_gui.cpp | 1 |
4 files changed, 2 insertions, 9 deletions
diff --git a/src/fontcache.h b/src/fontcache.h index 716b3e7d7..4c44876da 100644 --- a/src/fontcache.h +++ b/src/fontcache.h @@ -217,7 +217,7 @@ struct FreeTypeSubSetting { uint size; ///< The (requested) size of the font. 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. */ diff --git a/src/fontdetection.cpp b/src/fontdetection.cpp index 570e1aa06..dfb27a35d 100644 --- a/src/fontdetection.cpp +++ b/src/fontdetection.cpp @@ -344,9 +344,7 @@ static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *logfont, const NEWTEXT const char *english_name = font_name; #endif /* WITH_FREETYPE */ - PLOGFONT os_data = MallocT<LOGFONT>(1); - *os_data = logfont->elfLogFont; - info->callback->SetFontNames(info->settings, font_name, os_data); + info->callback->SetFontNames(info->settings, font_name, &logfont->elfLogFont); if (info->callback->FindMissingGlyphs()) return 1; DEBUG(freetype, 1, "Fallback font: %s (%s)", font_name, english_name); return 0; // stop enumerating diff --git a/src/strings.cpp b/src/strings.cpp index fa039fdb9..1d6fca8b6 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -2078,7 +2078,6 @@ class LanguagePackGlyphSearcher : public MissingGlyphSearcher { strecpy(settings->medium.font, font_name, lastof(settings->medium.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->medium.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); - free(_freetype.mono.os_handle); - free(_freetype.medium.os_handle); - memcpy(&_freetype, &backup, sizeof(backup)); if (!bad_font) { diff --git a/src/textfile_gui.cpp b/src/textfile_gui.cpp index b83e38187..fd544f5fc 100644 --- a/src/textfile_gui.cpp +++ b/src/textfile_gui.cpp @@ -196,7 +196,6 @@ void TextfileWindow::SetupScrollbars() { #if defined(WITH_FREETYPE) || defined(_WIN32) strecpy(settings->mono.font, font_name, lastof(settings->mono.font)); - free(settings->mono.os_handle); settings->mono.os_handle = os_data; #endif } |