add 3 large fonts (Terminus 12x24, 14x28 and 16x32)

use 12x24 font for R77 (launcher and dialogs)
improve font selection for ROM info viewer
minor fix for convbdf.c
This commit is contained in:
thrust26 2020-03-15 17:16:37 +01:00
parent a623843d37
commit d3ff85cf1f
10 changed files with 19076 additions and 34 deletions

View File

@ -39,6 +39,9 @@
#include "ConsoleMediumBFont.hxx" #include "ConsoleMediumBFont.hxx"
#include "StellaMediumFont.hxx" #include "StellaMediumFont.hxx"
#include "StellaLargeFont.hxx" #include "StellaLargeFont.hxx"
#include "Stella12x24tFont.hxx"
#include "Stella14x28tFont.hxx"
#include "Stella16x32tFont.hxx"
#include "ConsoleFont.hxx" #include "ConsoleFont.hxx"
#include "ConsoleBFont.hxx" #include "ConsoleBFont.hxx"
#include "Launcher.hxx" #include "Launcher.hxx"
@ -113,9 +116,9 @@ bool FrameBuffer::initialize()
// The general font used in all UI elements // The general font used in all UI elements
// This is determined by the size of the framebuffer // This is determined by the size of the framebuffer
if(myOSystem.settings().getBool("minimal_ui")) if(myOSystem.settings().getBool("minimal_ui"))
myFont = make_unique<GUI::Font>(GUI::stellaLargeDesc); myFont = make_unique<GUI::Font>(GUI::stella12x24tDesc); // 12x24
else else
myFont = make_unique<GUI::Font>(GUI::stellaMediumDesc); myFont = make_unique<GUI::Font>(GUI::stellaMediumDesc); // 9x18
// The info font used in all UI elements // The info font used in all UI elements
// This is determined by the size of the framebuffer // This is determined by the size of the framebuffer
@ -125,12 +128,18 @@ bool FrameBuffer::initialize()
const string& lf = myOSystem.settings().getString("launcherfont"); const string& lf = myOSystem.settings().getString("launcherfont");
if(lf == "small") if(lf == "small")
myLauncherFont = make_unique<GUI::Font>(GUI::consoleBDesc); // 8x13 myLauncherFont = make_unique<GUI::Font>(GUI::consoleBDesc); // 8x13
else if(lf == "small_medium") else if(lf == "low_medium")
myLauncherFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc); // 9x15 myLauncherFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc); // 9x15
else if(lf == "medium") else if(lf == "medium")
myLauncherFont = make_unique<GUI::Font>(GUI::stellaMediumDesc); // 9x18 myLauncherFont = make_unique<GUI::Font>(GUI::stellaMediumDesc); // 9x18
else else if(lf == "large" || lf == "large10")
myLauncherFont = make_unique<GUI::Font>(GUI::stellaLargeDesc); // 10x20 myLauncherFont = make_unique<GUI::Font>(GUI::stellaLargeDesc); // 10x20
else if(lf == "large12")
myLauncherFont = make_unique<GUI::Font>(GUI::stella12x24tDesc); // 12x24
else if(lf == "large14")
myLauncherFont = make_unique<GUI::Font>(GUI::stella14x28tDesc); // 14x28
else // "large16"
myLauncherFont = make_unique<GUI::Font>(GUI::stella16x32tDesc); // 16x32
#endif #endif
// Determine possible TIA windowed zoom levels // Determine possible TIA windowed zoom levels

View File

@ -342,7 +342,8 @@ void Settings::validate()
setValue("palette", "standard"); setValue("palette", "standard");
s = getString("launcherfont"); s = getString("launcherfont");
if(s != "small" && s != "small_medium" && s != "medium" && s != "large") if(s != "small" && s != "low_medium" && s != "medium" && s != "large"
&& s != "large12" && s != "large14" && s != "large16")
setValue("launcherfont", "medium"); setValue("launcherfont", "medium");
s = getString("dbg.fontsize"); s = getString("dbg.fontsize");

