| 1 | #ifndef _UT_STRUCT_H |
|---|
| 2 | #define _UT_STRUCT_H |
|---|
| 3 | |
|---|
| 4 | #include "utfAPI.h" |
|---|
| 5 | |
|---|
| 6 | #ifdef __cplusplus |
|---|
| 7 | extern "C" { |
|---|
| 8 | #endif |
|---|
| 9 | |
|---|
| 10 | /* History ****************************************************************** |
|---|
| 11 | 2005³â10¿ù13ÀÏ: ¹öÀü 2.2 |
|---|
| 12 | 1. ÆÄÀϱ¸Á¶ È®Á¤(2.0,2.1 »ç¿ëÇÒ¼ö ¾øÀ½) - utfTool.exe 1.95 ÀÌÈÄ ¹öÀü »ç¿ë |
|---|
| 13 | 2. TrueType Instruction engine¿¡¼ global data Á¦°Å |
|---|
| 14 | 2005³â10¿ù7ÀÏ: ¹öÀü 2.1 |
|---|
| 15 | 2005³â10¿ù4ÀÏ: ¹öÀü 2.0 |
|---|
| 16 | 1. TrueType Instruction ¼öÇà (´ÙÀ½À» Á¤ÀÇÇØ¾ß ÇÔ) |
|---|
| 17 | #define _UT_USE_ENHANCED_RASTERIZER |
|---|
| 18 | 2. xGrayType, yGrayType, grayAdjustValue´Â ÀÌ ÆùÆ®¿£ Àû¿ëµÇÁö ¾ÊÀ½ |
|---|
| 19 | 2005³â9¿ù27ÀÏ: ¹öÀü 1.2 |
|---|
| 20 | 1. Edge(Outlineµî) ¼³Á¤½Ã ¹®Á¦ ¼öÁ¤ |
|---|
| 21 | 2. SnapPos ¹®Á¦ ¼öÁ¤ |
|---|
| 22 | 2005³â9¿ù18ÀÏ: ¹öÀü 1.1 |
|---|
| 23 | 1. ÆùÆ®¿¡ xGrayType, yGrayType, grayAdjustValue, Kerning °ª Ãß°¡ |
|---|
| 24 | 2. utm_SetGrayType, ut_SetGrayType »ç¿ëÇÏÁö ¾Ê°í È®ÀåµÈ utm_SetGrayStyle·Î º¯°æ |
|---|
| 25 | 3. utm_SetGrayStyle(UT_FC* fc, int xGrayType, int yGrayType, int grayAdjust, int grayAdjustValue); |
|---|
| 26 | xGrayType, yGrayType: _UT_GRAY_TYPE_DEFAULT, _UT_GRAY_TYPE_PRE3_POST0, ... |
|---|
| 27 | _UT_GRAY_TYPE_DEFAULTÀÌ¸é ÆùÆ®¿¡ Á¤ÇØÁø °ª »ç¿ë. |
|---|
| 28 | ±×·¸Áö ¾ÊÀ¸¸é ¿©±â¼ ÁöÁ¤ÇÑ xGrayType, yGrayType°ª »ç¿ë. |
|---|
| 29 | grayAdjust: _UT_GRAY_ADJUST_DEFAULT, _UT_GRAY_ADJUST_USER |
|---|
| 30 | _UT_GRAY_ADJUST_DEFAULTÀÌ¸é ÆùÆ®¿¡ Á¤ÇØÁø °ª »ç¿ë. |
|---|
| 31 | ±×·¸Áö ¾ÊÀ¸¸é ¿©±â¼ ÁöÁ¤ÇÑ grayAdjustValue °ª »ç¿ë. |
|---|
| 32 | 4. int utm_GetKerning(UT_FC* fc, UT_CODE leftCode, UT_CODE rightCode); ±¸Çö |
|---|
| 33 | ´ÙÀ½ ±ÛÀÚÀÇ À§Ä¡ ÁöÁ¤ÇÒ¶§ ÇöÀç ±ÛÀÚÀÇ Æø°ú ÇöÀç±ÛÀÚ¿Í ´ÙÀ½±ÛÀÚÀÇ Ä¿´× °ªÀ» ´õÇÑ´Ù. |
|---|
| 34 | xPos += UT_IMAGE.xAdvance + utm_GetKerning(ut_fc, currCode, nextCode); |
|---|
| 35 | ****************************************************************************/ |
|---|
| 36 | |
|---|
| 37 | /***************************************************************************/ |
|---|
| 38 | /* WordType of CPU & FONT */ |
|---|
| 39 | |
|---|
| 40 | #define _UT_LITTLE_ENDIAN 0 /* Intel Type Processor */ |
|---|
| 41 | #define _UT_BIG_ENDIAN 1 /* Motorola Type Processor */ |
|---|
| 42 | |
|---|
| 43 | #if defined(_UT_CPU_ENDIAN) && defined(WIN32) |
|---|
| 44 | #undef _UT_CPU_ENDIAN |
|---|
| 45 | #endif |
|---|
| 46 | |
|---|
| 47 | #ifndef _UT_CPU_ENDIAN |
|---|
| 48 | #if defined(_UT_CPU_IS_LITTLE_ENDIAN) || defined(WIN32) |
|---|
| 49 | #define _UT_CPU_ENDIAN _UT_LITTLE_ENDIAN |
|---|
| 50 | #elif defined(_UT_CPU_IS_BIG_ENDIAN) |
|---|
| 51 | #define _UT_CPU_ENDIAN _UT_BIG_ENDIAN |
|---|
| 52 | #else |
|---|
| 53 | #define _UT_CPU_ENDIAN _UT_BIG_ENDIAN |
|---|
| 54 | #endif |
|---|
| 55 | #endif /*#ifndef _UT_CPU_ENDIAN*/ |
|---|
| 56 | |
|---|
| 57 | #ifndef _UT_FONT_ENDIAN |
|---|
| 58 | #if defined(_UT_FONT_IS_LITTLE_ENDIAN) |
|---|
| 59 | #define _UT_FONT_ENDIAN _UT_LITTLE_ENDIAN |
|---|
| 60 | #elif defined(_UT_FONT_IS_BIG_ENDIAN) |
|---|
| 61 | #define _UT_FONT_ENDIAN _UT_BIG_ENDIAN |
|---|
| 62 | #else |
|---|
| 63 | #define _UT_FONT_ENDIAN _UT_BIG_ENDIAN |
|---|
| 64 | #endif |
|---|
| 65 | #endif /*#ifndef _UT_FONT_ENDIAN*/ |
|---|
| 66 | |
|---|
| 67 | /***************************************************************************/ |
|---|
| 68 | /* Constant and Macro */ |
|---|
| 69 | |
|---|
| 70 | #define _UT_INVALID_CODE ((UT_CODE)-1) |
|---|
| 71 | |
|---|
| 72 | #ifdef _UT_USER_SWAP |
|---|
| 73 | UT_I16 ut_SWAP_I16(unsigned v); |
|---|
| 74 | UT_I32 ut_SWAP_I32(unsigned v); |
|---|
| 75 | UT_U16 ut_SWAP_U16(unsigned v); |
|---|
| 76 | UT_U32 ut_SWAP_U32(unsigned v); |
|---|
| 77 | #else |
|---|
| 78 | #if (_UT_CPU_ENDIAN != _UT_FONT_ENDIAN) |
|---|
| 79 | #define ut_SWAP_I16(v) (UT_I16)((((v)>>8) & 0xff) | (((v)&0xff) << 8)) |
|---|
| 80 | #define ut_SWAP_I32(v) (UT_I32)((((v)>>24) & 0xff) | (((v)>>8) & 0xff00) | (((v)&0xff00) << 8) | (((v)&0xff) << 24)) |
|---|
| 81 | #define ut_SWAP_U16(v) (UT_U16)((((v)>>8) & 0xff) | (((v)&0xff) << 8)) |
|---|
| 82 | #define ut_SWAP_U32(v) (UT_U32)((((v)>>24) & 0xff) | (((v)>>8) & 0xff00) | (((v)&0xff00) << 8) | (((v)&0xff) << 24)) |
|---|
| 83 | #else |
|---|
| 84 | #define ut_SWAP_I16(v) (UT_I16)(v) |
|---|
| 85 | #define ut_SWAP_I32(v) (UT_I32)(v) |
|---|
| 86 | #define ut_SWAP_U16(v) (UT_U16)(v) |
|---|
| 87 | #define ut_SWAP_U32(v) (UT_U32)(v) |
|---|
| 88 | #endif |
|---|
| 89 | #endif |
|---|
| 90 | |
|---|
| 91 | #define ut_PTR(address, offset) ((char*)(address) + (offset)) |
|---|
| 92 | #define ut_CMAP_OFFSET() sizeof(UT_FONT) |
|---|
| 93 | #define ut_HEAD_CMAP(font) (UT_CMAP*)ut_PTR(font, ut_CMAP_OFFSET()) |
|---|
| 94 | #define ut_NEXT_CMAP(cmap) (UT_CMAP*)ut_PTR(cmap, ut_SWAP_U32((cmap)->length)) |
|---|
| 95 | #define ut_MORE(font) ut_PTR(font, ut_SWAP_U32((font)->moreOffset)) |
|---|
| 96 | #define ut_METX(cmap) ut_PTR(cmap, ut_SWAP_U32((cmap)->metxOffset)) |
|---|
| 97 | #define ut_LOCA(cmap) ut_PTR(cmap, ut_SWAP_U32((cmap)->loca.offset)) |
|---|
| 98 | #define ut_GLYF(cmap,offset) ut_PTR(cmap, ut_SWAP_U32((cmap)->glyfOffset)+(offset)) |
|---|
| 99 | #define ut_BSIZE32(x) (((x + 31) >> 5) << 2) |
|---|
| 100 | #define ut_BSIZE8(x) ((x + 7) >> 3) |
|---|
| 101 | #ifndef ut_RGB |
|---|
| 102 | #define ut_RGB(r,g,b) (((r)<<16) | ((g)<<8) | ((b))) |
|---|
| 103 | #endif |
|---|
| 104 | #ifndef ut_RGB_R |
|---|
| 105 | #define ut_RGB_R(rgb) (((rgb) >> 16) & 255) |
|---|
| 106 | #endif |
|---|
| 107 | #ifndef ut_RGB_G |
|---|
| 108 | #define ut_RGB_G(rgb) (((rgb) >> 8) & 255) |
|---|
| 109 | #endif |
|---|
| 110 | #ifndef ut_RGB_B |
|---|
| 111 | #define ut_RGB_B(rgb) (((rgb) >> 0) & 255) |
|---|
| 112 | #endif |
|---|
| 113 | #ifndef ut_ARGB |
|---|
| 114 | #define ut_ARGB(a,r,g,b) (((a)<<24) | ((r)<<16) | ((g)<<8) | ((b))) |
|---|
| 115 | #endif |
|---|
| 116 | #ifndef ut_RGB_A |
|---|
| 117 | #define ut_RGB_A(rgb) (((rgb) >> 24) & 255) |
|---|
| 118 | #endif |
|---|
| 119 | |
|---|
| 120 | #define _UT_END 0 |
|---|
| 121 | |
|---|
| 122 | /***************************************************************************/ |
|---|
| 123 | /* Basic Data Type */ |
|---|
| 124 | |
|---|
| 125 | #define UT_FIXED signed long |
|---|
| 126 | #define UT_PARAM unsigned long |
|---|
| 127 | |
|---|
| 128 | typedef struct UT_BBOX1 |
|---|
| 129 | { |
|---|
| 130 | UT_I8 ox; |
|---|
| 131 | UT_I8 oy; |
|---|
| 132 | UT_U8 sx; |
|---|
| 133 | UT_U8 sy; |
|---|
| 134 | } UT_BBOX1; |
|---|
| 135 | |
|---|
| 136 | typedef UT_BBOX UT_BBOX2; |
|---|
| 137 | |
|---|
| 138 | typedef union UT_POINTER |
|---|
| 139 | { |
|---|
| 140 | int i; |
|---|
| 141 | void* v; |
|---|
| 142 | char* p; |
|---|
| 143 | UT_U8* u8; |
|---|
| 144 | UT_I8* i8; |
|---|
| 145 | UT_U16* u16; |
|---|
| 146 | UT_I16* i16; |
|---|
| 147 | UT_U32* u32; |
|---|
| 148 | UT_I32* i32; |
|---|
| 149 | UT_BBOX1* bbox1; |
|---|
| 150 | } UT_POINTER; |
|---|
| 151 | |
|---|
| 152 | /***************************************************************************/ |
|---|
| 153 | /* MTEX Table */ |
|---|
| 154 | |
|---|
| 155 | enum |
|---|
| 156 | { |
|---|
| 157 | _UT_METX_FIXED, |
|---|
| 158 | _UT_METX_VARIABLE_BYTE, |
|---|
| 159 | _UT_METX_VARIABLE_SHORT, |
|---|
| 160 | _UT_METX_JOHAP, |
|---|
| 161 | _UT_METX_UNKNOWNED, |
|---|
| 162 | _UT_METX_JOHAP_BYTE, |
|---|
| 163 | _UT_METX_JOHAP_SHORT |
|---|
| 164 | }; |
|---|
| 165 | |
|---|
| 166 | typedef struct UT_METX_JOHAP |
|---|
| 167 | { |
|---|
| 168 | UT_U8 groupMap[3][32]; |
|---|
| 169 | UT_U8 nGroup[3]; |
|---|
| 170 | UT_U8 isByte; |
|---|
| 171 | union |
|---|
| 172 | { |
|---|
| 173 | UT_I8 b[4]; |
|---|
| 174 | UT_I16 s[2]; |
|---|
| 175 | } value; |
|---|
| 176 | } UT_METX_JOHAP; |
|---|
| 177 | |
|---|
| 178 | /***************************************************************************/ |
|---|
| 179 | /* LOCA Table */ |
|---|
| 180 | |
|---|
| 181 | enum |
|---|
| 182 | { |
|---|
| 183 | _UT_LOCA_FIXED, |
|---|
| 184 | _UT_LOCA_SHORT, |
|---|
| 185 | _UT_LOCA_LONG, |
|---|
| 186 | _UT_LOCA_UNKNOWNED |
|---|
| 187 | }; |
|---|
| 188 | |
|---|
| 189 | typedef struct UT_LOCA_SHORT |
|---|
| 190 | { |
|---|
| 191 | UT_U16 offset[2]; |
|---|
| 192 | } UT_LOCA_SHORT; |
|---|
| 193 | |
|---|
| 194 | typedef struct UT_LOCA_LONG |
|---|
| 195 | { |
|---|
| 196 | UT_U32 offset[1]; |
|---|
| 197 | } UT_LOCA_LONG; |
|---|
| 198 | |
|---|
| 199 | /***************************************************************************/ |
|---|
| 200 | /* CMAP Table */ |
|---|
| 201 | |
|---|
| 202 | enum |
|---|
| 203 | { |
|---|
| 204 | _UT_CMAP_CONTINUOUS, |
|---|
| 205 | _UT_CMAP_BLOCK, |
|---|
| 206 | _UT_CMAP_SPARSE, |
|---|
| 207 | _UT_CMAP_MAPPING, |
|---|
| 208 | _UT_CMAP_JOHAP_1, |
|---|
| 209 | _UT_CMAP_JOHAP_2, |
|---|
| 210 | _UT_CMAP_JOHAP_3, |
|---|
| 211 | _UT_CMAP_UNKNOWNED |
|---|
| 212 | }; |
|---|
| 213 | |
|---|
| 214 | enum |
|---|
| 215 | { |
|---|
| 216 | _UT_CMAP_JOHAP_LEVEL_UNI_11172, |
|---|
| 217 | _UT_CMAP_JOHAP_LEVEL_KS_2350 |
|---|
| 218 | }; |
|---|
| 219 | |
|---|
| 220 | enum |
|---|
| 221 | { |
|---|
| 222 | _UT_GLYPH_BBOX_NO, |
|---|
| 223 | _UT_GLYPH_BBOX_FIXED = _UT_GLYPH_BBOX_NO, |
|---|
| 224 | _UT_GLYPH_BBOX_1, |
|---|
| 225 | _UT_GLYPH_BBOX_X, |
|---|
| 226 | _UT_GLYPH_BBOX_Y |
|---|
| 227 | }; |
|---|
| 228 | |
|---|
| 229 | enum |
|---|
| 230 | { |
|---|
| 231 | _UT_OUTLINE_TYPE_SPLINE = -1, |
|---|
| 232 | _UT_OUTLINE_TYPE_BEZIER = -2, |
|---|
| 233 | _UT_OUTLINE_TYPE_TTF = -3, |
|---|
| 234 | _UT_BITMAP_TYPE_IMG = 1, |
|---|
| 235 | _UT_BITMAP_TYPE_SBM, |
|---|
| 236 | _UT_BITMAP_TYPE_LCD, |
|---|
| 237 | _UT_BITMAP_TYPE_IMGP, |
|---|
| 238 | _UT_BITMAP_TYPE_SBMP, |
|---|
| 239 | _UT_BITMAP_TYPE_LCDR |
|---|
| 240 | }; |
|---|
| 241 | |
|---|
| 242 | enum |
|---|
| 243 | { |
|---|
| 244 | _UT_FILL_STYLE_DEFAULT, |
|---|
| 245 | _UT_FILL_STYLE_STROKE, |
|---|
| 246 | _UT_FILL_STYLE_GRAY_00, |
|---|
| 247 | _UT_FILL_STYLE_GRAY_01, |
|---|
| 248 | _UT_FILL_STYLE_GRAY_02, |
|---|
| 249 | _UT_FILL_STYLE_GRAY_03, |
|---|
| 250 | _UT_FILL_STYLE_GRAY_10, |
|---|
| 251 | _UT_FILL_STYLE_GRAY_11, |
|---|
| 252 | _UT_FILL_STYLE_GRAY_12, |
|---|
| 253 | _UT_FILL_STYLE_GRAY_13, |
|---|
| 254 | _UT_FILL_STYLE_GRAY_20, |
|---|
| 255 | _UT_FILL_STYLE_GRAY_21, |
|---|
| 256 | _UT_FILL_STYLE_GRAY_22, |
|---|
| 257 | _UT_FILL_STYLE_GRAY_23, |
|---|
| 258 | _UT_FILL_STYLE_GRAY_30, |
|---|
| 259 | _UT_FILL_STYLE_GRAY_31, |
|---|
| 260 | _UT_FILL_STYLE_GRAY_32, |
|---|
| 261 | _UT_FILL_STYLE_GRAY_33 |
|---|
| 262 | }; |
|---|
| 263 | |
|---|
| 264 | typedef union UT_TABLE |
|---|
| 265 | { |
|---|
| 266 | UT_I32 offset; |
|---|
| 267 | UT_U16 fixed; |
|---|
| 268 | } UT_TABLE; |
|---|
| 269 | |
|---|
| 270 | typedef struct UT_CMAP |
|---|
| 271 | { |
|---|
| 272 | UT_U16 startCode; |
|---|
| 273 | UT_U16 endCode; |
|---|
| 274 | UT_U32 length; |
|---|
| 275 | UT_U32 moreOffset; |
|---|
| 276 | UT_U32 glyfOffset; |
|---|
| 277 | UT_U8 cmapFormat; |
|---|
| 278 | UT_U8 locaFormat; |
|---|
| 279 | UT_U8 widthFormat; |
|---|
| 280 | UT_I8 glyphType; |
|---|
| 281 | UT_U8 glyphBBoxType; |
|---|
| 282 | UT_U8 heightFormat; |
|---|
| 283 | UT_U8 fillStyle; |
|---|
| 284 | UT_U8 dummy; |
|---|
| 285 | UT_TABLE loca; |
|---|
| 286 | UT_TABLE width; |
|---|
| 287 | union |
|---|
| 288 | { |
|---|
| 289 | UT_BBOX1 bbox; |
|---|
| 290 | UT_U16 emSize; |
|---|
| 291 | } depend; |
|---|
| 292 | UT_TABLE height; |
|---|
| 293 | } UT_CMAP; |
|---|
| 294 | |
|---|
| 295 | typedef struct UT_CMAP_CONTINUOUS |
|---|
| 296 | { |
|---|
| 297 | UT_CMAP header; |
|---|
| 298 | } UT_CMAP_CONTINUOUS; |
|---|
| 299 | |
|---|
| 300 | typedef struct UT_CMAP_BLOCK |
|---|
| 301 | { |
|---|
| 302 | UT_CMAP header; |
|---|
| 303 | } UT_CMAP_BLOCK; |
|---|
| 304 | |
|---|
| 305 | typedef struct UT_CMAP_SPARSE |
|---|
| 306 | { |
|---|
| 307 | UT_CMAP header; |
|---|
| 308 | UT_U16 count; |
|---|
| 309 | UT_U16 code[1]; |
|---|
| 310 | } UT_CMAP_SPARSE; |
|---|
| 311 | |
|---|
| 312 | typedef struct UT_CMAP_MAPPING |
|---|
| 313 | { |
|---|
| 314 | UT_CMAP header; |
|---|
| 315 | UT_U8 hiHash[4]; |
|---|
| 316 | } UT_CMAP_MAPPING; |
|---|
| 317 | |
|---|
| 318 | typedef struct UT_CMAP_JOHAP_1 |
|---|
| 319 | { |
|---|
| 320 | UT_CMAP header; |
|---|
| 321 | UT_U16 nGlyph; |
|---|
| 322 | UT_U16 valueBase[3]; |
|---|
| 323 | UT_U16 jasoBase[3][32]; |
|---|
| 324 | UT_U8 groupMap[3][3][32]; |
|---|
| 325 | UT_U8 nGroup[3][4]; |
|---|
| 326 | UT_U8 level; |
|---|
| 327 | UT_U8 value[3]; |
|---|
| 328 | } UT_CMAP_JOHAP_1; |
|---|
| 329 | |
|---|
| 330 | typedef struct UT_CMAP_JOHAP_2 |
|---|
| 331 | { |
|---|
| 332 | UT_CMAP header; |
|---|
| 333 | UT_U16 nGlyph; |
|---|
| 334 | UT_U16 nValue; |
|---|
| 335 | UT_U16 jasoBase[3][32]; |
|---|
| 336 | UT_U8 groupMap[3][32]; |
|---|
| 337 | UT_U8 nGroup[4]; |
|---|
| 338 | UT_U8 level; |
|---|
| 339 | UT_U8 value[3]; |
|---|
| 340 | } UT_CMAP_JOHAP_2; |
|---|
| 341 | |
|---|
| 342 | typedef struct UT_CMAP_JOHAP_3 |
|---|
| 343 | { |
|---|
| 344 | UT_CMAP header; |
|---|
| 345 | UT_U16 nGlyph; |
|---|
| 346 | UT_U8 level; |
|---|
| 347 | UT_U8 dummy; |
|---|
| 348 | } UT_CMAP_JOHAP_3; |
|---|
| 349 | |
|---|
| 350 | /***************************************************************************/ |
|---|
| 351 | /* KERNING */ |
|---|
| 352 | |
|---|
| 353 | enum |
|---|
| 354 | { |
|---|
| 355 | _UT_KERN_BYTE = 128, |
|---|
| 356 | _UT_KERN_SHORT |
|---|
| 357 | }; |
|---|
| 358 | |
|---|
| 359 | typedef struct UT_KERN |
|---|
| 360 | { |
|---|
| 361 | UT_U16 identifier; /* must set to 1 */ |
|---|
| 362 | UT_U16 zero; /* must set to 0 */ |
|---|
| 363 | UT_U32 length; |
|---|
| 364 | UT_U8 version; |
|---|
| 365 | UT_U8 nSubtable; |
|---|
| 366 | UT_U16 dummy; |
|---|
| 367 | /*UT_KERN_SUBTABLE subTable[nSubtable]*/ |
|---|
| 368 | } UT_KERN; |
|---|
| 369 | |
|---|
| 370 | typedef struct UT_KERN_SUBTABLE |
|---|
| 371 | { |
|---|
| 372 | UT_U32 length; |
|---|
| 373 | UT_U8 format; |
|---|
| 374 | UT_U8 dummy[3]; |
|---|
| 375 | } UT_KERN_SUBTABLE; |
|---|
| 376 | |
|---|
| 377 | typedef struct UT_KERN_SUBTABLE_0 |
|---|
| 378 | { |
|---|
| 379 | UT_U32 length; |
|---|
| 380 | UT_U8 format; |
|---|
| 381 | UT_U8 dummy; |
|---|
| 382 | UT_U16 count; |
|---|
| 383 | /*UT_U32 value[1]; (leftCode, rightCode) count*/ |
|---|
| 384 | /* adjust[count];*/ |
|---|
| 385 | } UT_KERN_SUBTABLE_0; |
|---|
| 386 | |
|---|
| 387 | /***************************************************************************/ |
|---|
| 388 | /* GLYPH */ |
|---|
| 389 | |
|---|
| 390 | #define _UT_POINT_MASK_IS_START 0x01 |
|---|
| 391 | #define _UT_POINT_MASK_IS_ON 0x02 |
|---|
| 392 | #define _UT_POINT_MASK_HAS_X 0x04 |
|---|
| 393 | #define _UT_POINT_MASK_HAS_Y 0x08 |
|---|
| 394 | |
|---|
| 395 | #define _UT_HINT_END 0x00 |
|---|
| 396 | #define _UT_HINT_VERT_STEM 0x01 |
|---|
| 397 | #define _UT_HINT_HORI_STEM 0x02 |
|---|
| 398 | #define _UT_HINT_VERT_POINT 0x03 |
|---|
| 399 | #define _UT_HINT_HORI_POINT 0x04 |
|---|
| 400 | #define _UT_HINT_VERT_SINGLE_STEM 0x05 |
|---|
| 401 | #define _UT_HINT_HORI_SINGLE_STEM 0x06 |
|---|
| 402 | |
|---|
| 403 | #define _UT_HINT_SET_SNAP_POS 0x81 |
|---|
| 404 | #define _UT_HINT_SET_SNAP_POS_CUT_IN 0x82 |
|---|
| 405 | #define _UT_HINT_SET_SNAP_STEM 0x83 |
|---|
| 406 | #define _UT_HINT_SET_SNAP_STEM_CUT_IN 0x84 |
|---|
| 407 | #define _UT_HINT_SET_ADJUST_STEM 0x85 |
|---|
| 408 | #define _UT_HINT_SET_ADJUST_STEM_CUT_IN 0x86 |
|---|
| 409 | |
|---|
| 410 | #define _UT_HINT_SET_REFERENCE_VALUE 0x91 |
|---|
| 411 | |
|---|
| 412 | typedef struct UT_DATA |
|---|
| 413 | { |
|---|
| 414 | UT_BBOX1 bbox; |
|---|
| 415 | UT_POINTER p; |
|---|
| 416 | UT_POINTER end; |
|---|
| 417 | char* temp; |
|---|
| 418 | int xOffset; |
|---|
| 419 | } UT_DATA; |
|---|
| 420 | |
|---|
| 421 | typedef struct UT_GLYPH |
|---|
| 422 | { |
|---|
| 423 | UT_CMAP* cmap; |
|---|
| 424 | UT_FONT_STREAM* stream; |
|---|
| 425 | int count; |
|---|
| 426 | int width; |
|---|
| 427 | int height; |
|---|
| 428 | UT_DATA data[1]; |
|---|
| 429 | } UT_GLYPH; |
|---|
| 430 | |
|---|
| 431 | /***************************************************************************/ |
|---|
| 432 | /* FONT Header */ |
|---|
| 433 | |
|---|
| 434 | #define _UT_IDENTIFIER (('U' << 24) | ('T' << 16) | ('F' << 8)) |
|---|
| 435 | |
|---|
| 436 | #define _UT_FONT_WEIGHT_MEDIUM 0 |
|---|
| 437 | #define _UT_FONT_WEIGHT_BOLD 10 |
|---|
| 438 | |
|---|
| 439 | #define _UT_CODE_SYSTEM_UNI 0 |
|---|
| 440 | #define _UT_CODE_SYSTEM_KS 1 |
|---|
| 441 | |
|---|
| 442 | enum |
|---|
| 443 | { |
|---|
| 444 | _UT_FONT_MORE_OP_CMAP_LENGTH = 1, |
|---|
| 445 | _UT_FONT_MORE_OP_MAX_GLYPH_LENGTH, |
|---|
| 446 | _UT_FONT_MORE_OP_TYPEFACE_NAME, |
|---|
| 447 | _UT_FONT_MORE_OP_FONT_NAME, |
|---|
| 448 | _UT_FONT_MORE_OP_ASCENT, |
|---|
| 449 | _UT_FONT_MORE_OP_DESCENT, |
|---|
| 450 | _UT_FONT_MORE_OP_VERSION, |
|---|
| 451 | _UT_FONT_MORE_OP_MAX_TWILIGHT_POINT, |
|---|
| 452 | _UT_FONT_MORE_OP_MAX_STACK, |
|---|
| 453 | _UT_FONT_MORE_OP_MAX_STORAGE, |
|---|
| 454 | _UT_FONT_MORE_OP_MAX_CVT, |
|---|
| 455 | _UT_FONT_MORE_OP_MAX_FUNCTION, |
|---|
| 456 | _UT_FONT_MORE_OP_MAX_INSTRUCTION |
|---|
| 457 | }; |
|---|
| 458 | |
|---|
| 459 | #define _UT_FONT_STRUCTURE_SIZE 28 |
|---|
| 460 | |
|---|
| 461 | /***************************************************************************/ |
|---|
| 462 | |
|---|
| 463 | UT_BOOL utm_GetGlyphFromCmap(UT_FONT_MANAGER* fontManager, UT_CMAP* cmap, UT_CODE code, struct UT_GLYPH* glyph); |
|---|
| 464 | UT_FONT* utm_GetFontCap(UT_FONT_STREAM* stream, void* capBuffer, int capBufferSize); |
|---|
| 465 | |
|---|
| 466 | #ifndef UT_MEMSET |
|---|
| 467 | #define UT_MEMSET memset |
|---|
| 468 | #endif |
|---|
| 469 | |
|---|
| 470 | #ifndef UT_MEMCPY |
|---|
| 471 | #define UT_MEMCPY memcpy |
|---|
| 472 | #endif |
|---|
| 473 | |
|---|
| 474 | /***************************************************************************/ |
|---|
| 475 | |
|---|
| 476 | /* ImageTypes(UT_IMAGE.type) */ |
|---|
| 477 | #define _UT_IMAGE_TYPE_NULL_GLYPH 0 /* Not defined glyph */ |
|---|
| 478 | #define _UT_IMAGE_TYPE_NULL 1 /* Not exist BitampData (has only metric(width,height)) */ |
|---|
| 479 | #define _UT_IMAGE_TYPE_BITMAP_65 2 /* bitmap that contains 65 levels of gray */ |
|---|
| 480 | /* bytes array of values range is as following GrayValues */ |
|---|
| 481 | #define _UT_IMAGE_TYPE_BITMAP 3 /* monochrome bitmap */ |
|---|
| 482 | #define _UT_IMAGE_TYPE_SUBPIXEL_H 4 /* Only used OutlineFont */ |
|---|
| 483 | #define _UT_IMAGE_TYPE_SUBPIXEL_V 5 /* Only used OutlineFont */ |
|---|
| 484 | #define _UT_IMAGE_TYPE_OUTLINE 6 |
|---|
| 485 | |
|---|
| 486 | #define _UT_IMAGE_TYPE_SBM 7 /* Only used BitmapFont */ |
|---|
| 487 | #define _UT_IMAGE_TYPE_LCD 8 /* Only used BitmapFont */ |
|---|
| 488 | #define _UT_IMAGE_TYPE_LCD_R 9 /* Only used BitmapFont */ |
|---|
| 489 | |
|---|
| 490 | /* RasterType */ |
|---|
| 491 | #define _UT_RASTER_TYPE_OUTLINE -1 |
|---|
| 492 | /* UT_U16 isBezier */ |
|---|
| 493 | /* UT_U16 nPath */ |
|---|
| 494 | /* UT_U16 endPointIndex[nPath+1] */ |
|---|
| 495 | /* UT_I16 x[nPoint] nPoint = endPointIndex[nPath+1] */ |
|---|
| 496 | /* UT_I16 y[nPoint] */ |
|---|
| 497 | /* UT_U8 on[nPoint] */ |
|---|
| 498 | /* RasterType */ |
|---|
| 499 | #define _UT_RASTER_TYPE_GRAY_65 0 /* retrieves a bitmap that contains 65 levels of gray(0 ~ 64) */ |
|---|
| 500 | #define _UT_RASTER_TYPE_GRAY_17 1 /* retrieves a bitmap that contains 17 levels of gray(0, 4, 8 ~ 60, 64) */ |
|---|
| 501 | #define _UT_RASTER_TYPE_GRAY_5 2 /* retrieves a bitmap that contains 5 levels of gray(0, 16, 32, 48, 64) */ |
|---|
| 502 | #define _UT_RASTER_TYPE_GRAY_2 3 /* retrieves a bitmap that contains 2 levels of geay(0, 64) */ |
|---|
| 503 | #define _UT_RASTER_TYPE_BITMAP 4 /* retrieves a monochrome bitmap */ |
|---|
| 504 | |
|---|
| 505 | /* SubPixelTypes */ |
|---|
| 506 | #define _UT_SUBPIXEL_TYPE_NONE 0 |
|---|
| 507 | #define _UT_SUBPIXEL_TYPE_HORI 1 |
|---|
| 508 | #define _UT_SUBPIXEL_TYPE_VERT 2 |
|---|
| 509 | |
|---|
| 510 | /* Gray Type and Adjust */ |
|---|
| 511 | void utm_SetGrayStyle(UT_FC* fc, int xGrayType, int yGrayType, int grayAdjust, int grayAdjustValue); |
|---|
| 512 | #define _UT_GRAY_TYPE_DEFAULT 0 |
|---|
| 513 | #define _UT_GRAY_TYPE_PRE3_POST0 1 |
|---|
| 514 | #define _UT_GRAY_TYPE_PRE2_POST1 2 |
|---|
| 515 | #define _UT_GRAY_TYPE_PRE1_POST2 3 |
|---|
| 516 | #define _UT_GRAY_TYPE_PRE0_POST3 4 |
|---|
| 517 | |
|---|
| 518 | #define _UT_GRAY_ADJUST_DEFAULT 0 |
|---|
| 519 | #define _UT_GRAY_ADJUST_USER 1 |
|---|
| 520 | |
|---|
| 521 | /***************************************************************************/ |
|---|
| 522 | |
|---|
| 523 | void utm_SetFixedPitch(UT_FC* fc, UT_BOOL isFixedPitch); |
|---|
| 524 | void utm_SetApplyHint(UT_FC* fc, UT_BOOL allow); |
|---|
| 525 | void utm_SetApplyDropout(UT_FC* fc, UT_BOOL allow); |
|---|
| 526 | UT_BOOL utm_GetGlyph(UT_FC* fc, UT_CODE code, struct UT_GLYPH* glyph); |
|---|
| 527 | void* utm_GetNthFontData(void* fontAddress, int index); |
|---|
| 528 | |
|---|
| 529 | /***************************************************************************/ |
|---|
| 530 | |
|---|
| 531 | UT_CODE ut_cbKsToUniCode(UT_FONT_MANAGER* fontManager, UT_CODE ks_code); |
|---|
| 532 | |
|---|
| 533 | /***************************************************************************/ |
|---|
| 534 | |
|---|
| 535 | UT_BOOL ut_GetGlyphFromCmap(UT_CMAP* cmap, UT_CODE code, struct UT_GLYPH* glyph); |
|---|
| 536 | UT_FONT* ut_GetFontCap(UT_FONT_STREAM* stream, void* capBuffer, int capBufferSize); |
|---|
| 537 | void ut_SetGrayType(UT_FC* fc, int xGrayType, int yGrayType); |
|---|
| 538 | void ut_SetApplyHint(UT_FC* fc, UT_BOOL allow); |
|---|
| 539 | void ut_SetApplyDropout(UT_FC* fc, UT_BOOL allow); |
|---|
| 540 | |
|---|
| 541 | #define ut_GetGlyphFromCmap utm_GetGlyphFromCmap |
|---|
| 542 | #define ut_GetFontCap utm_GetFontCap |
|---|
| 543 | #define ut_SetGrayStyle utm_SetGrayStyle |
|---|
| 544 | #define ut_SetFixedPitch utm_SetFixedPitch |
|---|
| 545 | #define ut_SetApplyHint utm_SetApplyHint |
|---|
| 546 | #define ut_SetApplyDropout utm_SetApplyDropout |
|---|
| 547 | #define ut_SetGrayType(fc, xGrayType, yGrayType) |
|---|
| 548 | #define utm_SetGrayType(fc, xGrayType, yGrayType) |
|---|
| 549 | |
|---|
| 550 | /***************************************************************************/ |
|---|
| 551 | |
|---|
| 552 | UT_BOOL utm_GetCharImageFromBitmapFont(UT_FC* fc, UT_CODE code, UT_IMAGE* image); |
|---|
| 553 | UT_BOOL utm_GetCharImageFromOutlineFont(UT_FC* fc, UT_CODE code, UT_IMAGE* image); |
|---|
| 554 | UT_BOOL utm_PrepareCharImageFromBitmapFont(UT_FC* fc, UT_CODE code, UT_IMAGE* image); |
|---|
| 555 | UT_BOOL utm_PrepareCharImageFromOutlineFont(UT_FC* fc, UT_CODE code, UT_IMAGE* image); |
|---|
| 556 | UT_BOOL utm_MakeImageOfBitmapFont(UT_FC* fc, UT_IMAGE* image); |
|---|
| 557 | UT_BOOL utm_MakeImageOfOutlineFont(UT_FC* fc, UT_IMAGE* image); |
|---|
| 558 | |
|---|
| 559 | #define ut_GetCharImageFromBitmapFont utm_GetCharImageFromBitmapFont |
|---|
| 560 | #define ut_GetCharImageFromOutlineFont utm_GetCharImageFromOutlineFont |
|---|
| 561 | #define ut_PrepareCharImageFromBitmapFont utm_PrepareCharImageFromBitmapFont |
|---|
| 562 | #define ut_PrepareCharImageFromOutlineFont utm_PrepareCharImageFromOutlineFont |
|---|
| 563 | #define ut_MakeImageOfBitmapFont utm_MakeImageOfBitmapFont |
|---|
| 564 | #define ut_MakeImageOfOutlineFont utm_MakeImageOfOutlineFont |
|---|
| 565 | |
|---|
| 566 | #ifndef _UT_USE_OUTLINE_FONT |
|---|
| 567 | #define utm_GetCharImage utm_GetCharImageFromBitmapFont |
|---|
| 568 | #define utm_PrepareCharImage utm_PrepareCharImageFromBitmapFont |
|---|
| 569 | #endif /*#ifndef _UT_USE_OUTLINE_FONT*/ |
|---|
| 570 | |
|---|
| 571 | /***************************************************************************/ |
|---|
| 572 | //neverdai ÆùÆ® Å©±â 26¿¡ ´ëÇØ width¸¦ 2¸¸Å ÁÙÀ̱â À§Çؼ. |
|---|
| 573 | //13 size¸¦ 2¹è ÇÑ °Í¿¡ ºñÇØ size 26ÀÇ ÆøÀÌ Á» ´õ Å« ¹®Á¦ ¼öÁ¤ |
|---|
| 574 | #if 0 |
|---|
| 575 | #define ut_BoldExtra(size) ((size<16)?1:((size<32)?2:3)) |
|---|
| 576 | #else |
|---|
| 577 | #define ut_BoldExtra(size) ((size<16)?1:((size<24)?2:1)) |
|---|
| 578 | #endif |
|---|
| 579 | #define ut_ItalicY(y) (((y) * 5) >> 4) |
|---|
| 580 | #define ut_GetExtraSizeEdge(size) ((size<30)?1:((size<50)?2:3)) |
|---|
| 581 | #define ut_GetBlurDelta(size, Delta) ((size<50)?Delta:1) |
|---|
| 582 | #define ut_GetBORDERDelta(size) ((size<50)?0:1) |
|---|
| 583 | |
|---|
| 584 | #ifdef _UT_IMAGE_BYTE_ALIGN |
|---|
| 585 | #define ut_BSIZE ut_BSIZE8 |
|---|
| 586 | #define ut_BALIGN(size) (size) |
|---|
| 587 | #else |
|---|
| 588 | #define ut_BSIZE ut_BSIZE32 |
|---|
| 589 | #define ut_BALIGN(size) (((size + 3) >> 2) << 2) |
|---|
| 590 | #endif |
|---|
| 591 | |
|---|
| 592 | #define _UT_PIXEL_SHIFT 6 |
|---|
| 593 | |
|---|
| 594 | #define UT_STATIC_API static |
|---|
| 595 | |
|---|
| 596 | /***************************************************************************/ |
|---|
| 597 | |
|---|
| 598 | #ifdef __cplusplus |
|---|
| 599 | } |
|---|
| 600 | #endif |
|---|
| 601 | |
|---|
| 602 | #endif /*#ifndef _UT_STRUCT_H*/ |
|---|