1
0
Fork 0
pull/12690/merge
ladysadie 2024-12-30 02:38:10 -08:00 committed by GitHub
commit a442cf142e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 433 additions and 86 deletions

View File

@ -2278,7 +2278,7 @@ DEF_CONSOLE_CMD(ConFont)
FontCacheSubSetting *setting = GetFontCacheSubSetting(fs);
/* Make sure all non sprite fonts are loaded. */
if (!setting->font.empty() && !fc->HasParent()) {
InitFontCache(fs == FS_MONO);
InitFontCache();
fc = FontCache::Get(fs);
}
IConsolePrint(CC_DEFAULT, "{} font:", FontSizeToName(fs));

View File

@ -28,6 +28,8 @@ static const int _default_font_ascender[FS_END] = { 8, 5, 15, 8};
FontCacheSettings _fcsettings;
static void LoadFontHelper(FontSize fs);
/**
* Create a new font cache.
* @param fs The size of the font.
@ -53,6 +55,11 @@ int FontCache::GetDefaultFontHeight(FontSize fs)
return _default_font_height[fs];
}
void FontCache::SetFontSize([[maybe_unused]] int pixels)
{
Debug(fontcache, 0, "Font {} isn't resizable.", this->GetFontName());
}
/**
* Get the font name of a given font size.
* @param fs The font size to look up.
@ -98,9 +105,81 @@ bool GetFontAAState()
return _fcsettings.global_aa;
}
void SetFont(FontSize fontsize, const std::string &font, uint size)
/**
* Prints the font name information. Output is:
*
* The provided desc.
* (FontSize Enum) : Actual Font=(string name) Setting=(string name)
* etc for all the font sizes.
*
* Actual font is what's currently loaded and in use. Setting is what is recorded in the config file.
*
* @param desc - A string used to give context for this debug print.
*/
void DebugPrintFontSettings(const std::string &desc)
{
FontCacheSubSetting *setting = GetFontCacheSubSetting(fontsize);
Debug(fontcache, 3, "{}", desc);
for (FontSize fs = FS_BEGIN; fs < FS_END; fs++) {
FontCache *loaded_font = FontCache::Get(fs);
FontCacheSubSetting *setting = GetFontCacheSubSetting(fs);
Debug(fontcache, 3, " {}: Actual Font=\"{}\" Setting=\"{}\"", FontSizeToName(fs), (loaded_font == NULL) ? "NULL" : loaded_font->GetFontName(), setting->font);
}
}
#ifdef WITH_FREETYPE
extern void LoadFreeTypeFont(FontSize fs);
extern void UninitFreeType();
#elif defined(_WIN32)
extern void LoadWin32Font(FontSize fs);
#elif defined(WITH_COCOA)
extern void LoadCoreTextFont(FontSize fs);
#endif
static void LoadFontHelper([[maybe_unused]] FontSize fs)
{
#ifdef WITH_FREETYPE
LoadFreeTypeFont(fs);
#elif defined(_WIN32)
LoadWin32Font(fs);
#elif defined(WITH_COCOA)
LoadCoreTextFont(fs);
#endif
}
/**
* Called to change the size setting of a font in OpenTTD.
* @param font_size FontSize(enum not pixel size) of the font to change.
* @param size The new pixel size to use for this font.
*/
void ResizeFont(FontSize font_size, uint size)
{
FontCacheSubSetting *setting = GetFontCacheSubSetting(font_size);
if (setting->size == size) return;
setting->size = size;
FontCache *loaded_font = FontCache::Get(font_size);
loaded_font->SetFontSize(size);
LoadStringWidthTable();
UpdateAllVirtCoords();
ReInitAllWindows(true);
if (_save_config) SaveToConfig();
}
/**
* Called to change a font or font size used by OpenTTD.
* @param font_size The FontSize(enum not pixel size) of the font to change.
* @param font The font name to use for this font.
* @param size The size(pixel size) to use for this font.
*/
void SetFont(FontSize font_size, const std::string &font, uint size)
{
FontCacheSubSetting *setting = GetFontCacheSubSetting(font_size);
bool changed = false;
if (setting->font != font) {
@ -115,19 +194,7 @@ void SetFont(FontSize fontsize, const std::string &font, uint size)
if (!changed) return;
if (fontsize != FS_MONO) {
/* Try to reload only the modified font. */
FontCacheSettings backup = _fcsettings;
for (FontSize fs = FS_BEGIN; fs < FS_END; fs++) {
if (fs == fontsize) continue;
FontCache *fc = FontCache::Get(fs);
GetFontCacheSubSetting(fs)->font = fc->HasParent() ? fc->GetFontName() : "";
}
CheckForMissingGlyphs();
_fcsettings = backup;
} else {
InitFontCache(true);
}
CheckForMissingGlyphs();
LoadStringWidthTable();
UpdateAllVirtCoords();
@ -136,20 +203,12 @@ void SetFont(FontSize fontsize, const std::string &font, uint size)
if (_save_config) SaveToConfig();
}
#ifdef WITH_FREETYPE
extern void LoadFreeTypeFont(FontSize fs);
extern void UninitFreeType();
#elif defined(_WIN32)
extern void LoadWin32Font(FontSize fs);
#elif defined(WITH_COCOA)
extern void LoadCoreTextFont(FontSize fs);
#endif
/**
* Test if a font setting uses the default font.
* @param setting The font setting to check.
* @return true iff the font is not configured and no fallback font data is present.
*/
static bool IsDefaultFont(const FontCacheSubSetting &setting)
bool IsDefaultFont(const FontCacheSubSetting &setting)
{
return setting.font.empty() && setting.os_handle == nullptr;
}
@ -162,16 +221,18 @@ static bool IsDefaultFont(const FontCacheSubSetting &setting)
uint GetFontCacheFontSize(FontSize fs)
{
const FontCacheSubSetting &setting = *GetFontCacheSubSetting(fs);
return IsDefaultFont(setting) ? FontCache::GetDefaultFontHeight(fs) : setting.size;
if (IsDefaultFont(setting) && setting.size == 0) return FontCache::GetDefaultFontHeight(fs);
return setting.size;
}
#if defined(WITH_FREETYPE) || defined(_WIN32) || defined(WITH_COCOA)
/**
* Get name of default font file for a given font size.
* @param fs Font size.
* @return Name of default font file.
*/
static std::string GetDefaultTruetypeFont(FontSize fs)
[[maybe_unused]] static std::string GetDefaultTruetypeFont(FontSize fs)
{
switch (fs) {
case FS_NORMAL: return "OpenTTD-Sans.ttf";
@ -181,7 +242,6 @@ static std::string GetDefaultTruetypeFont(FontSize fs)
default: NOT_REACHED();
}
}
#endif /* defined(WITH_FREETYPE) || defined(_WIN32) || defined(WITH_COCOA) */
/**
* Get path of default font file for a given font size.
@ -213,26 +273,23 @@ std::string GetFontCacheFontName(FontSize fs)
/**
* (Re)initialize the font cache related things, i.e. load the non-sprite fonts.
* @param monospace Whether to initialise the monospace or regular fonts.
*/
void InitFontCache(bool monospace)
void InitFontCache()
{
FontCache::InitializeFontCaches();
for (FontSize fs = FS_BEGIN; fs < FS_END; fs++) {
if (monospace != (fs == FS_MONO)) continue;
FontCache *fc = FontCache::Get(fs);
if (fc->HasParent()) delete fc;
#ifdef WITH_FREETYPE
LoadFreeTypeFont(fs);
#elif defined(_WIN32)
LoadWin32Font(fs);
#elif defined(WITH_COCOA)
LoadCoreTextFont(fs);
#endif
if (fc->HasParent()) {
delete fc;
}
LoadFontHelper(fs);
}
DebugPrintFontSettings("End of initFontCache()");
}
/**

View File

@ -65,6 +65,8 @@ public:
*/
virtual int GetFontSize() const { return this->height; }
virtual void SetFontSize([[maybe_unused]] int pixels);
/**
* Map a SpriteID to the key
* @param key The key to map to.
@ -206,6 +208,8 @@ struct FontCacheSettings {
bool global_aa; ///< Whether to anti alias all font sizes.
};
const int DEFAULT_FONT_MAX_HEIGHT = 40; ///< The maximum height allowed by font sliders.
extern FontCacheSettings _fcsettings;
/**
@ -224,12 +228,14 @@ inline FontCacheSubSetting *GetFontCacheSubSetting(FontSize fs)
}
}
uint GetFontCacheFontSize(FontSize fs);
void DebugPrintFontSettings(const std::string &desc);
bool GetFontAAState();
std::string GetFontCacheFontName(FontSize fs);
void InitFontCache(bool monospace);
uint GetFontCacheFontSize(FontSize fs);
void InitFontCache();
bool IsDefaultFont(const FontCacheSubSetting &setting);
void ResizeFont(FontSize font_size, uint size);
void SetFont(FontSize fontsize, const std::string &font, uint size);
void UninitFontCache();
bool GetFontAAState();
void SetFont(FontSize fontsize, const std::string &font, uint size);
#endif /* FONTCACHE_H */

View File

@ -32,8 +32,6 @@
class FreeTypeFontCache : public TrueTypeFontCache {
private:
FT_Face face; ///< The font face associated with this font.
void SetFontSize(int pixels);
const Sprite *InternalGetGlyph(GlyphID key, bool aa) override;
public:
@ -44,6 +42,7 @@ public:
std::string GetFontName() override { return fmt::format("{}, {}", face->family_name, face->style_name); }
bool IsBuiltInFont() override { return false; }
const void *GetOSHandle() override { return &face; }
void SetFontSize(int pixels) override;
};
FT_Library _library = nullptr;
@ -64,6 +63,8 @@ FreeTypeFontCache::FreeTypeFontCache(FontSize fs, FT_Face face, int pixels) : Tr
void FreeTypeFontCache::SetFontSize(int pixels)
{
this->req_size = pixels;
if (pixels == 0) {
/* Try to determine a good height based on the minimal height recommended by the font. */
int scaled_height = ScaleGUITrad(FontCache::GetDefaultFontHeight(this->fs));

View File

@ -958,6 +958,8 @@ STR_GAME_OPTIONS_TAB_GENERAL :General
STR_GAME_OPTIONS_TAB_GENERAL_TT :{BLACK}Choose general settings
STR_GAME_OPTIONS_TAB_GRAPHICS :Graphics
STR_GAME_OPTIONS_TAB_GRAPHICS_TT :{BLACK}Choose graphics settings
STR_GAME_OPTIONS_TAB_FONTS :Fonts
STR_GAME_OPTIONS_TAB_FONTS_TT :{BLACK}Choose font settings
STR_GAME_OPTIONS_TAB_SOUND :Sound
STR_GAME_OPTIONS_TAB_SOUND_TT :{BLACK}Choose sound and music settings
STR_GAME_OPTIONS_TAB_SOCIAL :Social
@ -1060,8 +1062,21 @@ STR_GAME_OPTIONS_GUI_SCALE_AUTO_TOOLTIP :{BLACK}Check th
STR_GAME_OPTIONS_GUI_SCALE_BEVELS :{BLACK}Scale bevels
STR_GAME_OPTIONS_GUI_SCALE_BEVELS_TOOLTIP :{BLACK}Check this box to scale bevels by interface size
STR_GAME_OPTIONS_SMALL_FONT_FRAME :{BLACK}Small font
STR_GAME_OPTIONS_SMALL_FONT_TOOLTIP :{BLACK}Used in map legends and on graphs.
STR_GAME_OPTIONS_SMALL_FONT_SIZE_SLIDER_TOOLTIP :{BLACK}Drag to change the small font size
STR_GAME_OPTIONS_MEDIUM_FONT_FRAME :{BLACK}Medium font
STR_GAME_OPTIONS_MEDIUM_FONT_TOOLTIP :{BLACK}Most text is displayed using this font.
STR_GAME_OPTIONS_MEDIUM_FONT_SIZE_SLIDER_TOOLTIP :{BLACK}Drag to change the medium font size
STR_GAME_OPTIONS_LARGE_FONT_FRAME :{BLACK}Large font
STR_GAME_OPTIONS_LARGE_FONT_TOOLTIP :{BLACK}Used to display News headlines.
STR_GAME_OPTIONS_LARGE_FONT_SIZE_SLIDER_TOOLTIP :{BLACK}Drag to change the large font size
STR_GAME_OPTIONS_MONOSPACED_FONT_FRAME :{BLACK}Monospaced font
STR_GAME_OPTIONS_MONOSPACED_FONT_TOOLTIP :{BLACK}Used to display the Readme and other documents.
STR_GAME_OPTIONS_MONOSPACED_FONT_SIZE_SLIDER_TOOLTIP :{BLACK}Drag to change the monospaced font size
STR_GAME_OPTIONS_FONT_SIZE :{BLACK}Size:
STR_GAME_OPTIONS_GUI_FONT_SPRITE :{BLACK}Use traditional sprite font
STR_GAME_OPTIONS_GUI_FONT_SPRITE_TOOLTIP :{BLACK}Check this box if you prefer to use the traditional fixed-size sprite font
STR_GAME_OPTIONS_GUI_FONT_SPRITE_TOOLTIP :{BLACK}Check this box if you prefer to use the traditional fixed-size sprite font instead of the default OpenTTD TrueType font
STR_GAME_OPTIONS_GUI_FONT_AA :{BLACK}Anti-alias fonts
STR_GAME_OPTIONS_GUI_FONT_AA_TOOLTIP :{BLACK}Check this box to anti-alias resizable fonts

View File

@ -694,7 +694,7 @@ int openttd_main(std::span<char * const> arguments)
InitializeLanguagePacks();
/* Initialize the font cache */
InitFontCache(false);
InitFontCache();
/* This must be done early, since functions use the SetWindowDirty* calls */
InitWindowSystem();

View File

@ -126,6 +126,8 @@ void CoreTextFontCache::ClearFontCache()
void CoreTextFontCache::SetFontSize(int pixels)
{
this->req_size = pixels;
if (pixels == 0) {
/* Try to determine a good height based on the height recommended by the font. */
int scaled_height = ScaleGUITrad(FontCache::GetDefaultFontHeight(this->fs));

View File

@ -21,7 +21,6 @@ class CoreTextFontCache : public TrueTypeFontCache {
std::string font_name; ///< Cached font name.
void SetFontSize(int pixels);
const Sprite *InternalGetGlyph(GlyphID key, bool use_aa) override;
public:
CoreTextFontCache(FontSize fs, CFAutoRelease<CTFontDescriptorRef> &&font, int pixels);
@ -32,6 +31,7 @@ public:
std::string GetFontName() override { return font_name; }
bool IsBuiltInFont() override { return false; }
const void *GetOSHandle() override { return font.get(); }
void SetFontSize(int pixels) override;
};
void LoadCoreTextFont(FontSize fs);

View File

@ -170,7 +170,7 @@ bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_is
if (best_font != nullptr) {
ret = true;
callback->SetFontNames(settings, best_font, &best_index);
InitFontCache(callback->Monospace());
InitFontCache();
}
/* Clean up the list of filenames. */

View File

@ -121,6 +121,8 @@ Win32FontCache::~Win32FontCache()
void Win32FontCache::SetFontSize(int pixels)
{
this->req_size = pixels;
if (pixels == 0) {
/* Try to determine a good height based on the minimal height recommended by the font. */
int scaled_height = ScaleGUITrad(FontCache::GetDefaultFontHeight(this->fs));

View File

@ -28,8 +28,6 @@ private:
ReusableBuffer<uint8_t> render_buffer; ///< Temporary buffer for rendering glyphs.
void SetFontSize(int pixels);
protected:
const Sprite *InternalGetGlyph(GlyphID key, bool aa) override;
@ -40,6 +38,7 @@ public:
GlyphID MapCharToGlyph(char32_t key, bool allow_fallback = true) override;
std::string GetFontName() override { return this->fontname; }
const void *GetOSHandle() override { return &this->logfont; }
void SetFontSize(int pixels) override;
};
void LoadWin32Font(FontSize fs);

View File

@ -175,6 +175,65 @@ static StringID VolumeMarkFunc(int, int mark, int value)
return STR_GAME_OPTIONS_VOLUME_MARK;
}
static const uint FONT_SLIDER_MARK_COUNT = 15; ///< Labeled at every other number. 8 Labeled marks and 7 unlabeled ones.
static const uint FONT_HALF_GAP = (FONT_SLIDER_MARK_COUNT - 1) / 2;
/* FONT_SLIDER_MARK_COUNT needs to be an odd number: */
static_assert(FONT_SLIDER_MARK_COUNT % 2 == 1);
/**
* Callback to get the mark string for the font size sliders. Labels every other number starting from the min_*_font_size
*
* @param mark_count Ignored here but the number of marks on the slider.
* @param mark The mark number.
* @param value The value of the slider at that mark.
* @return A string ID for the string this mark uses. Either raw_int (labelled) or empty string.
*/
static StringID FontSizeMarkFunction([[maybe_unused]] int mark_count, int mark, int value)
{
if ((mark & 1) == 1) {
return STR_NULL;
}
SetDParam(0, value);
return STR_JUST_INT;
}
/**
* Calculates the starting mark value for a font size slider. Taking into account the allowed minimum and the need to have
* FONT_SLIDER_MARK_COUNT marks. (The max allowed font size value is currently the same for all fonts)
*
* @param current_size The current size of the font in question.
* @param minimum_size The allowed minimum value for this font size.
* @return An int value that serves as the minimum value that will be on a slider.
*/
static int CalculateFontSliderMin(int current_size, int minimum_size)
{
/* This works fine unless the scale is towards the high end of the allowable range: */
int first_pass_minimum = std::max(current_size - static_cast<int>(FONT_HALF_GAP), minimum_size);
/* Adjust for the cases where marks are missing because the top end of the slider has hit the max value: */
return std::min(first_pass_minimum, static_cast<int>(DEFAULT_FONT_MAX_HEIGHT - (FONT_SLIDER_MARK_COUNT - 1)));
}
/**
* Calculates the ending mark value for a font size slider. Taking into account the allowed maximum and the need to have
* FONT_SLIDER_MARK_COUNT marks. (The max allowed font size value is currently the same for all fonts)
*
* @param current_size The current size of the font in question.
* @param minimum_size The allowed minimum value for this font size.
* @return An int value that serves as the maximum value that will be on a slider.
*/
static int CalculateFontSliderMax(int current_size, int minimum_size)
{
/* This works fine unless the scale is towards the low end of the allowable range: */
int first_pass_maximum = std::min(current_size + static_cast<int>(FONT_HALF_GAP), static_cast<int>(DEFAULT_FONT_MAX_HEIGHT));
/* Adjust for the cases where marks are missing because the bottom end of the slider has hit the minimum value: */
return std::max(first_pass_maximum, minimum_size + static_cast<int>(FONT_SLIDER_MARK_COUNT - 1));
}
static constexpr NWidgetPart _nested_social_plugins_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_FRAME, COLOUR_GREY, WID_GO_SOCIAL_PLUGIN_TITLE), SetDataTip(STR_JUST_STRING2, STR_NULL),
@ -358,6 +417,21 @@ struct GameOptionsWindow : Window {
GameSettings *opt;
bool reload;
int gui_scale;
int min_small_font_size;
int max_small_font_size;
int min_medium_font_size;
int max_medium_font_size;
int min_large_font_size;
int max_large_font_size;
int min_monospaced_font_size;
int max_monospaced_font_size;
int small_font_size;
int medium_font_size;
int large_font_size;
int monospaced_font_size;
static inline WidgetID active_tab = WID_GO_TAB_GENERAL;
GameOptionsWindow(WindowDesc &desc) : Window(desc)
@ -366,6 +440,24 @@ struct GameOptionsWindow : Window {
this->reload = false;
this->gui_scale = _gui_scale;
/* Retrieve the current fonts settings. This requires some bounds checking as fonts sizes could be zero here. */
this->small_font_size = std::clamp(static_cast<int>(_fcsettings.small.size), FontCache::GetDefaultFontHeight(FS_SMALL), DEFAULT_FONT_MAX_HEIGHT);
this->medium_font_size = std::clamp(static_cast<int>(_fcsettings.medium.size), FontCache::GetDefaultFontHeight(FS_NORMAL), DEFAULT_FONT_MAX_HEIGHT);
this->large_font_size = std::clamp(static_cast<int>(_fcsettings.large.size), FontCache::GetDefaultFontHeight(FS_LARGE), DEFAULT_FONT_MAX_HEIGHT);
this->monospaced_font_size = std::clamp(static_cast<int>(_fcsettings.mono.size), FontCache::GetDefaultFontHeight(FS_MONO), DEFAULT_FONT_MAX_HEIGHT);
this->min_small_font_size = CalculateFontSliderMin(this->small_font_size, FontCache::GetDefaultFontHeight(FS_SMALL));
this->max_small_font_size = CalculateFontSliderMax(this->small_font_size, FontCache::GetDefaultFontHeight(FS_SMALL));
this->min_medium_font_size = CalculateFontSliderMin(this->medium_font_size, FontCache::GetDefaultFontHeight(FS_NORMAL));
this->max_medium_font_size = CalculateFontSliderMax(this->medium_font_size, FontCache::GetDefaultFontHeight(FS_NORMAL));
this->min_large_font_size = CalculateFontSliderMin(this->large_font_size, FontCache::GetDefaultFontHeight(FS_LARGE));
this->max_large_font_size = CalculateFontSliderMax(this->large_font_size, FontCache::GetDefaultFontHeight(FS_LARGE));
this->min_monospaced_font_size = CalculateFontSliderMin(this->monospaced_font_size, FontCache::GetDefaultFontHeight(FS_MONO));
this->max_monospaced_font_size = CalculateFontSliderMax(this->monospaced_font_size, FontCache::GetDefaultFontHeight(FS_MONO));
AddCustomRefreshRates();
this->InitNested(WN_GAME_OPTIONS_GAME_OPTIONS);
@ -542,6 +634,22 @@ struct GameOptionsWindow : Window {
plugin->SetStringParameters(widget);
break;
}
case WID_GO_FONT_SMALL_FONT_LABEL:
SetDParamStr(0, FontCache::Get(FS_SMALL)->GetFontName());
break;
case WID_GO_FONT_MEDIUM_FONT_LABEL:
SetDParamStr(0, FontCache::Get(FS_NORMAL)->GetFontName());
break;
case WID_GO_FONT_LARGE_FONT_LABEL:
SetDParamStr(0, FontCache::Get(FS_LARGE)->GetFontName());
break;
case WID_GO_FONT_MONOSPACED_FONT_LABEL:
SetDParamStr(0, FontCache::Get(FS_MONO)->GetFontName());
break;
}
}
@ -572,6 +680,22 @@ struct GameOptionsWindow : Window {
DrawStringMultiLine(r, STR_GAME_OPTIONS_VIDEO_DRIVER_INFO);
break;
case WID_GO_FONT_SMALL_FONT_SIZE_SLIDER:
DrawSliderWidget(r, this->min_small_font_size, this->max_small_font_size, FONT_SLIDER_MARK_COUNT, this->small_font_size, FontSizeMarkFunction);
break;
case WID_GO_FONT_MEDIUM_FONT_SIZE_SLIDER:
DrawSliderWidget(r, this->min_medium_font_size, this->max_medium_font_size, FONT_SLIDER_MARK_COUNT, this->medium_font_size, FontSizeMarkFunction);
break;
case WID_GO_FONT_LARGE_FONT_SIZE_SLIDER:
DrawSliderWidget(r, this->min_large_font_size, this->max_large_font_size, FONT_SLIDER_MARK_COUNT, this->large_font_size, FontSizeMarkFunction);
break;
case WID_GO_FONT_MONOSPACED_FONT_SIZE_SLIDER:
DrawSliderWidget(r, this->min_monospaced_font_size, this->max_monospaced_font_size, FONT_SLIDER_MARK_COUNT, this->monospaced_font_size, FontSizeMarkFunction);
break;
case WID_GO_BASE_SFX_VOLUME:
DrawSliderWidget(r, 0, INT8_MAX, VOLUME_NMARKS, _settings_client.music.effect_vol, VolumeMarkFunc);
break;
@ -585,6 +709,9 @@ struct GameOptionsWindow : Window {
void SetTab(WidgetID widget)
{
this->SetWidgetsLoweredState(false, WID_GO_TAB_GENERAL, WID_GO_TAB_GRAPHICS, WID_GO_TAB_SOUND, WID_GO_TAB_SOCIAL);
#ifdef HAS_TRUETYPE_FONT
this->SetWidgetsLoweredState(false, WID_GO_TAB_FONTS);
#endif
this->LowerWidget(widget);
GameOptionsWindow::active_tab = widget;
@ -592,8 +719,14 @@ struct GameOptionsWindow : Window {
switch (widget) {
case WID_GO_TAB_GENERAL: pane = 0; break;
case WID_GO_TAB_GRAPHICS: pane = 1; break;
#ifdef HAS_TRUETYPE_FONT
case WID_GO_TAB_FONTS: pane = 2; break;
case WID_GO_TAB_SOUND: pane = 3; break;
case WID_GO_TAB_SOCIAL: pane = 4; break;
#else
case WID_GO_TAB_SOUND: pane = 2; break;
case WID_GO_TAB_SOCIAL: pane = 3; break;
#endif
default: NOT_REACHED();
}
@ -687,6 +820,9 @@ struct GameOptionsWindow : Window {
switch (widget) {
case WID_GO_TAB_GENERAL:
case WID_GO_TAB_GRAPHICS:
#ifdef HAS_TRUETYPE_FONT
case WID_GO_TAB_FONTS:
#endif
case WID_GO_TAB_SOUND:
case WID_GO_TAB_SOCIAL:
this->SetTab(widget);
@ -760,32 +896,34 @@ struct GameOptionsWindow : Window {
break;
}
#ifdef HAS_TRUETYPE_FONT
case WID_GO_GUI_FONT_SPRITE:
case WID_GO_FONT_SPRITE:
_fcsettings.prefer_sprite = !_fcsettings.prefer_sprite;
this->SetWidgetLoweredState(WID_GO_GUI_FONT_SPRITE, _fcsettings.prefer_sprite);
this->SetWidgetDisabledState(WID_GO_GUI_FONT_AA, _fcsettings.prefer_sprite);
this->SetWidgetLoweredState(WID_GO_FONT_SPRITE, _fcsettings.prefer_sprite);
this->SetWidgetDisabledState(WID_GO_FONT_AA, _fcsettings.prefer_sprite);
this->SetWidgetDisabledState(WID_GO_FONT_SMALL_FONT_SIZE_SLIDER, _fcsettings.prefer_sprite && IsDefaultFont(_fcsettings.small));
this->SetWidgetDisabledState(WID_GO_FONT_MEDIUM_FONT_SIZE_SLIDER, _fcsettings.prefer_sprite && IsDefaultFont(_fcsettings.medium));
this->SetWidgetDisabledState(WID_GO_FONT_LARGE_FONT_SIZE_SLIDER, _fcsettings.prefer_sprite && IsDefaultFont(_fcsettings.large));
this->SetWidgetDisabledState(WID_GO_FONT_MONOSPACED_FONT_SIZE_SLIDER, _fcsettings.prefer_sprite && IsDefaultFont(_fcsettings.mono));
this->SetDirty();
InitFontCache(false);
InitFontCache(true);
ClearFontCache();
InitFontCache();
CheckForMissingGlyphs();
SetupWidgetDimensions();
UpdateAllVirtCoords();
ReInitAllWindows(true);
break;
case WID_GO_GUI_FONT_AA:
case WID_GO_FONT_AA:
_fcsettings.global_aa = !_fcsettings.global_aa;
this->SetWidgetLoweredState(WID_GO_GUI_FONT_AA, _fcsettings.global_aa);
this->SetWidgetLoweredState(WID_GO_FONT_AA, _fcsettings.global_aa);
MarkWholeScreenDirty();
ClearFontCache();
break;
#endif /* HAS_TRUETYPE_FONT */
case WID_GO_GUI_SCALE:
if (ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, MIN_INTERFACE_SCALE, MAX_INTERFACE_SCALE, _ctrl_pressed ? 0 : SCALE_NMARKS, this->gui_scale)) {
@ -820,6 +958,35 @@ struct GameOptionsWindow : Window {
break;
}
case WID_GO_FONT_SMALL_FONT_SIZE_SLIDER:
ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, this->min_small_font_size, this->max_small_font_size, FONT_SLIDER_MARK_COUNT, this->small_font_size);
this->SetWidgetDirty(widget);
if (click_count > 0) this->mouse_capture_widget = widget;
break;
case WID_GO_FONT_MEDIUM_FONT_SIZE_SLIDER:
ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, this->min_medium_font_size, this->max_medium_font_size, FONT_SLIDER_MARK_COUNT, this->medium_font_size);
this->SetWidgetDirty(widget);
if (click_count > 0) this->mouse_capture_widget = widget;
break;
case WID_GO_FONT_LARGE_FONT_SIZE_SLIDER:
ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, this->min_large_font_size, this->max_large_font_size, FONT_SLIDER_MARK_COUNT, this->large_font_size);
this->SetWidgetDirty(widget);
if (click_count > 0) this->mouse_capture_widget = widget;
break;
case WID_GO_FONT_MONOSPACED_FONT_SIZE_SLIDER:
ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, this->min_monospaced_font_size, this->max_monospaced_font_size, FONT_SLIDER_MARK_COUNT, this->monospaced_font_size);
this->SetWidgetDirty(widget);
if (click_count > 0) this->mouse_capture_widget = widget;
break;
case WID_GO_BASE_SFX_VOLUME:
case WID_GO_BASE_MUSIC_VOLUME: {
uint8_t &vol = (widget == WID_GO_BASE_MUSIC_VOLUME) ? _settings_client.music.music_vol : _settings_client.music.effect_vol;
@ -891,14 +1058,30 @@ struct GameOptionsWindow : Window {
void OnMouseLoop() override
{
if (_left_button_down || this->gui_scale == _gui_scale) return;
/* Nothing will have changed if the mouse button isn't down, so bail out. */
if (_left_button_down) return;
_gui_scale_cfg = this->gui_scale;
if (this->gui_scale != _gui_scale) {
_gui_scale_cfg = this->gui_scale;
if (AdjustGUIZoom(false)) {
ReInitAllWindows(true);
this->SetWidgetLoweredState(WID_GO_GUI_SCALE_AUTO, false);
this->SetDirty();
if (AdjustGUIZoom(false)) {
ReInitAllWindows(true);
this->SetWidgetLoweredState(WID_GO_GUI_SCALE_AUTO, false);
this->SetDirty();
}
}
if (static_cast<uint>(this->small_font_size) != _fcsettings.small.size) {
ResizeFont(FS_SMALL, this->small_font_size);
}
if (static_cast<uint>(this->medium_font_size) != _fcsettings.medium.size) {
ResizeFont(FS_NORMAL, static_cast<uint>(this->medium_font_size));
}
if (static_cast<uint>(this->large_font_size) != _fcsettings.large.size) {
ResizeFont(FS_LARGE, static_cast<uint>(this->large_font_size));
}
if (static_cast<uint>(this->monospaced_font_size) != _fcsettings.mono.size) {
ResizeFont(FS_MONO, static_cast<uint>(this->monospaced_font_size));
}
}
@ -984,9 +1167,14 @@ struct GameOptionsWindow : Window {
this->SetWidgetLoweredState(WID_GO_GUI_SCALE_AUTO, _gui_scale_cfg == -1);
this->SetWidgetLoweredState(WID_GO_GUI_SCALE_BEVEL_BUTTON, _settings_client.gui.scale_bevels);
#ifdef HAS_TRUETYPE_FONT
this->SetWidgetLoweredState(WID_GO_GUI_FONT_SPRITE, _fcsettings.prefer_sprite);
this->SetWidgetLoweredState(WID_GO_GUI_FONT_AA, _fcsettings.global_aa);
this->SetWidgetDisabledState(WID_GO_GUI_FONT_AA, _fcsettings.prefer_sprite);
this->SetWidgetLoweredState(WID_GO_FONT_SPRITE, _fcsettings.prefer_sprite);
this->SetWidgetLoweredState(WID_GO_FONT_AA, _fcsettings.global_aa);
this->SetWidgetDisabledState(WID_GO_FONT_AA, _fcsettings.prefer_sprite);
this->SetWidgetDisabledState(WID_GO_FONT_SMALL_FONT_SIZE_SLIDER, _fcsettings.prefer_sprite && IsDefaultFont(_fcsettings.small));
this->SetWidgetDisabledState(WID_GO_FONT_MEDIUM_FONT_SIZE_SLIDER, _fcsettings.prefer_sprite && IsDefaultFont(_fcsettings.medium));
this->SetWidgetDisabledState(WID_GO_FONT_LARGE_FONT_SIZE_SLIDER, _fcsettings.prefer_sprite && IsDefaultFont(_fcsettings.large));
this->SetWidgetDisabledState(WID_GO_FONT_MONOSPACED_FONT_SIZE_SLIDER, _fcsettings.prefer_sprite && IsDefaultFont(_fcsettings.mono));
#endif /* HAS_TRUETYPE_FONT */
this->SetWidgetDisabledState(WID_GO_BASE_GRF_DROPDOWN, _game_mode != GM_MENU);
@ -1016,6 +1204,9 @@ static constexpr NWidgetPart _nested_game_options_widgets[] = {
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPadding(WidgetDimensions::unscaled.sparse),
NWidget(WWT_TEXTBTN, COLOUR_YELLOW, WID_GO_TAB_GENERAL), SetMinimalTextLines(2, 0), SetDataTip(STR_GAME_OPTIONS_TAB_GENERAL, STR_GAME_OPTIONS_TAB_GENERAL_TT), SetFill(1, 0),
NWidget(WWT_TEXTBTN, COLOUR_YELLOW, WID_GO_TAB_GRAPHICS), SetMinimalTextLines(2, 0), SetDataTip(STR_GAME_OPTIONS_TAB_GRAPHICS, STR_GAME_OPTIONS_TAB_GRAPHICS_TT), SetFill(1, 0),
#ifdef HAS_TRUETYPE_FONT
NWidget(WWT_TEXTBTN, COLOUR_YELLOW, WID_GO_TAB_FONTS), SetMinimalTextLines(2, 0), SetDataTip(STR_GAME_OPTIONS_TAB_FONTS, STR_GAME_OPTIONS_TAB_FONTS_TT), SetFill(1, 0),
#endif
NWidget(WWT_TEXTBTN, COLOUR_YELLOW, WID_GO_TAB_SOUND), SetMinimalTextLines(2, 0), SetDataTip(STR_GAME_OPTIONS_TAB_SOUND, STR_GAME_OPTIONS_TAB_SOUND_TT), SetFill(1, 0),
NWidget(WWT_TEXTBTN, COLOUR_YELLOW, WID_GO_TAB_SOCIAL), SetMinimalTextLines(2, 0), SetDataTip(STR_GAME_OPTIONS_TAB_SOCIAL, STR_GAME_OPTIONS_TAB_SOCIAL_TT), SetFill(1, 0),
EndContainer(),
@ -1049,6 +1240,7 @@ static constexpr NWidgetPart _nested_game_options_widgets[] = {
EndContainer(),
EndContainer(),
EndContainer(),
/* End general tab */
/* Graphics tab */
NWidget(NWID_VERTICAL), SetPadding(WidgetDimensions::unscaled.sparse), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0),
@ -1063,16 +1255,6 @@ static constexpr NWidgetPart _nested_game_options_widgets[] = {
NWidget(WWT_TEXT, COLOUR_GREY), SetMinimalSize(0, 12), SetFill(1, 0), SetDataTip(STR_GAME_OPTIONS_GUI_SCALE_BEVELS, STR_NULL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GO_GUI_SCALE_BEVEL_BUTTON), SetAspect(WidgetDimensions::ASPECT_SETTINGS_BUTTON), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_GUI_SCALE_BEVELS_TOOLTIP),
EndContainer(),
#ifdef HAS_TRUETYPE_FONT
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_normal, 0),
NWidget(WWT_TEXT, COLOUR_GREY), SetMinimalSize(0, 12), SetFill(1, 0), SetDataTip(STR_GAME_OPTIONS_GUI_FONT_SPRITE, STR_NULL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GO_GUI_FONT_SPRITE), SetAspect(WidgetDimensions::ASPECT_SETTINGS_BUTTON), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_GUI_FONT_SPRITE_TOOLTIP),
EndContainer(),
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_normal, 0),
NWidget(WWT_TEXT, COLOUR_GREY), SetMinimalSize(0, 12), SetFill(1, 0), SetDataTip(STR_GAME_OPTIONS_GUI_FONT_AA, STR_NULL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GO_GUI_FONT_AA), SetAspect(WidgetDimensions::ASPECT_SETTINGS_BUTTON), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_GUI_FONT_AA_TOOLTIP),
EndContainer(),
#endif /* HAS_TRUETYPE_FONT */
EndContainer(),
EndContainer(),
@ -1125,6 +1307,76 @@ static constexpr NWidgetPart _nested_game_options_widgets[] = {
EndContainer(),
EndContainer(),
EndContainer(),
/* End graphics tab */
#ifdef HAS_TRUETYPE_FONT
/* Fonts tab */
NWidget(NWID_VERTICAL), SetPadding(WidgetDimensions::unscaled.sparse), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0),
/* Global Font Options: */
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_normal, 0),
NWidget(WWT_TEXT, COLOUR_GREY), SetMinimalSize(0, 12), SetFill(1, 0), SetDataTip(STR_GAME_OPTIONS_GUI_FONT_SPRITE, STR_NULL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GO_FONT_SPRITE), SetMinimalSize(21, 9), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_GUI_FONT_SPRITE_TOOLTIP),
EndContainer(),
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_normal, 0),
NWidget(WWT_TEXT, COLOUR_GREY), SetMinimalSize(0, 12), SetFill(1, 0), SetDataTip(STR_GAME_OPTIONS_GUI_FONT_AA, STR_NULL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GO_FONT_AA), SetMinimalSize(21, 9), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_GUI_FONT_AA_TOOLTIP),
EndContainer(),
/* Small font: */
NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_SMALL_FONT_FRAME, STR_NULL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0),
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
NWidget(WWT_LABEL, COLOUR_GREY, WID_GO_FONT_SMALL_FONT_LABEL), SetDataTip(STR_JUST_RAW_STRING, STR_GAME_OPTIONS_SMALL_FONT_TOOLTIP),
SetFill(1, 0), SetTextStyle(TC_BLACK, FS_SMALL), SetMinimalTextLines(1, 6, FS_SMALL), SetAlignment(SA_CENTER),
EndContainer(),
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_TEXT_FONT_SIZE), SetMinimalSize(0, 12), SetDataTip(STR_GAME_OPTIONS_FONT_SIZE, STR_NULL),
NWidget(WWT_EMPTY, COLOUR_GREY, WID_GO_FONT_SMALL_FONT_SIZE_SLIDER), SetMinimalTextLines(1, 12 + WidgetDimensions::unscaled.vsep_normal, FS_NORMAL),
SetMinimalSize(67, 0), SetFill(1, 0), SetResize(1, 0), SetDataTip(0x0, STR_GAME_OPTIONS_SMALL_FONT_SIZE_SLIDER_TOOLTIP),
EndContainer(),
EndContainer(),
/* Medium font: */
NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_MEDIUM_FONT_FRAME, STR_NULL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0),
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
NWidget(WWT_LABEL, COLOUR_GREY, WID_GO_FONT_MEDIUM_FONT_LABEL), SetDataTip(STR_JUST_RAW_STRING, STR_GAME_OPTIONS_MEDIUM_FONT_TOOLTIP),
SetFill(1, 0), SetTextStyle(TC_BLACK, FS_NORMAL), SetMinimalTextLines(1, 6, FS_NORMAL), SetAlignment(SA_CENTER),
EndContainer(),
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_TEXT_FONT_SIZE), SetMinimalSize(0, 12), SetDataTip(STR_GAME_OPTIONS_FONT_SIZE, STR_NULL),
NWidget(WWT_EMPTY, COLOUR_GREY, WID_GO_FONT_MEDIUM_FONT_SIZE_SLIDER), SetMinimalTextLines(1, 12 + WidgetDimensions::unscaled.vsep_normal, FS_NORMAL),
SetMinimalSize(67, 0), SetFill(1, 0), SetResize(1, 0), SetDataTip(0x0, STR_GAME_OPTIONS_MEDIUM_FONT_SIZE_SLIDER_TOOLTIP),
EndContainer(),
EndContainer(),
/* Large font: */
NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_LARGE_FONT_FRAME, STR_NULL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0),
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
NWidget(WWT_LABEL, COLOUR_GREY, WID_GO_FONT_LARGE_FONT_LABEL), SetDataTip(STR_JUST_RAW_STRING, STR_GAME_OPTIONS_LARGE_FONT_TOOLTIP),
SetFill(1, 0), SetTextStyle(TC_BLACK, FS_LARGE), SetMinimalTextLines(1, 6, FS_LARGE), SetAlignment(SA_CENTER),
EndContainer(),
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_TEXT_FONT_SIZE), SetMinimalSize(0, 12), SetDataTip(STR_GAME_OPTIONS_FONT_SIZE, STR_NULL),
NWidget(WWT_EMPTY, COLOUR_GREY, WID_GO_FONT_LARGE_FONT_SIZE_SLIDER), SetMinimalTextLines(1, 12 + WidgetDimensions::unscaled.vsep_normal, FS_NORMAL),
SetMinimalSize(67, 0), SetFill(1, 0), SetResize(1, 0), SetDataTip(0x0, STR_GAME_OPTIONS_LARGE_FONT_SIZE_SLIDER_TOOLTIP),
EndContainer(),
EndContainer(),
/* Monospaced font */
NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_MONOSPACED_FONT_FRAME, STR_NULL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0),
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
NWidget(WWT_LABEL, COLOUR_GREY, WID_GO_FONT_MONOSPACED_FONT_LABEL), SetDataTip(STR_JUST_RAW_STRING, STR_GAME_OPTIONS_MONOSPACED_FONT_TOOLTIP),
SetFill(1, 0), SetTextStyle(TC_BLACK, FS_MONO), SetMinimalTextLines(1, 6, FS_MONO), SetAlignment(SA_CENTER),
EndContainer(),
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_TEXT_FONT_SIZE), SetMinimalSize(0, 12), SetDataTip(STR_GAME_OPTIONS_FONT_SIZE, STR_NULL),
NWidget(WWT_EMPTY, COLOUR_GREY, WID_GO_FONT_MONOSPACED_FONT_SIZE_SLIDER), SetMinimalTextLines(1, 12 + WidgetDimensions::unscaled.vsep_normal, FS_NORMAL),
SetMinimalSize(67, 0), SetFill(1, 0), SetResize(1, 0), SetDataTip(0x0, STR_GAME_OPTIONS_MONOSPACED_FONT_SIZE_SLIDER_TOOLTIP),
EndContainer(),
EndContainer(),
EndContainer(),
/* End font tab */
#endif
/* Sound/Music tab */
NWidget(NWID_VERTICAL), SetPadding(WidgetDimensions::unscaled.sparse), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0),
@ -1180,11 +1432,13 @@ static constexpr NWidgetPart _nested_game_options_widgets[] = {
EndContainer(),
EndContainer(),
EndContainer(),
/* End sound/music tab */
/* Social tab */
NWidget(NWID_VERTICAL), SetPadding(WidgetDimensions::unscaled.sparse), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0),
NWidgetFunction(MakeNWidgetSocialPlugins),
EndContainer(),
/* End social tab */
EndContainer(),
EndContainer(),
};

