diff options
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh')
-rw-r--r-- | src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh index 0b798a05c3..14d3c2e369 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh +++ b/src/3rdparty/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 */ |