mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Prefer family name in fonts' names table
This commit is contained in:
parent
655e93d584
commit
9bcda8f94c
4 changed files with 61 additions and 10 deletions
|
@ -2110,12 +2110,12 @@ CharString String::utf8() const {
|
|||
|
||||
String String::utf16(const char16_t *p_utf16, int p_len) {
|
||||
String ret;
|
||||
ret.parse_utf16(p_utf16, p_len);
|
||||
ret.parse_utf16(p_utf16, p_len, true);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Error String::parse_utf16(const char16_t *p_utf16, int p_len) {
|
||||
Error String::parse_utf16(const char16_t *p_utf16, int p_len, bool p_default_little_endian) {
|
||||
if (!p_utf16) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
@ -2125,8 +2125,12 @@ Error String::parse_utf16(const char16_t *p_utf16, int p_len) {
|
|||
int cstr_size = 0;
|
||||
int str_size = 0;
|
||||
|
||||
#ifdef BIG_ENDIAN_ENABLED
|
||||
bool byteswap = p_default_little_endian;
|
||||
#else
|
||||
bool byteswap = !p_default_little_endian;
|
||||
#endif
|
||||
/* HANDLE BOM (Byte Order Mark) */
|
||||
bool byteswap = false; // assume correct endianness if no BOM found
|
||||
if (p_len < 0 || p_len >= 1) {
|
||||
bool has_bom = false;
|
||||
if (uint16_t(p_utf16[0]) == 0xfeff) { // correct BOM, read as is
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue