From 835e373b3eeaabcd0621ed6798ab500f37982fae Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Wed, 5 Apr 2023 14:13:39 -0400 Subject: xpdf-no-select-disable --- xpdf/UTF8.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 xpdf/UTF8.h (limited to 'xpdf/UTF8.h') diff --git a/xpdf/UTF8.h b/xpdf/UTF8.h new file mode 100644 index 0000000..1f29030 --- /dev/null +++ b/xpdf/UTF8.h @@ -0,0 +1,42 @@ +//======================================================================== +// +// UTF8.h +// +// Copyright 2001-2017 Glyph & Cog, LLC +// +//======================================================================== + +#ifndef UTF8_H +#define UTF8_H + +#include + +#include "gtypes.h" +#include "GString.h" +#include "CharTypes.h" + +// Convert [u] to UTF-8 in [buf]. Returns the number of bytes written +// to [buf]. If [u] requires more then [bufSize] bytes in UTF-8, +// writes nothing and returns 0. +extern int mapUTF8(Unicode u, char *buf, int bufSize); + +// Convert [u] to UCS-2BE in [buf]. Returns the number of bytes +// written to [buf]. If [u] requires more then [bufSize] bytes in +// UCS-2, writes nothing and returns 0. +extern int mapUCS2(Unicode u, char *buf, int bufSize); + +// Parse one UTF-8 character from [s], starting at *[i]. Writes the +// character to *[u], updates *[i] to point to the next available byte +// in [s], and returns true. At end of string: writes nothing to *[u] +// or *[i] and returns false. For an invalid UTF-8 character: sets +// *[u] to the next byte, advances *[i] by one (to avoid infinite +// loops), and returns true. +extern GBool getUTF8(GString *s, int *i, Unicode *u); + +// Same as getUTF8, but for UTF-16BE. +extern GBool getUTF16BE(GString *s, int *i, Unicode *u); + +// Same as getUTF8, but for UTF-16LE. +extern GBool getUTF16LE(GString *s, int *i, Unicode *u); + +#endif -- cgit v1.2.3