summaryrefslogtreecommitdiff
path: root/core/string
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2020-08-05 09:25:28 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2020-11-26 13:55:26 +0200
commit493da99269b3a111cf58e0352495e25ee49c5f84 (patch)
treebc34af12b8f3697ee6da79c1c44e2cfcd8d4b90c /core/string
parenta8c2cc9028535aa6f474e93b71b09b5b7402c79d (diff)
[Complex Text Layouts] Implement TextServer interface. Implement Fallback TextServer.
Diffstat (limited to 'core/string')
-rw-r--r--core/string/ustring.cpp5
-rw-r--r--core/string/ustring.h7
2 files changed, 6 insertions, 6 deletions
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index 213578485e..d630e987ea 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -209,7 +209,6 @@ void CharString::copy_from(const char *p_cstr) {
/* String */
/*************************************************************************/
-//TODO: move to TextServer
//kind of poor should be rewritten properly
String String::word_wrap(int p_chars_per_line) const {
int from = 0;
@@ -4796,7 +4795,7 @@ Vector<uint8_t> String::to_utf16_buffer() const {
Char16String charstr = s->utf16();
Vector<uint8_t> retval;
- size_t len = charstr.length() * 2;
+ size_t len = charstr.length() * sizeof(char16_t);
retval.resize(len);
uint8_t *w = retval.ptrw();
copymem(w, (const void *)charstr.ptr(), len);
@@ -4811,7 +4810,7 @@ Vector<uint8_t> String::to_utf32_buffer() const {
}
Vector<uint8_t> retval;
- size_t len = s->length() * 4;
+ size_t len = s->length() * sizeof(char32_t);
retval.resize(len);
uint8_t *w = retval.ptrw();
copymem(w, (const void *)s->ptr(), len);
diff --git a/core/string/ustring.h b/core/string/ustring.h
index bfae16fe64..7ff78b2d86 100644
--- a/core/string/ustring.h
+++ b/core/string/ustring.h
@@ -28,8 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef USTRING_H
-#define USTRING_H
+#ifndef USTRING_GODOT_H
+#define USTRING_GODOT_H
+// Note: Renamed to avoid conflict with ICU header with the same name.
#include "core/templates/cowdata.h"
#include "core/templates/vector.h"
@@ -555,4 +556,4 @@ _FORCE_INLINE_ Vector<String> sarray(P... p_args) {
return arr;
}
-#endif // USTRING_H
+#endif // USTRING_GODOT_H