mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Cleanup: Remove GetUnitsPerEM and units_per_em. (#12656)
GetUnitsPerEM is never called.
This commit is contained in:
parent
721cd2b8ad
commit
d78f39a9df
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user