|
|
@ -173,7 +173,7 @@ void CoreTextFontCache::SetFontSize(int pixels)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (pixels == 0) {
|
|
|
|
if (pixels == 0) {
|
|
|
|
/* Try to determine a good height based on the height recommended by the font. */
|
|
|
|
/* 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;
|
|
|
|
pixels = scaled_height;
|
|
|
|
|
|
|
|
|
|
|
|
CFAutoRelease<CTFontRef> font(CTFontCreateWithFontDescriptor(this->font_desc.get(), 0.0f, nullptr));
|
|
|
|
CFAutoRelease<CTFontRef> 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
|
|
|
|
/* Font height is minimum height plus the difference between the default
|
|
|
|
* height for this font size and the small size. */
|
|
|
|
* 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(). */
|
|
|
|
/* 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<int>(min_size, MAX_FONT_MIN_REC_SIZE) + diff, scaled_height), MAX_FONT_SIZE);
|
|
|
|
pixels = std::min(std::max(std::min<int>(min_size, MAX_FONT_MIN_REC_SIZE) + diff, scaled_height), MAX_FONT_SIZE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|