diff --git a/src/fontcache/freetypefontcache.cpp b/src/fontcache/freetypefontcache.cpp index b2c1fccd36..69b88fb20c 100644 --- a/src/fontcache/freetypefontcache.cpp +++ b/src/fontcache/freetypefontcache.cpp @@ -220,15 +220,6 @@ public: _ft_library = nullptr; } - /** - * Loads the freetype font. - * First try to load the fontname as if it were a path. If that fails, - * try to resolve the filename of the font using fontconfig, where the - * format is 'font family name' or 'font family name, font style'. - * @param fs The font size to load. - * @param fonttype The type of font that is requested to be loaded. - * @return The loaded font, or \c nullptr when none could be loaded. - */ std::unique_ptr LoadFont(FontSize fs, FontType fonttype) const override { if (fonttype != FontType::TrueType) return nullptr; diff --git a/src/os/macosx/font_osx.cpp b/src/os/macosx/font_osx.cpp index 4fb5234e29..73f3174a31 100644 --- a/src/os/macosx/font_osx.cpp +++ b/src/os/macosx/font_osx.cpp @@ -200,14 +200,6 @@ class CoreTextFontCacheFactory : public FontCacheFactory { public: CoreTextFontCacheFactory() : FontCacheFactory("coretext", "CoreText font loader") {} - /** - * Loads the TrueType font. - * If a CoreText font description is present, e.g. from the automatic font - * fallback search, use it. Otherwise, try to resolve it by font name. - * @param fs The font size to load. - * @param fonttype The type of font that is being loaded. - * @return FontCache of the font if loaded, or \c nullptr. - */ std::unique_ptr LoadFont(FontSize fs, FontType fonttype) const override { if (fonttype != FontType::TrueType) return nullptr; diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp index 9c6843a05e..74c6487064 100644 --- a/src/os/windows/font_win32.cpp +++ b/src/os/windows/font_win32.cpp @@ -270,14 +270,6 @@ class Win32FontCacheFactory : FontCacheFactory { public: Win32FontCacheFactory() : FontCacheFactory("win32", "Win32 font loader") {} - /** - * Loads the GDI font. - * If a GDI font description is present, e.g. from the automatic font - * fallback search, use it. Otherwise, try to resolve it by font name. - * @param fs The font size to load. - * @param fonttype The type of font that is being loaded. - * @return FontCache of the font if loaded, or \c nullptr. - */ std::unique_ptr LoadFont(FontSize fs, FontType fonttype) const override { if (fonttype != FontType::TrueType) return nullptr; @@ -293,6 +285,8 @@ public: logfont.lfOutPrecision = OUT_OUTLINE_PRECIS; logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS; + /* If a GDI font description is present, e.g. from the automatic font + * fallback search, use it. Otherwise, try to resolve it by font name. */ if (settings->os_handle != nullptr) { logfont = *(const LOGFONT *)settings->os_handle; } else if (font.find('.') != std::string::npos) { @@ -348,6 +342,12 @@ private: return std::make_unique(fs, logfont, size); } + /** + * Try to load a font by filename. + * @param font_name Filename to load. + * @param[out] logfont OS handle to update if font is found. + * @return true iff the font filename was found. + */ static bool TryLoadFontFromFile(const std::string &font_name, LOGFONT &logfont) { wchar_t fontPath[MAX_PATH] = {};