mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-04-02 10:42:14 -04:00
byuu says: Changelog: - Emulator::Interface::videoResolution() -\> VideoResolution renamed to videoInformation() -\> VideoInformation - added double VideoInformation::refreshRate - higan: added `binary := (application|library)` — set this to `library` to produce a dynamic link library - higan: removed `-march=native` for macOS application builds; and for all library builds - higan: removed `console` build flag; uncomment `link += -mwindows` instead - nall/GNUmakefile: `macosx` platform renamed `macos` - still need to do this for nall/intrinsics.hpp - Game Gear: return region=NTSC as the only option, so that the system frequency is always set correctly - hiro/cocoa: fixed typo [Sintendo] - hiro/Windows: removed GetDpiForMonitor, as it's Windows 8+ only; DPI is no longer per-monitor aware - icarus: core Icarus class now has virtual functions for directory::create, <file::exists>, <file::copy>, <file::write> - icarus: Sufami Turbo can import save RAM files now - icarus: setting `ICARUS_LIBRARY` define will compile icarus without main(), GUI components - ruby/video/Direct3D: choose the current monitor instead of top-left monitor for fullscreen exclusive [Cydrak] - ruby/video/Direct3D: do not set `WS_EX_TOPMOST` on fullscreen exclusive window [Cydrak] - this isn't necessary for exclusive mode, and it just makes getting out of the application more difficult
37 lines
1,011 B
C++
37 lines
1,011 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(Application::scale(font.size() ? font.size() : 8));
|
|
qtFont.setBold(font.bold());
|
|
qtFont.setItalic(font.italic());
|
|
return qtFont;
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|