X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=utf8lib.h;h=f54547764981b299f3419b028540d16853461746;hp=36c16fe1444d967a255cbe11d87f2904929f6d8b;hb=ef993d0f1682d3fb86bdef33043d7b106ce51d13;hpb=cfee52a1ec9db338098789cae89ae5cf1f7a6fbf diff --git a/utf8lib.h b/utf8lib.h index 36c16fe1..f5454776 100644 --- a/utf8lib.h +++ b/utf8lib.h @@ -4,21 +4,15 @@ #ifndef UTF8LIB_H__ #define UTF8LIB_H__ +#include #include "qtypes.h" // types for unicode strings // let them be 32 bit for now // normally, whcar_t is 16 or 32 bit, 16 on linux I think, 32 on haiku and maybe windows -#ifdef _MSC_VER -typedef __int32 U_int32; -#else -#include -#include -typedef int32_t U_int32; -#endif // Uchar, a wide character -typedef U_int32 Uchar; +typedef int32_t Uchar; // Initialize UTF8, this registers cvars which allows for UTF8 to be disabled // completely. @@ -26,7 +20,7 @@ typedef U_int32 Uchar; // a non-utf8 version to work: u8_strlen() will wrap to strlen() // u8_byteofs() and u8_charidx() will simply return whatever is passed as index parameter // u8_getchar() will will just return the next byte, u8_fromchar will write one byte, ... -extern cvar_t utf8_enable; +extern struct cvar_s utf8_enable; void u8_Init(void); size_t u8_strlen(const char*); @@ -40,12 +34,13 @@ Uchar u8_getnchar_utf8_enabled(const char*, const char**, size_t); int u8_fromchar(Uchar, char*, size_t); size_t u8_mbstowcs(Uchar *, const char *, size_t); size_t u8_wcstombs(char*, const Uchar*, size_t); -size_t u8_COM_StringLengthNoColors(const char *s, size_t size_s, qboolean *valid); +size_t u8_COM_StringLengthNoColors(const char *s, size_t size_s, qbool *valid); // returns a static buffer, use this for inlining char *u8_encodech(Uchar ch, size_t*, char*buf16); -size_t u8_strpad(char *out, size_t outsize, const char *in, qboolean leftalign, size_t minwidth, size_t maxwidth); +size_t u8_strpad(char *out, size_t outsize, const char *in, qbool leftalign, size_t minwidth, size_t maxwidth); +size_t u8_strpad_colorcodes(char *out, size_t outsize, const char *in, qbool leftalign, size_t minwidth, size_t maxwidth); /* Careful: if we disable utf8 but not freetype, we wish to see freetype chars * for normal letters. So use E000+x for special chars, but leave the freetype stuff for the