Some minor font sizing improvements.

Also fixed a few implicit casts.
This commit is contained in:
Leon Styhre 2022-10-25 01:20:31 +02:00
parent 97a9347d67
commit 4513b20339
3 changed files with 6 additions and 6 deletions

View file

@ -1187,8 +1187,7 @@ void SystemView::legacyApplyTheme(const std::shared_ptr<ThemeData>& theme)
std::floor(mPrimary->getPosition().y) + mPrimary->getSize().y);
mLegacySystemInfo->setBackgroundColor(0xDDDDDDD8);
mLegacySystemInfo->setRenderBackground(true);
mLegacySystemInfo->setFont(
Font::get(static_cast<int>(0.035f * mSize.y), Font::getDefaultPath()));
mLegacySystemInfo->setFont(Font::get(0.035f * mSize.y, Font::getDefaultPath()));
mLegacySystemInfo->setColor(0x000000FF);
mLegacySystemInfo->setUppercase(true);
mLegacySystemInfo->setZIndex(50.0f);

View file

@ -121,7 +121,7 @@ void SliderComponent::setValue(float value)
void SliderComponent::onSizeChanged()
{
if (!mSuffix.empty())
mFont = Font::get(static_cast<int>(mSize.y), FONT_PATH_LIGHT);
mFont = Font::get(mSize.y, FONT_PATH_LIGHT);
onValueChanged();
}

View file

@ -413,7 +413,7 @@ glm::vec2 Font::getWrappedTextCursorOffset(const std::string& wrappedText,
float Font::getLetterHeight()
{
if (mLetterHeight == 0.0f)
return mFontSize * 0.737; // Only needed if face does not contain the letter 'S'.
return mFontSize * 0.737f; // Only needed if face does not contain the letter 'S'.
else
return mLetterHeight;
}
@ -593,7 +593,8 @@ Font::FontFace::FontFace(ResourceData&& d, float size, const std::string& path)
// Even though a fractional font size can be requested, the glyphs will always be rounded
// to integers. It's not useless to call FT_Set_Char_Size() instead of FT_Set_Pixel_Sizes()
// though as the glyphs will still be much more evenely sized across different resolutions.
FT_Set_Char_Size(face, 0.0f, size * 64.0f, 0, 0);
FT_Set_Char_Size(face, static_cast<FT_F26Dot6>(0.0f), static_cast<FT_F26Dot6>(size * 64.0f), 0,
0);
}
Font::FontFace::~FontFace()
@ -659,7 +660,7 @@ void Font::getTextureForNewGlyph(const glm::ivec2& glyphSize,
return; // Yes.
}
mTextures.emplace_back(std::make_unique<FontTexture>(mFontSize));
mTextures.emplace_back(std::make_unique<FontTexture>(static_cast<int>(std::round(mFontSize))));
tex_out = mTextures.back().get();
tex_out->initTexture();