source: svn/newcon3bcm2_21bu/dst/dmw/src/grp/jungle_font/utfAPI.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 29.5 KB
Line 
1#ifndef _UT_API_H
2#define _UT_API_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include "ministd.h"
9
10/***************************************************************************/
11
12#define _UT_VERSION_MAJOR       2
13#define _UT_VERSION_MINOR       2
14
15/***************************************************************************/
16/* Basic Data Types                                                        */
17/***************************************************************************/
18
19#define UT_U8           unsigned char
20#define UT_I8           signed char
21#define UT_U16          unsigned short
22#define UT_I16          signed short
23#define UT_U32          unsigned long
24#define UT_I32          signed long
25#define UT_CODE         unsigned short
26#define UT_BOOL         int
27
28/***************************************************************************/
29/* Boolean Constants                                                       */
30/***************************************************************************/
31
32#define _UT_TRUE        1
33#define _UT_FALSE       0
34
35
36//user defined macro
37#define _UT_USE_SINGLE_TASK
38#define _UT_USE_OUTLINE_FONT
39#define _UT_USE_BITMAP_EFFECT
40#define _UT_CPU_IS_LITTLE_ENDIAN        // ISKANG SUPPORT_BCM comment in
41//#define _UT_CPU_IS_BIG_ENDIAN         // iskang support bcm comment out
42#define _UT_USE_BITMAP_ALL_TYPE
43
44/***************************************************************************/
45/* Bounging Box of Glyph                                                   */
46/***************************************************************************/
47
48typedef struct UT_BBOX
49{
50        UT_I16      ox; /* x offset to the left of BitmapData */
51        UT_I16      oy; /* y offset to the bottom(lower) of BitmapData */
52        UT_U16      sx; /* total width of BitmapData */
53        UT_U16      sy; /* total height of BitmapData */
54} UT_BBOX;
55
56/***************************************************************************/
57/* Glyph Image                                                             */
58/***************************************************************************/
59
60typedef struct UT_IMAGE
61{
62        unsigned char* data;/* BitmapData */
63        UT_BBOX     bbox;       /* BoundingBox */
64        int         width;      /* Advance width for next glyph in horizontal writing */
65        int         height;     /* Advance height for next glyph in vertical writing */
66        int         bSize;  /* The number of bytes per a row of BitmapData */
67        int         lSize;      /* The total number of bytes of BitmapData */
68        int         type;       /* ImageTypes(BitmapData types): as followings */
69        int         xAdvance;
70        int         yAdvance;
71} UT_IMAGE;
72
73/* ImageTypes(UT_IMAGE.type) */
74#define _UT_IMAGE_TYPE_NULL_GLYPH       0       /* Not defined glyph */
75#define _UT_IMAGE_TYPE_NULL                     1       /* Not exist BitampData (has only metric(width,height)) */
76#define _UT_IMAGE_TYPE_BITMAP_65        2       /* bitmap that contains 65 levels of gray */
77                                                                                /* bytes array of values range is as following GrayValues */
78#define _UT_IMAGE_TYPE_SUBPIXEL_H       4       /* Only used OutlineFont */
79
80/* GrayValues (When the value of UT_IMAGE.type is _UT_IMAGE_TYPE_BITMAP_65) */
81enum
82{
83        /* Background (0) */
84        _UT_IMAGE_TYPE_BITMAP_65_BACKGROUND_COLOR = 0,
85        /* Foreground (1 ~ 64) */
86        _UT_IMAGE_TYPE_BITMAP_65_COLOR_1 = 1,
87        _UT_IMAGE_TYPE_BITMAP_65_COLOR_64 = 64,
88        _UT_IMAGE_TYPE_BITMAP_65_COLOR = 64,
89        /* Shadow (65) */
90        _UT_IMAGE_TYPE_BITMAP_65_SHADOW_COLOR = 65,
91        /* Smooth (66 ~ 67) */
92        _UT_IMAGE_TYPE_BITMAP_65_SMOOTH_COLOR_CORNER = 66,
93        _UT_IMAGE_TYPE_BITMAP_65_SMOOTH_COLOR_EDGE = 67,
94        /* */
95        _UT_IMAGE_TYPE_BITMAP_65_MAX_COLOR
96};
97
98/***************************************************************************/
99/* Structures                                                              */
100/*       We don't need to know each member of next structures.             */
101/*       We use next structures when calling UniTypeEngine API.            */
102/***************************************************************************/
103
104#define UT_COORD signed long
105#define _UT_MAX_LINKABLE_FONT 3
106
107typedef struct US_GLYPH
108{
109    int              nPath;
110    int              nPoint;
111    UT_I16*          startPointIndex;
112    UT_COORD*        x;
113    UT_COORD*        y;
114    UT_U8*           on;
115    UT_COORD*        ox;
116    UT_COORD*        oy;
117} US_GLYPH;
118
119typedef struct US_RASTER_DIR
120{
121        UT_U8            touchedMask;
122    int              pixelBitCount;
123        int              isGray;
124    int              grayPreShift;
125    int              grayPostShift;
126        int              gridFitSize;
127    int              graySubHalf;
128    int              graySubPix;
129    int              grayAdjust;
130    int              subPixelScale;
131        UT_I32*          original;
132        UT_COORD*        hinted;
133} US_RASTER_DIR;
134
135/***************************************************************************/
136
137typedef struct UT_FONT
138{
139    UT_U32      identifier;
140    UT_U32      fileSize;
141    UT_U32      id;
142    UT_U16      limit;
143    UT_I8       weight;
144    UT_U8       isItalic;
145    UT_U8       codeSystem;
146    UT_U8       maxDepth;
147    UT_U16      maxPath;
148    UT_U16      maxPoint;
149    UT_U16      xLimit;
150    UT_U32      moreOffset;
151} UT_FONT;
152
153#define _UT_MAX_FONT_NAME 32
154typedef struct UT_FONT_CAP
155{
156        UT_FONT     info;
157        int         cmapLength;
158        int         maxGlyphLength;
159        int         maxTwilighitPoint;
160        int         maxStack;
161        int         maxStorage;
162        int         maxCvt;
163        int         maxFunction;
164        int         maxInstruction;
165        short       ascent;
166        short       descent;
167        short       version;
168        UT_CODE     typefaceName[_UT_MAX_FONT_NAME];
169        UT_CODE     fontName[_UT_MAX_FONT_NAME];
170} UT_FONT_CAP;
171
172typedef struct UT_FONT_STREAM
173{
174        void*            handle;
175        int              basement;
176        int            (*Read)(void* handle, int offset, int length, void* buffer);
177        struct UT_CMAP*  cmap;
178        struct UT_FONT_STREAM* next;
179} UT_FONT_STREAM;
180
181typedef struct UT_FACE
182{
183        UT_BOOL          isVolatile;
184        UT_FONT_STREAM   stream;
185        struct UT_FACE*  sameFont;
186        struct UT_FACE*  nextFont;
187        struct UT_FACE*  nextFace;
188        #ifdef _UT_USE_FONT_INFO_CACHE
189                UT_FONT_CAP  font;
190        #endif
191} UT_FACE;
192
193union UT_TABLE;
194struct UT_DATA;
195struct UT_CMAP;
196struct UT_GLYP;
197struct UT_FC;
198struct UT_CACHE;
199
200typedef struct UT_FONT_MANAGER
201{
202        void*          (*AllocMemory)(unsigned int size);
203        void           (*FreeMemory)(void* pointer);
204        UT_FACE*         staticFontBuffer;
205        int              staticFontBufferCount;
206        UT_FACE*         headFace;
207        UT_FACE*         defaultFace;
208        int              nStaticFace;
209        struct UT_CACHE* cache;
210        #ifdef _UT_NO_DATA_SEGMENT
211                void    (*GetGlyphMetricFnt[3])(union UT_TABLE* table, int index, struct UT_DATA* data, int* metric);
212                void    (*GetGlyphBboxFnt[4])(struct UT_CMAP* cmap, struct UT_DATA* data);
213                int     (*GetGlyphDataFnt[3])(struct UT_FONT_MANAGER* fontManager, UT_FONT_STREAM* stream, struct UT_CMAP* cmap, int index, struct UT_GLYPH* glyph);
214                UT_BOOL (*GetGlyphFnt[7])(struct UT_FONT_MANAGER* fontManager, UT_FONT_STREAM* stream, struct UT_CMAP* cmap, UT_CODE code, struct UT_GLYPH* glyph);
215                UT_BOOL (*PrepareRasterBitmapGlyphFnt[7])(struct UT_FC* fc, UT_IMAGE* image);
216                UT_BOOL (*MakeRasterBitmapGlyphFnt[7])(struct UT_FC* fc, UT_IMAGE* image);
217                void    (*Bit2ByteImageFnt[16])(unsigned char* image);
218                signed char johap3_jungsung_map0[21];
219                signed char johap3_jungsung_map1[21];
220                char        mono2graylevel[256];
221                #if defined(_UT_USE_KS_CODE) && defined(_UT_USE_STOCK_FNT_KS_2_UNI_CODE)
222                        UT_CODE ks_hg_2_uni[2350];
223                #endif
224        #endif
225} UT_FONT_MANAGER;
226
227typedef struct UT_GS
228{
229        int snapPos;
230        int snapPosCutIn;
231        int snapStem;
232        int snapStemCutIn;
233        int snapDepth;
234        int adjustStemCutIn;
235        int adjustStem;
236        int referenceValue;
237} UT_GS;
238
239typedef struct UT_MASK
240{
241        int size;
242        UT_U32 bitmap[32];
243} UT_MASK;
244
245struct US_EDGE;
246
247typedef struct UT_FONT_TASK
248{
249        UT_FONT_MANAGER* fontManager;
250        char*            staticRasterBuffer;
251        int              staticRasterBufferSize;
252        US_GLYPH         rootGlyph;
253        US_GLYPH         workGlyph;
254    UT_BOOL          isBezier;
255    UT_BOOL          isDropout;
256        UT_BOOL          compelPackedImage;
257    UT_BOOL          isEmpty;
258    int              emSize;
259    int              xSize, ySize;
260        int              emulItalic;
261        int              emulBold;
262#ifdef _UT_USE_BITMAP_EFFECT
263        int              emulOutline;
264        int              emulEdge;
265        int              emulSmooth;
266#endif
267        int              emulRotate;
268    UT_COORD         o_px, o_cx, o_lx;
269    UT_COORD         o_py, o_cy, o_ly;
270        int              emptyLastPoint;
271    UT_U32*          image;
272        char*            edge;
273    int              i_xSize;
274    int              i_ySize;
275    int              i_bSize;
276    int              i_lSize;
277    int              i_xMin;
278    int              i_yMin;
279    int              i_xMax;
280    int              i_yMax;
281    int              o_xMin;
282    int              o_yMin;
283    int              o_xMax;
284    int              o_yMax;
285    int              grayShift;
286    int              horiScanBufferSize, vertScanBufferSize;
287    int              gridFitBufferSize;
288    int              scanBufferSize;
289        UT_BOOL          gridFitBufferIsVolatile;
290        UT_BOOL          scanBufferIsVolatile;
291        char*            gridFitBuffer;
292        char*            scanBuffer;
293        US_RASTER_DIR    xDir, yDir;
294        UT_GS            gs;
295        UT_MASK*         strokeMask;
296        struct UT_GLYPH* glyph;
297        int              maxDepth;
298        int              maxPath;
299        int              maxPoint;
300        int              maxGlyphLength;
301        int              maxTwilighitPoint;
302        int              maxStack;
303        int              maxStorage;
304        int              maxCvt;
305        int              maxFunction;
306        int              maxInstruction;
307        struct US_EDGE*  emptyEdge;
308        struct US_EDGE*  horiScanLine;
309        struct US_EDGE*  vertScanLine;
310        void           (*LineTo)(struct UT_FONT_TASK*,UT_COORD,UT_COORD,UT_COORD,UT_COORD);
311        /* ScanScanConversion Method-1 */
312        int              horiEdgeCount, vertEdgeCount;
313        int              horiEdgeTotalCount, vertEdgeTotalCount;
314        /* ScanScanConversion Method-2 */
315        UT_I16**         horiSpaceLeft1;
316        UT_I16**         horiSpaceLeft2;
317        UT_I16**         horiSpaceRight1;
318        UT_I16**         horiSpaceRight2;
319        UT_I16**         vertSpaceLeft1;
320        UT_I16**         vertSpaceLeft2;
321        UT_I16**         vertSpaceRight1;
322        UT_I16**         vertSpaceRight2;
323        /*****************************************/
324        /****** For ScanConversionDebugging ******/
325        /*****************************************/
326} UT_FONT_TASK;
327
328typedef struct UT_FC
329{
330        int              xSize;
331        int              ySize;
332        int              isItalic;
333        int              isBold;
334        int              rotateDegree;
335        int              edgeType;
336        int              rasterType;
337        int              xGrayType;
338        int              yGrayType;
339        int              grayAdjust;
340        int              grayAdjustValue;
341        int              subPixelType;
342        int              smoothType;
343        int              bitmapScaleType;
344        UT_BOOL          preventHint;
345        UT_BOOL          preventDropout;
346        UT_BOOL          isFixedPitch;
347        int              fixedWidth;
348        int              fontItalic;
349        int              fontWeight;
350        UT_FONT_TASK*    task;
351        UT_FACE*         face;
352        UT_FONT_CAP      font;
353        UT_FONT_STREAM   stream[_UT_MAX_LINKABLE_FONT];
354        char*            cmapBuffer;
355        int              cmapBufferSize;
356        UT_BOOL          cmapBufferIsVolatile;
357        char*            staticCmapBuffer;
358        int              staticCmapBufferSize;
359        UT_MASK          strokeMask;
360} UT_FC;
361
362/***************************************************************************/
363/* CallBack Function for Debugging                                         */
364/***************************************************************************/
365
366#ifdef _UT_DEBUG
367        void ut_cbTraceTabInc();
368        void ut_cbTraceTabDec();
369        void ut_cbFatalError(const char* message);
370        void ut_cbTrace1(const char* message);
371        void ut_cbTrace2(const char* message, unsigned long arg);
372        #include "_utfDebugOn.hxx"
373#endif
374
375/***************************************************************************/
376/* Initialize and Terminate FontManager                                    */
377/***************************************************************************/
378
379void utm_InitFontManager(UT_FONT_MANAGER* fontManager,
380                                                 void* (*AllocMemory)(unsigned int), void (*FreeMemory)(void*),
381                                                 UT_FACE* staticFontBuffer, int staticFontBufferCount);
382void utm_TermFontManager(UT_FONT_MANAGER* fontManager);
383
384/***************************************************************************/
385/* Initialize FontStream                                                   */
386/***************************************************************************/
387
388void utm_InitFontStream(UT_FONT_STREAM* stream, void* fontAddress);
389void utm_InitFileFontStream(UT_FONT_STREAM* stream, void* fileHandle,
390                                                        int (*Read)(void* handle, int offset, int length, void* buffer));
391
392/***************************************************************************/
393/* Register font with FontManager                                          */
394/***************************************************************************/
395
396UT_BOOL utm_AddFont(UT_FONT_MANAGER* fontManager, void* fontAddress);
397UT_BOOL utm_AddStreamFont(UT_FONT_MANAGER* fontManager, UT_FONT_STREAM* stream);
398
399/***************************************************************************/
400/* Register font with FontCache                                            */
401/***************************************************************************/
402
403#ifdef _UT_USE_CACHE
404void utm_CacheInit(UT_FONT_MANAGER* fontManager, void* staticBuffer, int memorySize, int lowestSize, int highestSize);
405void utm_CacheTerm(UT_FONT_MANAGER* fontManager);
406#else /*#ifdef _UT_USE_CACHE*/
407#define utm_CacheInit(fontManager, staticBuffer, memorySize, lowestSize, highestSize)
408#define utm_CacheTerm(fontManager)
409#endif /*#ifdef _UT_USE_CACHE*/
410
411/***************************************************************************/
412/* Initialize and Terminate Task                                           */
413/***************************************************************************/
414
415void utm_InitFontTask(UT_FONT_TASK* task, UT_FONT_MANAGER* fontManager,
416                                          char* staticRasterBuffer, int staticRasterBufferSize);
417void utm_TermFontTask(UT_FONT_TASK* task);
418
419/***************************************************************************/
420/* Initialize and Terminate FontContext                                    */
421/***************************************************************************/
422
423void utm_InitFontContext(UT_FC* fc, UT_FONT_TASK* task,
424                                                 char* staticCmapBuffer, int staticCmapBufferSize);
425void utm_TermFontContext(UT_FC* fc);
426
427/***************************************************************************/
428/* Set the raster type as followings                                       */
429/***************************************************************************/
430
431void utm_SetRasterType(UT_FC* fc, int rasterType);
432
433/* RasterTypes */
434#define _UT_RASTER_TYPE_GRAY_65         0       /* retrieves a bitmap that contains 65 levels of gray(0 ~ 64) */
435#define _UT_RASTER_TYPE_GRAY_17         1       /* retrieves a bitmap that contains 17 levels of gray(0, 4, 8 ~ 60, 64) */
436#define _UT_RASTER_TYPE_GRAY_5          2       /* retrieves a bitmap that contains 5 levels of gray(0, 16, 32, 48, 64) */
437#define _UT_RASTER_TYPE_GRAY_2          3       /* retrieves a bitmap that contains 2 levels of geay(0, 64) */
438
439/***************************************************************************/
440/* Set the subpixel type as followings                                     */
441/***************************************************************************/
442
443void utm_SetSubPixelType(UT_FC* fc, int subPixelType);
444
445/* SubPixelTypes */
446#define _UT_SUBPIXEL_TYPE_NONE  0
447#define _UT_SUBPIXEL_TYPE_HORI  1
448
449/***************************************************************************/
450/* Set the font attribute                                                  */
451/***************************************************************************/
452
453UT_BOOL utm_SetFont(UT_FC* fc, UT_U32 fontID);
454UT_BOOL utm_SetFontDirect(UT_FC* fc, void* fontAddress);
455UT_BOOL utm_SetStreamFontDirect(UT_FC* fc, UT_FONT_STREAM* stream);
456void utm_SetSize(UT_FC* fc, int xSize, int ySize);
457void utm_SetItalic(UT_FC* fc, int allow);
458void utm_SetBold(UT_FC* fc, int allow);
459void utm_SetRotate(UT_FC* fc, int degree);
460void utm_SetEdgeType(UT_FC* fc, int edgeType);
461/* EdgeTypes */
462#define _UT_EDGE_TYPE_NONE                      0
463#define _UT_EDGE_TYPE_RAISED            1 /* Left-Top Shodow */
464#define _UT_EDGE_TYPE_DEPRESSED         2 /* Right-Bottom Shodow */
465#define _UT_EDGE_TYPE_UNIFORM           3 /* Border Shodow */
466#define _UT_EDGE_TYPE_DROP_SHADOW       4 /* Reverse Left-Top Shodow */
467#define _UT_EDGE_TYPE_OUTLINE           5 /* Outline */
468#define _UT_EDGE_TYPE_INLINE            6 /* Inline */
469#define _UT_EDGE_TYPE_EMBOSS            7 /* Left-Top White */
470#define _UT_EDGE_TYPE_ENGRAVE           8 /* Right-Bottom White */
471#define _UT_EDGE_TYPE_UNIFORM1          9
472#define _UT_EDGE_TYPE_OUTLINE1          10
473#define _UT_EDGE_TYPE_BLUR                      11
474#define _UT_EDGE_TYPE_BORDER            12
475#define _UT_EDGE_TYPE_SHADOW_RIGHT_TOP          13
476#define _UT_EDGE_TYPE_SHADOW_RIGHT_BOTTOM       14 /* Left-Top Shodow */
477#define _UT_EDGE_TYPE_SHADOW_LEFT_TOP           15
478#define _UT_EDGE_TYPE_SHADOW_LEFT_BOTTOM        16
479/* Set the bitmap gray type as followings */
480void utm_SetSmoothType(UT_FC* fc, int smoothType);
481#define _UT_SMOOTH_TYPE_NONE        0
482#define _UT_SMOOTH_TYPE_GRAY        1
483#define _UT_SMOOTH_TYPE_SUBPIXEL_H  2
484/* Set the bitmap scale type as followings */
485void utm_SetBitmapScaleType(UT_FC* fc, int scaleType);
486#define _UT_BITMAP_SCALE_NN                     0
487#define _UT_BITMAP_SCALE_ND                     1
488#define _UT_BITMAP_SCALE_DN                     2
489#define _UT_BITMAP_SCALE_DD                     3
490#define _UT_BITMAP_SCALE_HN                     4
491#define _UT_BITMAP_SCALE_HH                     5
492#define _UT_BITMAP_SCALE_NH                     6
493/* Initialize Palette */
494void utm_InitPalette(UT_FC* fc, unsigned long* palette, unsigned long foregroundColor, unsigned long backgroundColor, unsigned long shadowColor);
495void utm_InitPalette_RGB565(UT_FC* fc, unsigned short* palette, unsigned short foregroundColor, unsigned short backgroundColor, unsigned short shadowColor);
496void utm_InitPalette_RGB444(UT_FC* fc, unsigned short* palette, unsigned short foregroundColor, unsigned short backgroundColor, unsigned short shadowColor);
497void utm_InitPalette_RGB666(UT_FC* fc, unsigned long* palette, unsigned long foregroundColor, unsigned long backgroundColor, unsigned long shadowColor);
498unsigned long utm_RGB565_2_RGB(unsigned short color);
499unsigned short utm_RGB_2_RGB565(unsigned long color);
500unsigned long utm_RGB444_2_RGB(unsigned short color);
501unsigned short utm_RGB_2_RGB444(unsigned long color);
502unsigned long utm_RGB666_2_RGB(unsigned long color);
503unsigned long utm_RGB_2_RGB666(unsigned long color);
504
505/***************************************************************************/
506/* Get the character image                                                 */
507/***************************************************************************/
508
509/* Get the glyph bitmap image */
510UT_BOOL utm_GetCharImage(UT_FC* fc, UT_CODE code, UT_IMAGE* image);
511/* Prepare glyph bitmap image */
512UT_BOOL utm_PrepareCharImage(UT_FC* fc, UT_CODE code, UT_IMAGE* image);
513/* Make glyph bitmap image */
514UT_BOOL utm_MakeCharImage(UT_FC* fc, UT_IMAGE* image);
515
516/***************************************************************************/
517/* Get the FontMetric in horizontal writing                                */
518/***************************************************************************/
519
520int utm_GetCharWidth(UT_FC* fc, UT_CODE code);
521int utm_GetAverageCharWidth(UT_FC* fc);
522int utm_GetMaxCharWidth(UT_FC* fc);
523int utm_GetAscent(UT_FC* fc);
524int utm_GetDescent(UT_FC* fc);
525int utm_GetKerning(UT_FC* fc, UT_CODE leftCode, UT_CODE rightCode);
526
527/***************************************************************************/
528/* Get the FontMetric in vertical writing                                  */
529/***************************************************************************/
530
531int utm_GetCharHeight(UT_FC* fc, UT_CODE code);
532int utm_GetAverageCharHeight(UT_FC* fc);
533int utm_GetMaxCharHeight(UT_FC* fc);
534int utm_GetVerticalAscent(UT_FC* fc);
535int utm_GetVerticalDescent(UT_FC* fc);
536int utm_GetVerticalKerning(UT_FC* fc, UT_CODE leftCode, UT_CODE rightCode);
537
538/***************************************************************************/
539/* Misc.                                                                   */
540/***************************************************************************/
541
542/* Free Scan Buffer allocated in rasterizing */
543void utm_FreeScanBuffer(UT_FONT_TASK* task);
544/* Get Typeface List */
545UT_BOOL utm_GetTypefaceList(UT_FONT_MANAGER* fontManager, void* param,
546                                                        void (*Callback)(void* param, UT_CODE* typefaceName, UT_U32 id));
547/* Get Font List */
548UT_BOOL utm_GetFontList(UT_FONT_MANAGER* fontManager, void* param,
549                                                void (*Callback)(void* param, UT_CODE* typefaceName, UT_U32 id,
550                                                                                 UT_CODE* fontName, int fontHeight, int fontWidth, int weight, UT_BOOL isItalic));
551
552/***************************************************************************/
553/***************************************************************************/
554/***************************************************************************/
555
556#if defined(_UT_USE_SINGLE_TASK) && !defined(_UT_NO_DATA_SEGMENT)
557
558/***************************************************************************/
559/* Initialize FontStream                                                   */
560/***************************************************************************/
561
562#define ut_InitFontStream              utm_InitFontStream
563#define ut_InitFileFontStream          utm_InitFileFontStream
564
565
566/***************************************************************************/
567/* Initialize and Terminate FontManager                                    */
568/***************************************************************************/
569
570void ut_InitFontManager(void* (*AllocMemory)(unsigned int), void (*FreeMemory)(void*),
571                                                UT_FACE* staticFontBuffer, int staticFontBufferCount,
572                                                char* staticRasterBuffer, int staticRasterBufferSize);
573void ut_TermFontManager();
574
575/***************************************************************************/
576/* Register font with FontManager                                          */
577/***************************************************************************/
578
579UT_BOOL ut_AddFont(void* fontAddress);
580UT_BOOL ut_AddStreamFont(UT_FONT_STREAM* stream);
581
582/***************************************************************************/
583/* Initialize and Terminate Task                                           */
584/***************************************************************************/
585
586void ut_InitFontContext(UT_FC* fc,
587                                                char* staticCmapBuffer, int staticCmapBufferSize);
588void ut_TermFontContext(UT_FC* fc);
589
590/***************************************************************************/
591/* Set the raster type as followings                                       */
592/***************************************************************************/
593
594void ut_SetRasterType(UT_FC* fc, int rasterType);
595
596/***************************************************************************/
597/* Set the subpixel type as followings                                     */
598/***************************************************************************/
599
600void ut_SetSubPixelType(UT_FC* fc, int subPixelType);
601
602/***************************************************************************/
603/* Set the font attribute                                                  */
604/***************************************************************************/
605
606/* Set the font as registered fontID among UniTypeFontManager */
607UT_BOOL ut_SetFont(UT_FC* fc, UT_U32 fontID);
608/* Set the font directly as the memory pointer(We can do without registration UniTypeFontManager) */
609UT_BOOL ut_SetFontDirect(UT_FC* fc, void* fontAddress);
610/* Set the font directly as the file stream(We can do without registration UniTypeFontManager) */
611UT_BOOL ut_SetStreamFontDirect(UT_FC* fc, UT_FONT_STREAM* stream);
612/* Set Size */
613void ut_SetSize(UT_FC* fc, int xSize, int ySize);
614/* Set Italic */
615void ut_SetItalic(UT_FC* fc, int allow);
616/* Set Bold */
617void ut_SetBold(UT_FC* fc, int allow);
618/* Set Rotate */
619void ut_SetRotate(UT_FC* fc, int degree);
620/* Set the edge type as followings */
621void ut_SetEdgeType(UT_FC* fc, int edgeType);
622/* Set the bitmap gray type as followings */
623void ut_SetSmoothType(UT_FC* fc, int smoothType);
624/* Set the bitmap scale type as followings */
625void ut_SetBitmapScaleType(UT_FC* fc, int scaleType);
626/* Initialize Palette */
627void ut_InitPalette(UT_FC* fc, unsigned long* palette, unsigned long foregroundColor, unsigned long backgroundColor, unsigned long shadowColor);
628
629/***************************************************************************/
630/* Get the character image                                                 */
631/***************************************************************************/
632
633/* Get the glyph bitmap image */
634UT_BOOL ut_GetCharImage(UT_FC* fc, UT_CODE code, UT_IMAGE* image);
635/* Prepare glyph bitmap image */
636UT_BOOL ut_PrepareCharImage(UT_FC* fc, UT_CODE code, UT_IMAGE* image);
637/* Make glyph bitmap image */
638UT_BOOL ut_MakeCharImage(UT_FC* fc, UT_IMAGE* image);
639
640/***************************************************************************/
641/* Get the FontMetric in horizontal writing                                */
642/***************************************************************************/
643
644int ut_GetCharWidth(UT_FC* fc, UT_CODE code);
645int ut_GetAverageCharWidth(UT_FC* fc);
646int ut_GetMaxCharWidth(UT_FC* fc);
647int ut_GetAscent(UT_FC* fc);
648int ut_GetDescent(UT_FC* fc);
649int ut_GetKerning(UT_FC* fc, UT_CODE leftCode, UT_CODE rightCode);
650
651/***************************************************************************/
652/* Get the FontMetric in vertical writing                                  */
653/***************************************************************************/
654
655int ut_GetCharHeight(UT_FC* fc, UT_CODE code);
656int ut_GetAverageCharHeight(UT_FC* fc);
657int ut_GetMaxCharHeight(UT_FC* fc);
658int ut_GetVerticalAscent(UT_FC* fc);
659int ut_GetVerticalDescent(UT_FC* fc);
660int ut_GetVerticalKerning(UT_FC* fc, UT_CODE leftCode, UT_CODE rightCode);
661
662/***************************************************************************/
663/* Misc.                                                                   */
664/***************************************************************************/
665
666/* Free Scan Buffer allocated in rasterizing */
667void ut_FreeScanBuffer();
668/* Get Typeface List */
669UT_BOOL ut_GetTypefaceList(void* param,
670                                                   void (*Callback)(void* param, UT_CODE* typefaceName, UT_U32 id));
671/* Get Font List */
672UT_BOOL ut_GetFontList(void* param,
673                                           void (*Callback)(void* param, UT_CODE* typefaceName, UT_U32 id,
674                                                                                UT_CODE* fontName, int fontHeight, int fontWidth, int weight, UT_BOOL isItalic));
675
676/***************************************************************************/
677
678#define ut_CacheInit            utm_CacheInit
679#define ut_CacheTerm            utm_CacheTerm
680#define ut_TermFontContext      utm_TermFontContext
681#define ut_SetRasterType        utm_SetRasterType
682#define ut_SetSubPixelType      utm_SetSubPixelType
683#define ut_SetFont              utm_SetFont
684#define ut_SetFontDirect        utm_SetFontDirect
685#define ut_SetStreamFontDirect  utm_SetStreamFontDirect
686#define ut_SetSize              utm_SetSize
687#define ut_SetItalic            utm_SetItalic
688#define ut_SetBold              utm_SetBold
689#define ut_SetRotate            utm_SetRotate
690#define ut_SetEdgeType          utm_SetEdgeType
691#define ut_SetSmoothType        utm_SetSmoothType
692#define ut_SetBitmapScaleType   utm_SetBitmapScaleType
693#define ut_InitPalette          utm_InitPalette
694#define ut_InitPalette_RGB565   utm_InitPalette_RGB565
695#define ut_InitPalette_RGB444   utm_InitPalette_RGB444
696#define ut_InitPalette_RGB666   utm_InitPalette_RGB666
697#define ut_GetCharImage         utm_GetCharImage
698#define ut_PrepareCharImage     utm_PrepareCharImage
699#define ut_MakeCharImage        utm_MakeCharImage
700#define ut_GetCharWidth         utm_GetCharWidth
701#define ut_GetAverageCharWidth  utm_GetAverageCharWidth
702#define ut_GetMaxCharWidth      utm_GetMaxCharWidth
703#define ut_GetAscent            utm_GetAscent
704#define ut_GetDescent           utm_GetDescent
705#define ut_GetKerning           utm_GetKerning
706#define ut_GetCharHeight        utm_GetCharHeight
707#define ut_GetAverageCharHeight utm_GetAverageCharHeight
708#define ut_GetMaxCharHeight     utm_GetMaxCharHeight
709#define ut_GetVerticalAscent    utm_GetVerticalAscent
710#define ut_GetVerticalDescent   utm_GetVerticalDescent
711#define ut_GetVerticalKerning   utm_GetVerticalKerning
712
713#endif /*#if defined(_UT_USE_SINGLE_TASK) && !defined(_UT_NO_DATA_SEGMENT)*/
714
715/***************************************************************************/
716/***************************************************************************/
717/***************************************************************************/
718
719#if defined(_UT_USE_BITMAP_ALL_TYPE) && !defined(_UT_USE_BITMAP_ALL)
720        #define _UT_USE_BITMAP_ALL
721#endif /*#if defined(_UT_USE_BITMAP_ALL_TYPE) && !defined(_UT_USE_BITMAP_ALL)*/
722
723#if !defined(_UT_USE_BITMAP_ALL_TYPE) && defined(_UT_USE_BITMAP_ALL)
724        #define _UT_USE_BITMAP_ALL_TYPE
725#endif /*#if defined(!_UT_USE_BITMAP_ALL_TYPE) && defined(_UT_USE_BITMAP_ALL)*/
726
727#if defined(_UT_USE_BITMAP_ALL_TYPE) || defined(_UT_USE_BITMAP_IMG) || defined(_UT_USE_BITMAP_IMGP) || defined(_UT_USE_BITMAP_SBM) || defined(_UT_USE_BITMAP_SBMP) || defined(_UT_USE_BITMAP_LCD) || defined(_UT_USE_BITMAP_LCDR)
728        #define _UT_USE_BITMAP_FONT
729#else
730        #ifdef _UT_USE_BITMAP_FONT
731                #undef _UT_USE_BITMAP_FONT
732        #endif
733#endif
734
735#ifdef __cplusplus
736}
737#endif
738
739#endif /*#ifndef _UT_API_H*/
Note: See TracBrowser for help on using the repository browser.