|
OpenTTD Source 20251104-master-g3befbdd52f
|
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 "../../core/utf8.hpp"#include "../../table/control_codes.h"#include "../../fontcache.h"#include "../../zoom_func.h"#include "macos.h"#include <CoreFoundation/CoreFoundation.h>#include "../../safeguards.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... | |
Typedefs | |
| typedef const struct __CTRunDelegate * | CTRunDelegateRef |
| typedef void(* | CTRunDelegateDeallocateCallback) (void *refCon) |
| typedef CGFloat(* | CTRunDelegateGetAscentCallback) (void *refCon) |
| typedef CGFloat(* | CTRunDelegateGetDescentCallback) (void *refCon) |
| typedef CGFloat(* | CTRunDelegateGetWidthCallback) (void *refCon) |
Enumerations | |
| enum | : int32_t { 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. | |
| void | MacOSResetScriptCache (FontSize size) |
| Delete CoreText font reference for a specific font size. | |
| void | MacOSRegisterExternalFont (std::string_view file_path) |
| Register an external font file with the CoreText system. | |
| void | MacOSSetCurrentLocaleName (std::string_view 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. | |
| int | MacOSStringContains (std::string_view str, std::string_view value, bool case_insensitive) |
| Search if a string is contained in another string using the current locale. | |
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 const CTRunDelegateCallbacks | _sprite_font_callback |
Functions related to localized text support on OSX.
Definition in file string_osx.cpp.
| typedef void(* CTRunDelegateDeallocateCallback) (void *refCon) |
Definition at line 29 of file string_osx.cpp.
| typedef CGFloat(* CTRunDelegateGetAscentCallback) (void *refCon) |
Definition at line 30 of file string_osx.cpp.
| typedef CGFloat(* CTRunDelegateGetDescentCallback) (void *refCon) |
Definition at line 31 of file string_osx.cpp.
| typedef CGFloat(* CTRunDelegateGetWidthCallback) (void *refCon) |
Definition at line 32 of file string_osx.cpp.
| typedef const struct __CTRunDelegate* CTRunDelegateRef |
Definition at line 27 of file string_osx.cpp.
| anonymous enum : int32_t |
Definition at line 41 of file string_osx.cpp.
| void MacOSRegisterExternalFont | ( | std::string_view | file_path | ) |
Register an external font file with the CoreText system.
Definition at line 305 of file string_osx.cpp.
References MacOSVersionIsAtLeast().
| void MacOSResetScriptCache | ( | FontSize | size | ) |
Delete CoreText font reference for a specific font size.
Definition at line 299 of file string_osx.cpp.
References _font_cache.
Referenced by Layouter::ResetFontCache().
| void MacOSSetCurrentLocaleName | ( | std::string_view | iso_code | ) |
Store current language locale as a CoreFoundation locale.
Definition at line 316 of file string_osx.cpp.
References _osx_locale, and MacOSVersionIsAtLeast().
Referenced by ReadLanguagePack().
| 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 331 of file string_osx.cpp.
References _osx_locale, and MacOSVersionIsAtLeast().
Referenced by StrNaturalCompare().
| int MacOSStringContains | ( | std::string_view | str, |
| 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 355 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 140 of file string_osx.cpp.
References GetGlyphWidth().
|
static |
CoreText cache for font information, cleared when OTTD changes fonts.
Definition at line 55 of file string_osx.cpp.
Referenced by CoreTextParagraphLayoutFactory::GetParagraphLayout(), and MacOSResetScriptCache().
|
static |
Cached current locale.
Definition at line 53 of file string_osx.cpp.
Referenced by MacOSSetCurrentLocaleName(), MacOSStringCompare(), MacOSStringContains(), and OSXStringIterator::SetString().
|
static |
Definition at line 148 of file string_osx.cpp.