OpenTTD Source 20250905-master-g122023be8d
|
Cache for characters from fonts. More...
#include "stdafx.h"
#include "fontcache.h"
#include "blitter/factory.hpp"
#include "gfx_layout.h"
#include "openttd.h"
#include "settings_func.h"
#include "strings_func.h"
#include "viewport_func.h"
#include "window_func.h"
#include "fileio_func.h"
#include "safeguards.h"
Go to the source code of this file.
Functions | |
int | GetCharacterHeight (FontSize size) |
Get height of a character for a given font size. | |
bool | GetFontAAState () |
void | SetFont (FontSize fontsize, const std::string &font, uint size) |
static bool | IsDefaultFont (const FontCacheSubSetting &setting) |
Test if a font setting uses the default font. | |
uint | GetFontCacheFontSize (FontSize fs) |
Get the scalable font size to use for a FontSize. | |
static std::string | GetDefaultTruetypeFont (FontSize fs) |
Get name of default font file for a given font size. | |
static std::string | GetDefaultTruetypeFontFile (FontSize fs) |
Get path of default font file for a given font size. | |
std::string | GetFontCacheFontName (FontSize fs) |
Get font to use for a given font size. | |
Variables | |
FontCacheSettings | _fcsettings |
Cache for characters from fonts.
Definition in file fontcache.cpp.
int GetCharacterHeight | ( | FontSize | size | ) |
Get height of a character for a given font size.
size | Font size to get height of |
Definition at line 87 of file fontcache.cpp.
References FontCache::Get(), and FontCache::GetHeight().
Referenced by CargoesField::CargoClickedAt(), CargoesField::CargoLabelClickedAt(), CheckClickOnViewportSign(), CargoesField::Draw(), StationViewWindow::DrawAcceptedCargo(), TownAuthorityWindow::DrawActions(), DrawAircraftDetails(), DrawAircraftPurchaseInfo(), TimetableWindow::DrawArrivalDeparturePanel(), DrawButtonDropdown(), StationViewWindow::DrawCargoRatings(), DrawCategories(), DrawCategory(), DrawCharCentered(), NetworkClientListWindow::DrawCompany(), NetworkContentListWindow::DrawDetails(), FramerateWindow::DrawElementTimesColumn(), DrawEngineList(), StationViewWindow::DrawEntries(), DrawFrame(), BaseGraphWindow::DrawGraph(), SmallMapWindow::DrawIndustryNames(), IndustryViewWindow::DrawInfo(), GoalListWindow::DrawListColumn(), NetworkContentListWindow::DrawMatrix(), DrawOrderString(), TownAuthorityWindow::DrawRatings(), DrawRoadVehDetails(), NetworkGameWindow::DrawServerLine(), SettingEntry::DrawSetting(), SettingsPage::DrawSetting(), DrawShipDetails(), DrawSliderWidget(), DrawSmallOrderList(), DrawString(), DrawStringMultiLineWithClipping(), TimetableWindow::DrawSummaryPanel(), TimetableWindow::DrawTimetablePanel(), SmallMapWindow::DrawTowns(), DrawTrainDetails(), DepotWindow::DrawVehicleInDepot(), BaseVehicleListWindow::DrawVehicleListItems(), DrawVehiclePurchaseInfo(), DrawVehicleRefitWindow(), SelectCompanyLiveryWindow::DrawWidget(), SelectCompanyManagerFaceWindow::DrawWidget(), CompanyInfrastructureWindow::DrawWidget(), EnginePreviewWindow::DrawWidget(), SaveLoadWindow::DrawWidget(), FramerateWindow::DrawWidget(), FrametimeGraphWindow::DrawWidget(), GSConfigWindow::DrawWidget(), GenerateProgressWindow::DrawWidget(), GraphLegendWindow::DrawWidget(), BaseGraphWindow::DrawWidget(), PerformanceRatingDetailWindow::DrawWidget(), VehicleGroupWindow::DrawWidget(), BuildIndustryWindow::DrawWidget(), PerformanceLeagueWindow::DrawWidget(), ScriptLeagueWindow::DrawWidget(), LinkGraphLegendWindow::DrawWidget(), LandInfoWindow::DrawWidget(), MusicTrackSelectionWindow::DrawWidget(), BaseNetworkContentDownloadStatusWindow::DrawWidget(), NetworkJoinStatusWindow::DrawWidget(), NewGRFParametersWindow::DrawWidget(), NewGRFWindow::DrawWidget(), SavePresetWindow::DrawWidget(), ScanProgressWindow::DrawWidget(), ScriptListWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), GameOptionsWindow::DrawWidget(), SignListWindow::DrawWidget(), SmallMapWindow::DrawWidget(), CompanyStationsWindow::DrawWidget(), StatusBarWindow::DrawWidget(), StoryBookWindow::DrawWidget(), SubsidyListWindow::DrawWidget(), TextfileWindow::DrawWidget(), ScenarioEditorToolbarWindow::DrawWidget(), TownViewWindow::DrawWidget(), TownDirectoryWindow::DrawWidget(), VehicleDetailsWindow::DrawWidget(), VehicleViewWindow::DrawWidget(), DrawYearCategory(), DrawYearColumn(), StoryBookWindow::EnsureStoryPageElementLayout(), CompanyInfrastructureWindow::FindWindowPlacementAndResize(), GetAutoPlacePosition(), TownViewWindow::GetDesiredInfoHeight(), GetEngineListHeight(), StoryBookWindow::GetHeadHeight(), TextfileWindow::GetHyperlink(), SmallMapWindow::GetLegendHeight(), SmallMapWindow::GetPositionOnLegend(), VehicleDetailsWindow::GetRoadVehDetailsHeight(), GetTotalCategoriesHeight(), GetVehicleListHeight(), LocalGetWindowPlacement(), ViewportSign::MarkDirty(), NetworkDrawChatMessage(), NetworkReInitChatBoxSize(), FramerateWindow::OnClick(), BaseGraphWindow::OnClick(), MusicTrackSelectionWindow::OnClick(), StationViewWindow::OnClick(), TownAuthorityWindow::OnClick(), SelectCompanyManagerFaceWindow::OnInit(), IConsoleWindow::OnInit(), BaseCargoGraphWindow::OnInit(), BuildIndustryWindow::OnInit(), IndustryViewWindow::OnInit(), IndustryCargoesWindow::OnInit(), SmallMapWindow::OnInit(), StationViewWindow::OnInit(), BaseGraphWindow::OnMouseOver(), BuildAirportWindow::OnPaint(), ReplaceVehicleWindow::OnPaint(), BuildVehicleWindow::OnPaint(), HighScoreWindow::OnPaint(), MainWindow::OnPaint(), GameOptionsWindow::OnPaint(), FramerateWindow::OnResize(), NWidgetResizeBase::SetMinimalSize(), NWidgetResizeBase::SetMinimalTextLines(), StationsWndShowStationRating(), NWidgetResizeBase::UpdateMultilineWidgetSize(), AIConfigWindow::UpdateWidgetSize(), BuildAirportWindow::UpdateWidgetSize(), ReplaceVehicleWindow::UpdateWidgetSize(), BuildVehicleWindow::UpdateWidgetSize(), CompanyFinancesWindow::UpdateWidgetSize(), SelectCompanyLiveryWindow::UpdateWidgetSize(), CompanyInfrastructureWindow::UpdateWidgetSize(), EnginePreviewWindow::UpdateWidgetSize(), SaveLoadWindow::UpdateWidgetSize(), FramerateWindow::UpdateWidgetSize(), GSConfigWindow::UpdateWidgetSize(), GenerateLandscapeWindow::UpdateWidgetSize(), GenerateProgressWindow::UpdateWidgetSize(), BaseGraphWindow::UpdateWidgetSize(), BaseCargoGraphWindow::UpdateWidgetSize(), PerformanceRatingDetailWindow::UpdateWidgetSize(), BuildIndustryWindow::UpdateWidgetSize(), PerformanceLeagueWindow::UpdateWidgetSize(), ScriptLeagueWindow::UpdateWidgetSize(), LandInfoWindow::UpdateWidgetSize(), AboutWindow::UpdateWidgetSize(), NetworkContentListWindow::UpdateWidgetSize(), BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize(), NetworkGameWindow::UpdateWidgetSize(), NetworkClientListWindow::UpdateWidgetSize(), NewGRFInspectWindow::UpdateWidgetSize(), SpriteAlignerWindow::UpdateWidgetSize(), NewGRFParametersWindow::UpdateWidgetSize(), NewGRFWindow::UpdateWidgetSize(), SavePresetWindow::UpdateWidgetSize(), ScanProgressWindow::UpdateWidgetSize(), MessageHistoryWindow::UpdateWidgetSize(), OrdersWindow::UpdateWidgetSize(), PickerWindow::UpdateWidgetSize(), ScriptListWindow::UpdateWidgetSize(), ScriptSettingsWindow::UpdateWidgetSize(), ScriptDebugWindow::UpdateWidgetSize(), GameOptionsWindow::UpdateWidgetSize(), SignListWindow::UpdateWidgetSize(), CompanyStationsWindow::UpdateWidgetSize(), StationViewWindow::UpdateWidgetSize(), StoryBookWindow::UpdateWidgetSize(), SubsidyListWindow::UpdateWidgetSize(), TextfileWindow::UpdateWidgetSize(), TimetableWindow::UpdateWidgetSize(), TownAuthorityWindow::UpdateWidgetSize(), RefitWindow::UpdateWidgetSize(), VehicleDetailsWindow::UpdateWidgetSize(), VehicleViewWindow::UpdateWidgetSize(), and ViewportAddString().
|
static |
Get name of default font file for a given font size.
fs | Font size. |
Definition at line 179 of file fontcache.cpp.
References FS_LARGE, FS_MONO, FS_NORMAL, and FS_SMALL.
Referenced by GetDefaultTruetypeFontFile().
|
static |
Get path of default font file for a given font size.
fs | Font size. |
Definition at line 196 of file fontcache.cpp.
References BASESET_DIR, FioFindFullPath(), and GetDefaultTruetypeFont().
Referenced by GetFontCacheFontName().
bool GetFontAAState | ( | ) |
Definition at line 107 of file fontcache.cpp.
std::string GetFontCacheFontName | ( | FontSize | fs | ) |
Get font to use for a given font size.
fs | Font size. |
Definition at line 211 of file fontcache.cpp.
References GetDefaultTruetypeFontFile(), GetFontCacheSubSetting(), FontCacheSettings::prefer_sprite, and settings.
Referenced by FreeTypeFontCacheFactory::LoadFont(), CoreTextFontCacheFactory::LoadFont(), and Win32FontCacheFactory::LoadFont().
uint GetFontCacheFontSize | ( | FontSize | fs | ) |
Get the scalable font size to use for a FontSize.
fs | FontSize to get the scalable font size for. |
Definition at line 167 of file fontcache.cpp.
References GetFontCacheSubSetting(), IsDefaultFont(), and FontCacheSubSetting::size.
Referenced by FreeTypeFontCacheFactory::LoadFont(), CoreTextFontCacheFactory::LoadFont(), and Win32FontCacheFactory::LoadFont().
|
static |
Test if a font setting uses the default font.
Definition at line 157 of file fontcache.cpp.
References FontCacheSubSetting::font, and FontCacheSubSetting::os_handle.
Referenced by GetFontCacheFontSize().
void SetFont | ( | FontSize | fontsize, |
const std::string & | font, | ||
uint | size | ||
) |
Definition at line 115 of file fontcache.cpp.
FontCacheSettings _fcsettings |
Definition at line 28 of file fontcache.cpp.