Index: third_party/harfbuzz-ng/src/hb-utf-private.hh |
diff --git a/third_party/harfbuzz-ng/src/hb-utf-private.hh b/third_party/harfbuzz-ng/src/hb-utf-private.hh |
index 0b798a05c30c5ea1fc0931aa13b44085c7a7f403..14d3c2e369b97e1241d16dee3e538750a37dd4b5 100644 |
--- a/third_party/harfbuzz-ng/src/hb-utf-private.hh |
+++ b/third_party/harfbuzz-ng/src/hb-utf-private.hh |
@@ -29,14 +29,11 @@ |
#include "hb-private.hh" |
-template <typename T, bool validate=true> struct hb_utf_t; |
- |
-/* UTF-8 */ |
- |
-template <> |
-struct hb_utf_t<uint8_t, true> |
+struct hb_utf8_t |
{ |
+ typedef uint8_t codepoint_t; |
+ |
static inline const uint8_t * |
next (const uint8_t *text, |
const uint8_t *end, |
@@ -131,11 +128,10 @@ struct hb_utf_t<uint8_t, true> |
}; |
-/* UTF-16 */ |
- |
-template <> |
-struct hb_utf_t<uint16_t, true> |
+struct hb_utf16_t |
{ |
+ typedef uint16_t codepoint_t; |
+ |
static inline const uint16_t * |
next (const uint16_t *text, |
const uint16_t *end, |
@@ -204,11 +200,11 @@ struct hb_utf_t<uint16_t, true> |
}; |
-/* UTF-32 */ |
- |
-template <bool validate> |
-struct hb_utf_t<uint32_t, validate> |
+template <bool validate=true> |
+struct hb_utf32_t |
{ |
+ typedef uint32_t codepoint_t; |
+ |
static inline const uint32_t * |
next (const uint32_t *text, |
const uint32_t *end HB_UNUSED, |
@@ -246,4 +242,37 @@ struct hb_utf_t<uint32_t, validate> |
}; |
+struct hb_latin1_t |
+{ |
+ typedef uint8_t codepoint_t; |
+ |
+ static inline const uint8_t * |
+ next (const uint8_t *text, |
+ const uint8_t *end HB_UNUSED, |
+ hb_codepoint_t *unicode, |
+ hb_codepoint_t replacement HB_UNUSED) |
+ { |
+ *unicode = *text++; |
+ return text; |
+ } |
+ |
+ static inline const uint8_t * |
+ prev (const uint8_t *text, |
+ const uint8_t *start HB_UNUSED, |
+ hb_codepoint_t *unicode, |
+ hb_codepoint_t replacement) |
+ { |
+ *unicode = *--text; |
+ return text; |
+ } |
+ |
+ static inline unsigned int |
+ strlen (const uint8_t *text) |
+ { |
+ unsigned int l = 0; |
+ while (*text++) l++; |
+ return l; |
+ } |
+}; |
+ |
#endif /* HB_UTF_PRIVATE_HH */ |