| 1 |
/* This is xdvipsk, an eXtended version of dvips(k) by Tomas Rokicki. |
| 2 |
|
| 3 |
Copyright (C) 2016 by VTeX Ltd (www.vtex.lt), |
| 4 |
the xdvipsk project team - Sigitas Tolusis and Arunas Povilaitis. |
| 5 |
|
| 6 |
Program original code copyright (C) 2007-2014 by Jin-Hwan Cho and |
| 7 |
Shunsaku Hirata, the dvipdfmx project team. |
| 8 |
|
| 9 |
This program is free software; you can redistribute it and/or modify |
| 10 |
it under the terms of the GNU General Public License as published by |
| 11 |
the Free Software Foundation; either version 2 of the License, or |
| 12 |
(at your option) any later version. |
| 13 |
|
| 14 |
This program is distributed in the hope that it will be useful, |
| 15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
GNU General Public License for more details. |
| 18 |
|
| 19 |
You should have received a copy of the GNU General Public License |
| 20 |
along with this program; if not, write to the Free Software |
| 21 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef _UNICODE_H_ |
| 25 |
#define _UNICODE_H_ |
| 26 |
|
| 27 |
/* UCS -> UTF-8 */ |
| 28 |
#define UCStoUTF8B1(x) (0xc0 + (((x) >> 6) & 0x1f)) |
| 29 |
#define UCStoUTF8B2(x) (0x80 + (((x) ) & 0x3f)) |
| 30 |
|
| 31 |
#define UCStoUTF8C1(x) (0xe0 + (((x) >> 12) & 0x0f)) |
| 32 |
#define UCStoUTF8C2(x) (0x80 + (((x) >> 6) & 0x3f)) |
| 33 |
#define UCStoUTF8C3(x) (0x80 + (((x) ) & 0x3f)) |
| 34 |
|
| 35 |
#define UCStoUTF8D1(x) (0xf0 + (((x) >> 18) & 0x07)) |
| 36 |
#define UCStoUTF8D2(x) (0x80 + (((x) >> 12) & 0x3f)) |
| 37 |
#define UCStoUTF8D3(x) (0x80 + (((x) >> 6) & 0x3f)) |
| 38 |
#define UCStoUTF8D4(x) (0x80 + (((x) ) & 0x3f)) |
| 39 |
|
| 40 |
/* UTF-32 over U+FFFF -> UTF-16 surrogate pair */ |
| 41 |
#define UTF32toUTF16HS(x) (0xd800 + (((x-0x10000) >> 10) & 0x3ff)) |
| 42 |
#define UTF32toUTF16LS(x) (0xdc00 + ( x & 0x3ff)) |
| 43 |
|
| 44 |
extern unsigned int* uni32_2_utf16(unsigned long ucode, int* p_ucnt); |
| 45 |
extern unsigned long *utf16_2_uni32(const unsigned int *tounicode, int ucnt, int *p_uni32_cnt); |
| 46 |
|
| 47 |
extern int UC_sput_UTF16BE (long ucv, unsigned char **dstpp, unsigned char *endptr); |
| 48 |
extern int UC_is_valid (long ucv); |
| 49 |
|
| 50 |
#endif /* _UNICODE_H_ */ |