Cleanup: Remove GetUnitsPerEM and units_per_em. (#12656)

GetUnitsPerEM is never called.
This commit is contained in:
Peter Nelson 2024-05-11 14:50:34 +01:00 committed by GitHub
parent 721cd2b8ad
commit d78f39a9df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 1 additions and 12 deletions

View File

@ -33,8 +33,7 @@ FontCacheSettings _fcsettings;
* @param fs The size of the font.
*/
FontCache::FontCache(FontSize fs) : parent(FontCache::Get(fs)), fs(fs), height(_default_font_height[fs]),
ascender(_default_font_ascender[fs]), descender(_default_font_ascender[fs] - _default_font_height[fs]),
units_per_em(1)
ascender(_default_font_ascender[fs]), descender(_default_font_ascender[fs] - _default_font_height[fs])
{
assert(this->parent == nullptr || this->fs == this->parent->fs);
FontCache::caches[this->fs] = this;

View File

@ -26,7 +26,6 @@ protected:
int height; ///< The height of the font.
int ascender; ///< The ascender value of the font.
int descender; ///< The descender value of the font.
int units_per_em; ///< The units per EM value of the font.
public:
FontCache(FontSize fs);
@ -60,12 +59,6 @@ public:
*/
inline int GetDescender() const{ return this->descender; }
/**
* Get the units per EM value of the font.
* @return The units per EM value of the font.
*/
inline int GetUnitsPerEM() const { return this->units_per_em; }
/**
* Get the nominal font size of the font.
* @return The nominal font size.

View File

@ -105,7 +105,6 @@ void FreeTypeFontCache::SetFontSize(FontSize, FT_Face, int pixels)
}
if (err == FT_Err_Ok) {
this->units_per_em = this->face->units_per_EM;
this->ascender = this->face->size->metrics.ascender >> 6;
this->descender = this->face->size->metrics.descender >> 6;
this->height = this->ascender - this->descender;

View File

@ -166,7 +166,6 @@ void CoreTextFontCache::SetFontSize(int pixels)
/* Query the font metrics we needed. We generally round all values up to
* make sure we don't inadvertently cut off a row or column of pixels,
* except when determining glyph to glyph advances. */
this->units_per_em = CTFontGetUnitsPerEm(this->font.get());
this->ascender = (int)std::ceil(CTFontGetAscent(this->font.get()));
this->descender = -(int)std::ceil(CTFontGetDescent(this->font.get()));
this->height = this->ascender - this->descender;

View File

@ -168,7 +168,6 @@ void Win32FontCache::SetFontSize(int pixels)
POUTLINETEXTMETRIC otm = (POUTLINETEXTMETRIC)new BYTE[otmSize];
GetOutlineTextMetrics(this->dc, otmSize, otm);
this->units_per_em = otm->otmEMSquare;
this->ascender = otm->otmTextMetrics.tmAscent;
this->descender = otm->otmTextMetrics.tmDescent;
this->height = this->ascender + this->descender;