mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-27 02:10:34 +00:00
Merge pull request #12725 from unknownbrackets/ppge-text
Qt: Correct DPI accounting in font rendering
This commit is contained in:
commit
b3c111399e
@ -35,7 +35,7 @@ uint32_t TextDrawerQt::SetFont(const char *fontName, int size, int flags) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QFont *font = fontName ? new QFont(fontName) : new QFont();
|
QFont *font = fontName ? new QFont(fontName) : new QFont();
|
||||||
font->setPixelSize(size + 6);
|
font->setPixelSize((int)((size + 6) / dpiScale_));
|
||||||
fontMap_[fontHash] = font;
|
fontMap_[fontHash] = font;
|
||||||
fontHash_ = fontHash;
|
fontHash_ = fontHash;
|
||||||
return fontHash;
|
return fontHash;
|
||||||
@ -85,8 +85,8 @@ void TextDrawerQt::MeasureStringRect(const char *str, size_t len, const Bounds &
|
|||||||
QFont* font = fontMap_.find(fontHash_)->second;
|
QFont* font = fontMap_.find(fontHash_)->second;
|
||||||
QFontMetrics fm(*font);
|
QFontMetrics fm(*font);
|
||||||
QSize size = fm.size(0, QString::fromUtf8(toMeasure.c_str(), (int)toMeasure.size()));
|
QSize size = fm.size(0, QString::fromUtf8(toMeasure.c_str(), (int)toMeasure.size()));
|
||||||
*w = (float)size.width() * fontScaleX_;
|
*w = (float)size.width() * fontScaleX_ * dpiScale_;
|
||||||
*h = (float)size.height() * fontScaleY_;
|
*h = (float)size.height() * fontScaleY_ * dpiScale_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextDrawerQt::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextStringEntry &entry, Draw::DataFormat texFormat, const char *str, int align) {
|
void TextDrawerQt::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextStringEntry &entry, Draw::DataFormat texFormat, const char *str, int align) {
|
||||||
|
Loading…
Reference in New Issue
Block a user