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 "StellaMediumFont.hxx"
#include "StellaLargeFont.hxx"
#include "Stella12x24tFont.hxx"
#include "Stella14x28tFont.hxx"
#include "Stella16x32tFont.hxx"
#include "ConsoleFont.hxx"
#include "ConsoleBFont.hxx"
#include "Launcher.hxx"
@ -113,24 +116,30 @@ bool FrameBuffer::initialize()
// The general font used in all UI elements
// This is determined by the size of the framebuffer
if(myOSystem.settings().getBool("minimal_ui"))
myFont = make_unique<GUI::Font>(GUI::stellaLargeDesc);
myFont = make_unique<GUI::Font>(GUI::stella12x24tDesc); // 12x24
else
myFont = make_unique<GUI::Font>(GUI::stellaMediumDesc);
myFont = make_unique<GUI::Font>(GUI::stellaMediumDesc); // 9x18
// The info font used in all UI elements
// This is determined by the size of the framebuffer
myInfoFont = make_unique<GUI::Font>(GUI::consoleDesc); // 8x13
myInfoFont = make_unique<GUI::Font>(GUI::consoleDesc); // 8x13
// The font used by the ROM launcher
const string& lf = myOSystem.settings().getString("launcherfont");
if(lf == "small")
myLauncherFont = make_unique<GUI::Font>(GUI::consoleBDesc); // 8x13
else if(lf == "small_medium")
myLauncherFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc); // 9x15
myLauncherFont = make_unique<GUI::Font>(GUI::consoleBDesc); // 8x13
else if(lf == "low_medium")
myLauncherFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc); // 9x15
else if(lf == "medium")
myLauncherFont = make_unique<GUI::Font>(GUI::stellaMediumDesc); // 9x18
else
myLauncherFont = make_unique<GUI::Font>(GUI::stellaLargeDesc); // 10x20
myLauncherFont = make_unique<GUI::Font>(GUI::stellaMediumDesc); // 9x18
else if(lf == "large" || lf == "large10")
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
// Determine possible TIA windowed zoom levels

View File

@ -342,7 +342,8 @@ void Settings::validate()
setValue("palette", "standard");
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");
s = getString("dbg.fontsize");

View File

@ -41,6 +41,14 @@
#include "Settings.hxx"
#include "Widget.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 "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
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);
}
@ -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?
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
if(area.h >= uInt32(MIN_ROMINFO_ROWS * instance().frameBuffer().launcherFont().getLineHeight()
+ MIN_ROMINFO_LINES * instance().frameBuffer().launcherFont().getFontHeight())
&& area.w >= uInt32(MIN_ROMINFO_CHARS * instance().frameBuffer().launcherFont().getMaxCharWidth()))
return instance().frameBuffer().launcherFont();
else if(area.h >= uInt32(MIN_ROMINFO_ROWS * instance().frameBuffer().font().getLineHeight()
+ MIN_ROMINFO_LINES * instance().frameBuffer().font().getFontHeight())
&& area.w >= uInt32(MIN_ROMINFO_CHARS * instance().frameBuffer().font().getMaxCharWidth()))
return instance().frameBuffer().font();
else if(area.h >= uInt32(MIN_ROMINFO_ROWS * instance().frameBuffer().infoFont().getLineHeight()
+ MIN_ROMINFO_LINES * instance().frameBuffer().infoFont().getFontHeight())
&& area.w >= uInt32(MIN_ROMINFO_CHARS * instance().frameBuffer().infoFont().getMaxCharWidth()))
return instance().frameBuffer().infoFont();
else
return instance().frameBuffer().smallFont();
for(int i = 0; i < sizeof(FONTS) / sizeof(FontDesc); ++i)
{
// only use fonts <= launcher fonts
if(instance().frameBuffer().launcherFont().getFontHeight() >= FONTS[i].height)
{
if(area.h >= uInt32(MIN_ROMINFO_ROWS * FONTS[i].height + 2
+ MIN_ROMINFO_LINES * FONTS[i].height)
&& area.w >= uInt32(MIN_ROMINFO_CHARS * FONTS[i].maxwidth))
{
myROMInfoFont = make_unique<GUI::Font>(FONTS[i]);
return;
}
}
}
myROMInfoFont = make_unique<GUI::Font>(GUI::stellaDesc);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -104,7 +104,7 @@ class LauncherDialog : public Dialog
void applyFiltering();
float getRomInfoZoom(int listHeight) const;
const GUI::Font& getRomInfoFont(const Common::Size& area) const;
void setRomInfoFont(const Common::Size& area);
void loadRom();
void loadRomInfo();
@ -119,6 +119,9 @@ class LauncherDialog : public Dialog
unique_ptr<GlobalPropsDialog> myGlobalProps;
unique_ptr<BrowserDialog> myRomDir;
// automatically sized font for ROM info viewer
unique_ptr<GUI::Font> myROMInfoFont;
ButtonWidget* myStartButton{nullptr};
ButtonWidget* myPrevDirButton{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
pwidth = font.getStringWidth("2x (1000x760)");
items.clear();
VarList::push_back(items, "Small", "small");
VarList::push_back(items, "Small Medium", "small_medium");
VarList::push_back(items, "Medium", "medium");
VarList::push_back(items, "Large", "large");
VarList::push_back(items, "Small", "small"); // 8x13
VarList::push_back(items, "Low Medium", "low_medium"); // 9x15
VarList::push_back(items, "Medium", "medium"); // 9x18
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 =
new PopUpWidget(myTab, font, xpos, ypos + 1, pwidth, lineHeight, items,
"Launcher font ", lwidth);

View File

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

View File

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