View File

@ -2191,7 +2191,7 @@ const char *GetCurrentLanguageIsoCode()
*/
bool MissingGlyphSearcher::FindMissingGlyphs()
{
InitFontCache(this->Monospace());
InitFontCache();
this->Reset();
for (auto text = this->NextString(); text.has_value(); text = this->NextString()) {
@ -2324,7 +2324,7 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
/* Our fallback font does miss characters too, so keep the
* user chosen font as that is more likely to be any good than
* the wild guess we made */
InitFontCache(searcher->Monospace());
InitFontCache();
}
}
#endif

View File

@ -14,6 +14,7 @@
enum GameOptionsWidgets : WidgetID {
WID_GO_TAB_GENERAL, ///< General tab.
WID_GO_TAB_GRAPHICS, ///< Graphics tab.
WID_GO_TAB_FONTS, ///< Fonts tab.
WID_GO_TAB_SOUND, ///< Sound tab.
WID_GO_TAB_SOCIAL, ///< Social tab.
WID_GO_TAB_SELECTION, ///< Background of the tab selection.
@ -26,8 +27,18 @@ enum GameOptionsWidgets : WidgetID {
WID_GO_GUI_SCALE, ///< GUI Scale slider.
WID_GO_GUI_SCALE_AUTO, ///< Autodetect GUI scale button.
WID_GO_GUI_SCALE_BEVEL_BUTTON, ///< Toggle for chunky bevels.
WID_GO_GUI_FONT_SPRITE, ///< Toggle whether to prefer the sprite font over TTF fonts.
WID_GO_GUI_FONT_AA, ///< Toggle whether to anti-alias fonts.
WID_GO_FONT_SPRITE, ///< Toggle whether to prefer the sprite font over TTF fonts.
WID_GO_FONT_AA, ///< Toggle whether to anti-alias fonts.
WID_GO_TEXT_FONT, ///< Font label
WID_GO_TEXT_FONT_SIZE, ///< Font size label.
WID_GO_FONT_SMALL_FONT_LABEL, ///< Small font label.
WID_GO_FONT_MEDIUM_FONT_LABEL, ///< Medium font label.
WID_GO_FONT_LARGE_FONT_LABEL, ///< Large font label.
WID_GO_FONT_MONOSPACED_FONT_LABEL, ///< Monospaced font label.
WID_GO_FONT_SMALL_FONT_SIZE_SLIDER, ///< Small font size slider.
WID_GO_FONT_MEDIUM_FONT_SIZE_SLIDER, ///< Medium font size slider.
WID_GO_FONT_LARGE_FONT_SIZE_SLIDER, ///< Large font size slider.
WID_GO_FONT_MONOSPACED_FONT_SIZE_SLIDER, ///< Monospaced font size slider.
WID_GO_BASE_GRF_DROPDOWN, ///< Use to select a base GRF.
WID_GO_BASE_GRF_PARAMETERS, ///< Base GRF parameters.
WID_GO_BASE_GRF_CONTENT_DOWNLOAD, ///< 'Get Content' button for base GRF.