Merge branch upstream/master
This commit is contained in:
@@ -87,7 +87,6 @@ public:
|
||||
virtual void ClearFontCache();
|
||||
virtual const Sprite *GetGlyph(GlyphID key);
|
||||
virtual uint GetGlyphWidth(GlyphID key);
|
||||
virtual int GetHeight() const;
|
||||
virtual bool GetDrawGlyphShadow();
|
||||
virtual GlyphID MapCharToGlyph(WChar key) { assert(IsPrintable(key)); return SPRITE_GLYPH | key; }
|
||||
virtual const void *GetFontTable(uint32 tag, size_t &length) { length = 0; return nullptr; }
|
||||
@@ -102,6 +101,7 @@ public:
|
||||
SpriteFontCache::SpriteFontCache(FontSize fs) : FontCache(fs), glyph_to_spriteid_map(nullptr)
|
||||
{
|
||||
this->InitializeUnicodeGlyphMap();
|
||||
this->height = ScaleFontTrad(this->GetDefaultFontHeight(this->fs));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,6 +177,7 @@ void SpriteFontCache::ClearGlyphToSpriteMap()
|
||||
void SpriteFontCache::ClearFontCache()
|
||||
{
|
||||
Layouter::ResetFontCache(this->fs);
|
||||
this->height = ScaleFontTrad(this->GetDefaultFontHeight(this->fs));
|
||||
}
|
||||
|
||||
const Sprite *SpriteFontCache::GetGlyph(GlyphID key)
|
||||
@@ -193,11 +194,6 @@ uint SpriteFontCache::GetGlyphWidth(GlyphID key)
|
||||
return SpriteExists(sprite) ? GetSprite(sprite, ST_FONT)->width + ScaleFontTrad(this->fs != FS_NORMAL ? 1 : 0) : 0;
|
||||
}
|
||||
|
||||
int SpriteFontCache::GetHeight() const
|
||||
{
|
||||
return ScaleFontTrad(this->height);
|
||||
}
|
||||
|
||||
bool SpriteFontCache::GetDrawGlyphShadow()
|
||||
{
|
||||
return false;
|
||||
@@ -428,14 +424,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 = ScaleFontTrad(_default_font_height[this->fs]);
|
||||
int scaled_height = ScaleFontTrad(this->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 - ScaleFontTrad(_default_font_height[FS_SMALL]);
|
||||
int diff = scaled_height - ScaleFontTrad(this->GetDefaultFontHeight(FS_SMALL));
|
||||
pixels = Clamp(std::min<uint>(head->Lowest_Rec_PPEM, MAX_FONT_MIN_REC_SIZE) + diff, scaled_height, MAX_FONT_SIZE);
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user