View File

@ -41,6 +41,14 @@
#include "Settings.hxx" #include "Settings.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "Font.hxx" #include "Font.hxx"
#include "StellaFont.hxx"
#include "ConsoleBFont.hxx"
#include "ConsoleMediumBFont.hxx"
#include "StellaMediumFont.hxx"
#include "StellaLargeFont.hxx"
#include "Stella12x24tFont.hxx"
#include "Stella14x28tFont.hxx"
#include "Stella16x32tFont.hxx"
#include "Version.hxx" #include "Version.hxx"
#include "LauncherDialog.hxx" #include "LauncherDialog.hxx"
@ -146,9 +154,9 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// Calculate font area, and in the process the font that can be used // Calculate font area, and in the process the font that can be used
Common::Size fontArea(romWidth - 16, myList->getHeight() - imgSize.h - 12); Common::Size fontArea(romWidth - 16, myList->getHeight() - imgSize.h - 12);
const GUI::Font& rominfoFont = getRomInfoFont(fontArea);
myRomInfoWidget = new RomInfoWidget(this, rominfoFont, setRomInfoFont(fontArea);
myRomInfoWidget = new RomInfoWidget(this, *myROMInfoFont,
xpos, ypos, romWidth, myList->getHeight(), imgSize); xpos, ypos, romWidth, myList->getHeight(), imgSize);
} }
@ -365,25 +373,32 @@ float LauncherDialog::getRomInfoZoom(int listHeight) const
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const GUI::Font& LauncherDialog::getRomInfoFont(const Common::Size& area) const void LauncherDialog::setRomInfoFont(const Common::Size& area)
{ {
// TODO: Perhaps offer a setting to override the font used? // TODO: Perhaps offer a setting to override the font used?
FontDesc FONTS[7] = {
GUI::stella16x32tDesc, GUI::stella14x28tDesc, GUI::stella12x24tDesc,
GUI::stellaLargeDesc, GUI::stellaMediumDesc,
GUI::consoleMediumBDesc, GUI::consoleBDesc
};
// Try to pick a font that works best, based on the available area // Try to pick a font that works best, based on the available area
if(area.h >= uInt32(MIN_ROMINFO_ROWS * instance().frameBuffer().launcherFont().getLineHeight() for(int i = 0; i < sizeof(FONTS) / sizeof(FontDesc); ++i)
+ MIN_ROMINFO_LINES * instance().frameBuffer().launcherFont().getFontHeight()) {
&& area.w >= uInt32(MIN_ROMINFO_CHARS * instance().frameBuffer().launcherFont().getMaxCharWidth())) // only use fonts <= launcher fonts
return instance().frameBuffer().launcherFont(); if(instance().frameBuffer().launcherFont().getFontHeight() >= FONTS[i].height)
else if(area.h >= uInt32(MIN_ROMINFO_ROWS * instance().frameBuffer().font().getLineHeight() {
+ MIN_ROMINFO_LINES * instance().frameBuffer().font().getFontHeight()) if(area.h >= uInt32(MIN_ROMINFO_ROWS * FONTS[i].height + 2
&& area.w >= uInt32(MIN_ROMINFO_CHARS * instance().frameBuffer().font().getMaxCharWidth())) + MIN_ROMINFO_LINES * FONTS[i].height)
return instance().frameBuffer().font(); && area.w >= uInt32(MIN_ROMINFO_CHARS * FONTS[i].maxwidth))
else if(area.h >= uInt32(MIN_ROMINFO_ROWS * instance().frameBuffer().infoFont().getLineHeight() {
+ MIN_ROMINFO_LINES * instance().frameBuffer().infoFont().getFontHeight()) myROMInfoFont = make_unique<GUI::Font>(FONTS[i]);
&& area.w >= uInt32(MIN_ROMINFO_CHARS * instance().frameBuffer().infoFont().getMaxCharWidth())) return;
return instance().frameBuffer().infoFont(); }
else }
return instance().frameBuffer().smallFont(); }
myROMInfoFont = make_unique<GUI::Font>(GUI::stellaDesc);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -104,7 +104,7 @@ class LauncherDialog : public Dialog
void applyFiltering(); void applyFiltering();
float getRomInfoZoom(int listHeight) const; float getRomInfoZoom(int listHeight) const;
const GUI::Font& getRomInfoFont(const Common::Size& area) const; void setRomInfoFont(const Common::Size& area);
void loadRom(); void loadRom();
void loadRomInfo(); void loadRomInfo();
@ -119,6 +119,9 @@ class LauncherDialog : public Dialog
unique_ptr<GlobalPropsDialog> myGlobalProps; unique_ptr<GlobalPropsDialog> myGlobalProps;
unique_ptr<BrowserDialog> myRomDir; unique_ptr<BrowserDialog> myRomDir;
// automatically sized font for ROM info viewer
unique_ptr<GUI::Font> myROMInfoFont;
ButtonWidget* myStartButton{nullptr}; ButtonWidget* myStartButton{nullptr};
ButtonWidget* myPrevDirButton{nullptr}; ButtonWidget* myPrevDirButton{nullptr};
ButtonWidget* myOptionsButton{nullptr}; ButtonWidget* myOptionsButton{nullptr};

5553
src/gui/Stella12x24tFont.hxx Normal file

File diff suppressed because it is too large Load Diff

6337
src/gui/Stella14x28tFont.hxx Normal file

File diff suppressed because it is too large Load Diff

7121
src/gui/Stella16x32tFont.hxx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -216,10 +216,13 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
// Launcher font // Launcher font
pwidth = font.getStringWidth("2x (1000x760)"); pwidth = font.getStringWidth("2x (1000x760)");
items.clear(); items.clear();
VarList::push_back(items, "Small", "small"); VarList::push_back(items, "Small", "small"); // 8x13
VarList::push_back(items, "Small Medium", "small_medium"); VarList::push_back(items, "Low Medium", "low_medium"); // 9x15
VarList::push_back(items, "Medium", "medium"); VarList::push_back(items, "Medium", "medium"); // 9x18
VarList::push_back(items, "Large", "large"); VarList::push_back(items, "Large (10pt)", "large"); // 10x20
VarList::push_back(items, "Large (12pt)", "large12"); // 12x24
VarList::push_back(items, "Large (14pt)", "large14"); // 14x28
VarList::push_back(items, "Large (16pt)", "large16"); // 16x32
myLauncherFontPopup = myLauncherFontPopup =
new PopUpWidget(myTab, font, xpos, ypos + 1, pwidth, lineHeight, items, new PopUpWidget(myTab, font, xpos, ypos + 1, pwidth, lineHeight, items,
"Launcher font ", lwidth); "Launcher font ", lwidth);

View File

@ -980,7 +980,7 @@ int gen_c_source(struct font* pf, char *path)
fontname); fontname);
fprintf(ofp, "\n} // End of namespace GUI\n\n#endif\n"); fprintf(ofp, "\n} // End of namespace GUI\n\n#endif\n");
fcloise(ofp); fclose(ofp);
return 0; return 0;
} }

View File

@ -50,7 +50,7 @@ SettingsR77::SettingsR77()
setPermanent("snaploaddir", "/mnt/stella/snapshots"); setPermanent("snaploaddir", "/mnt/stella/snapshots");
setPermanent("launcherres", "1280x720"); setPermanent("launcherres", "1280x720");
setPermanent("launcherfont", "large"); setPermanent("launcherfont", "large12");
setPermanent("romviewer", "1.6"); setPermanent("romviewer", "1.6");
setPermanent("exitlauncher", "true"); setPermanent("exitlauncher", "true");