10 #ifndef STRINGS_FUNC_H
11 #define STRINGS_FUNC_H
63 const char *GetStringPtr(
StringID string);
79 return speed | (
static_cast<uint64_t
>(type) << 56);
86 template <typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value,
int> = 0>
92 template <typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value,
int> = 0>
102 void CopyInDParam(
const std::span<const StringParameterData> backup);
103 void CopyOutDParam(std::vector<StringParameterData> &backup,
size_t num);
Functions related to bit mathematics.
A searcher for missing glyphs.
virtual void Reset()=0
Reset the search, i.e.
virtual void SetFontNames(struct FontCacheSettings *settings, const char *font_name, const void *os_data=nullptr)=0
Set the right font names.
virtual std::optional< std::string_view > NextString()=0
Get the next string to search through.
virtual FontSize DefaultSize()=0
Get the default (font) size of the string.
bool FindMissingGlyphs()
Check whether there are glyphs missing in the current language.
virtual bool Monospace()=0
Whether to search for a monospace font or not.
virtual ~MissingGlyphSearcher()=default
Make sure everything gets destructed right.
fluid_settings_t * settings
FluidSynth settings handle.
Types related to the graphics and/or input devices.
FontSize
Available font sizes.
@ FS_NORMAL
Index of the normal font in the font tables.
void AppendStringInPlace(std::string &result, StringID string)
Resolve the given StringID and append in place into an existing std::string with all the associated D...
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
StringTab GetStringTab(StringID str)
Extract the StringTab from a StringID.
uint ConvertDisplaySpeedToKmhishSpeed(uint speed, VehicleType type)
Convert the given display speed to the km/h-ish speed.
uint64_t GetDParam(size_t n)
Get the current string parameter at index n from the global string parameter array.
std::string GetString(StringID string)
Resolve the given StringID into a std::string with all the associated DParam lookups and formatting.
void CheckForMissingGlyphs(bool base_font=true, MissingGlyphSearcher *search=nullptr)
Check whether the currently loaded language pack uses characters that the currently loaded font does ...
void CopyOutDParam(std::vector< StringParameterData > &backup, size_t num)
Copy num string parameters from the global string parameter array to the backup.
void CopyInDParam(const std::span< const StringParameterData > backup)
Copy the parameters from the backup into the global string parameter array.
uint ConvertKmhishSpeedToDisplaySpeed(uint speed, VehicleType type)
Convert the given km/h-ish speed to the display speed.
void InitializeLanguagePacks()
Make a list of the available language packs.
bool HaveDParamChanged(const std::span< const StringParameterData > backup)
Checks whether the global string parameters have changed compared to the given backup.
TextDirection _current_text_dir
Text direction of the currently selected language.
const char * GetCurrentLanguageIsoCode()
Get the ISO language code of the currently loaded language.
int64_t PackVelocity(uint speed, VehicleType type)
Pack velocity and vehicle type for use with SCC_VELOCITY string parameter.
StringID MakeStringID(StringTab tab, uint index)
Create a StringID.
void SetDParamMaxValue(size_t n, uint64_t max_value, uint min_count=0, FontSize size=FS_NORMAL)
Set DParam n to some number that is suitable for string size computations.
void SetDParamStr(size_t n, const char *str)
This function is used to "bind" a C string to a OpenTTD dparam slot.
uint GetStringIndex(StringID str)
Extract the StringIndex from a StringID.
void SetDParamMaxDigits(size_t n, uint count, FontSize size=FS_NORMAL)
Set DParam n to some number that is suitable for string size computations.
Types related to strings.
TextDirection
Directions a text can go to.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
static const uint TAB_SIZE_NEWGRF
Number of strings for NewGRFs.
static const uint TAB_SIZE_GAMESCRIPT
Number of strings for GameScripts.
static const uint TAB_SIZE_BITS
Number of bits for the StringIndex within a StringTab.
static const uint TAB_SIZE
Number of strings per StringTab.
StringTab
StringTabs to group StringIDs.
@ TEXT_TAB_NEWGRF_START
Start of NewGRF supplied strings.
@ TEXT_TAB_GAMESCRIPT_START
Start of GameScript supplied strings.
@ TEXT_TAB_END
End of language files.
Type (helpers) for making a strong typedef that is a distinct type.
Settings for the four different fonts.
Types related to vehicles.
VehicleType
Available vehicle types.