summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fontcache.h2
-rw-r--r--src/fontdetection.cpp4
-rw-r--r--src/strings.cpp4
-rw-r--r--src/textfile_gui.cpp1
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
}