mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 22:52:34 +01:00
byuu says: Changelog: - return open bus instead of mirroring addresses on the bus (fixes Mario&Luigi, Minish Cap, etc) [Jonas Quinn] - add boolean flag to load requests for slotted game carts (fixes slot load prompts) - rename BS-X Town cart from psram to ram - icarus: add support for game database Note: I didn't rename "bsx" to "mcc" in the database for icarus before uploading that. But I just fixed it locally, so it'll be in the next WIP. For now, make it create the manifest for you and then rename it yourself. I did fix the PSRAM size to 256kbit.
38 lines
991 B
C++
38 lines
991 B
C++
#if defined(Hiro_Font)
|
|
|
|
namespace hiro {
|
|
|
|
auto pFont::size(const Font& font, const string& text) -> Size {
|
|
return pFont::size(pFont::create(font), text);
|
|
}
|
|
|
|
auto pFont::size(const QFont& qtFont, const string& text) -> Size {
|
|
QFontMetrics metrics(qtFont);
|
|
signed maxWidth = 0;
|
|
auto lines = text.split("\n");
|
|
for(auto& line : lines) {
|
|
maxWidth = max(maxWidth, metrics.width(QString::fromUtf8(line)));
|
|
}
|
|
return {maxWidth, metrics.height() * (signed)lines.size()};
|
|
}
|
|
|
|
auto pFont::family(const string& family) -> QString {
|
|
if(family == Font::Sans ) return "Sans";
|
|
if(family == Font::Serif) return "Serif";
|
|
if(family == Font::Mono ) return "Liberation Mono";
|
|
return family ? QString::fromUtf8(family) : "Sans";
|
|
}
|
|
|
|
auto pFont::create(const Font& font) -> QFont {
|
|
QFont qtFont;
|
|
qtFont.setFamily(family(font.family()));
|
|
qtFont.setPointSize(font.size() ? font.size() : 8);
|
|
qtFont.setBold(font.bold());
|
|
qtFont.setItalic(font.italic());
|
|
return qtFont;
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|