OpenTTD Source
20241121-master-g67a0fccfad
|
Functions related to localized text support on OSX. More...
#include "../../stdafx.h"
#include "string_osx.h"
#include "../../string_func.h"
#include "../../strings_func.h"
#include "../../table/control_codes.h"
#include "../../fontcache.h"
#include "../../zoom_func.h"
#include "macos.h"
#include <CoreFoundation/CoreFoundation.h>
Go to the source code of this file.
Data Structures | |
struct | CTRunDelegateCallbacks |
class | CoreTextParagraphLayout |
Wrapper for doing layouts with CoreText. More... | |
class | CoreTextParagraphLayout::CoreTextVisualRun |
Visual run contains data about the bit of text with the same font. More... | |
class | CoreTextParagraphLayout::CoreTextLine |
A single line worth of VisualRuns. More... | |
Enumerations | |
enum | { kCTRunDelegateVersion1 = 1 , kCTRunDelegateCurrentVersion = kCTRunDelegateVersion1 } |
Functions | |
CTRunDelegateRef | CTRunDelegateCreate (const CTRunDelegateCallbacks *callbacks, void *refCon) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER |
static CGFloat | SpriteFontGetWidth (void *ref_con) |
Get the width of an encoded sprite font character. More... | |
void | MacOSResetScriptCache (FontSize size) |
Delete CoreText font reference for a specific font size. | |
void | MacOSRegisterExternalFont (const char *file_path) |
Register an external font file with the CoreText system. | |
void | MacOSSetCurrentLocaleName (const char *iso_code) |
Store current language locale as a CoreFoundation locale. | |
int | MacOSStringCompare (std::string_view s1, std::string_view s2) |
Compares two strings using case insensitive natural sort. More... | |
int | MacOSStringContains (const std::string_view str, const std::string_view value, bool case_insensitive) |
Search if a string is contained in another string using the current locale. More... | |
Variables | |
const CFStringRef kCTRunDelegateAttributeName | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER |
static CFAutoRelease< CFLocaleRef > | _osx_locale |
Cached current locale. | |
static CFAutoRelease< CTFontRef > | _font_cache [FS_END] |
CoreText cache for font information, cleared when OTTD changes fonts. | |
static CTRunDelegateCallbacks | _sprite_font_callback |
Functions related to localized text support on OSX.
Definition in file string_osx.cpp.
int MacOSStringCompare | ( | std::string_view | s1, |
std::string_view | s2 | ||
) |
Compares two strings using case insensitive natural sort.
s1 | First string to compare. |
s2 | Second string to compare. |
Definition at line 329 of file string_osx.cpp.
References _osx_locale, and MacOSVersionIsAtLeast().
int MacOSStringContains | ( | const std::string_view | str, |
const std::string_view | value, | ||
bool | case_insensitive | ||
) |
Search if a string is contained in another string using the current locale.
str | String to search in. |
value | String to search for. |
case_insensitive | Search case-insensitive. |
Definition at line 353 of file string_osx.cpp.
References _osx_locale, and MacOSVersionIsAtLeast().
Referenced by StrNaturalContains(), and StrNaturalContainsIgnoreCase().
|
static |
Get the width of an encoded sprite font character.
Definition at line 138 of file string_osx.cpp.
References GetGlyphWidth().
|
static |
Definition at line 146 of file string_osx.cpp.