From 8599041ce4a5ba242d72b0ff2a4b10c8e9d3b1c0 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sat, 17 Dec 2022 23:58:29 +0000 Subject: [PATCH] Fix: GetDefaultFontHeight() is static, don't use -> --- src/fontcache/freetypefontcache.cpp | 4 ++-- src/fontcache/spritefontcache.cpp | 8 ++++---- src/os/macosx/font_osx.cpp | 4 ++-- src/os/windows/font_win32.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fontcache/freetypefontcache.cpp b/src/fontcache/freetypefontcache.cpp index 29650f3d22..26087eee99 100644 --- a/src/fontcache/freetypefontcache.cpp +++ b/src/fontcache/freetypefontcache.cpp @@ -65,14 +65,14 @@ void FreeTypeFontCache::SetFontSize(FontSize fs, FT_Face face, int pixels) { if (pixels == 0) { /* Try to determine a good height based on the minimal height recommended by the font. */ - int scaled_height = ScaleGUITrad(this->GetDefaultFontHeight(this->fs)); + int scaled_height = ScaleGUITrad(FontCache::GetDefaultFontHeight(this->fs)); pixels = scaled_height; TT_Header *head = (TT_Header *)FT_Get_Sfnt_Table(this->face, ft_sfnt_head); if (head != nullptr) { /* Font height is minimum height plus the difference between the default * height for this font size and the small size. */ - int diff = scaled_height - ScaleGUITrad(this->GetDefaultFontHeight(FS_SMALL)); + int diff = scaled_height - ScaleGUITrad(FontCache::GetDefaultFontHeight(FS_SMALL)); /* Clamp() is not used as scaled_height could be greater than MAX_FONT_SIZE, which is not permitted in Clamp(). */ pixels = std::min(std::max(std::min(head->Lowest_Rec_PPEM, MAX_FONT_MIN_REC_SIZE) + diff, scaled_height), MAX_FONT_SIZE); } diff --git a/src/fontcache/spritefontcache.cpp b/src/fontcache/spritefontcache.cpp index 373187952e..2a2f3ed9fd 100644 --- a/src/fontcache/spritefontcache.cpp +++ b/src/fontcache/spritefontcache.cpp @@ -28,8 +28,8 @@ static const int ASCII_LETTERSTART = 32; ///< First printable ASCII letter. SpriteFontCache::SpriteFontCache(FontSize fs) : FontCache(fs), glyph_to_spriteid_map(nullptr) { this->InitializeUnicodeGlyphMap(); - this->height = ScaleGUITrad(this->GetDefaultFontHeight(this->fs)); - this->ascender = (this->height - ScaleSpriteTrad(this->GetDefaultFontHeight(this->fs))) / 2; + this->height = ScaleGUITrad(FontCache::GetDefaultFontHeight(this->fs)); + this->ascender = (this->height - ScaleSpriteTrad(FontCache::GetDefaultFontHeight(this->fs))) / 2; } /** @@ -105,8 +105,8 @@ void SpriteFontCache::ClearGlyphToSpriteMap() void SpriteFontCache::ClearFontCache() { Layouter::ResetFontCache(this->fs); - this->height = ScaleGUITrad(this->GetDefaultFontHeight(this->fs)); - this->ascender = (this->height - ScaleSpriteTrad(this->GetDefaultFontHeight(this->fs))) / 2; + this->height = ScaleGUITrad(FontCache::GetDefaultFontHeight(this->fs)); + this->ascender = (this->height - ScaleSpriteTrad(FontCache::GetDefaultFontHeight(this->fs))) / 2; } const Sprite *SpriteFontCache::GetGlyph(GlyphID key) diff --git a/src/os/macosx/font_osx.cpp b/src/os/macosx/font_osx.cpp index b3b4f306db..1ad4352004 100644 --- a/src/os/macosx/font_osx.cpp +++ b/src/os/macosx/font_osx.cpp @@ -173,7 +173,7 @@ void CoreTextFontCache::SetFontSize(int pixels) { if (pixels == 0) { /* Try to determine a good height based on the height recommended by the font. */ - int scaled_height = ScaleGUITrad(this->GetDefaultFontHeight(this->fs)); + int scaled_height = ScaleGUITrad(FontCache::GetDefaultFontHeight(this->fs)); pixels = scaled_height; CFAutoRelease font(CTFontCreateWithFontDescriptor(this->font_desc.get(), 0.0f, nullptr)); @@ -197,7 +197,7 @@ void CoreTextFontCache::SetFontSize(int pixels) /* Font height is minimum height plus the difference between the default * height for this font size and the small size. */ - int diff = scaled_height - ScaleGUITrad(this->GetDefaultFontHeight(FS_SMALL)); + int diff = scaled_height - ScaleGUITrad(FontCache::GetDefaultFontHeight(FS_SMALL)); /* Clamp() is not used as scaled_height could be greater than MAX_FONT_SIZE, which is not permitted in Clamp(). */ pixels = std::min(std::max(std::min(min_size, MAX_FONT_MIN_REC_SIZE) + diff, scaled_height), MAX_FONT_SIZE); } diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp index 962595a016..52d63b6938 100644 --- a/src/os/windows/font_win32.cpp +++ b/src/os/windows/font_win32.cpp @@ -392,7 +392,7 @@ void Win32FontCache::SetFontSize(FontSize fs, int pixels) { if (pixels == 0) { /* Try to determine a good height based on the minimal height recommended by the font. */ - int scaled_height = ScaleGUITrad(this->GetDefaultFontHeight(this->fs)); + int scaled_height = ScaleGUITrad(FontCache::GetDefaultFontHeight(this->fs)); pixels = scaled_height; HFONT temp = CreateFontIndirect(&this->logfont); @@ -405,7 +405,7 @@ void Win32FontCache::SetFontSize(FontSize fs, int pixels) /* Font height is minimum height plus the difference between the default * height for this font size and the small size. */ - int diff = scaled_height - ScaleGUITrad(this->GetDefaultFontHeight(FS_SMALL)); + int diff = scaled_height - ScaleGUITrad(FontCache::GetDefaultFontHeight(FS_SMALL)); /* Clamp() is not used as scaled_height could be greater than MAX_FONT_SIZE, which is not permitted in Clamp(). */ pixels = std::min(std::max(std::min(otm->otmusMinimumPPEM, MAX_FONT_MIN_REC_SIZE) + diff, scaled_height), MAX_FONT_SIZE);