MHEG  17.9.0
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Pages
mg_font.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2010 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 #ifndef _MG_FONT_H
26 #define _MG_FONT_H
27 
28 #include <ft2build.h>
29 #include FT_FREETYPE_H
30 #include FT_PFR_H
31 
32 #include "techtype.h"
33 
34 #define FIRST_CACHE_CHAR ('!')
35 #define CHAR_CACHE_SIZE 0x5e
36 #define BUILT_IN_FONT 0
37 
38 #define FTYPE_TTF 0
39 #define FTYPE_PFR 1
40 
41 /*---Constant and macro definitions for public use-----------------------------*/
42 
43 /*---Enumerations for public use-----------------------------------------------*/
44 
45 typedef enum
46 {
47  NORMAL_SD,
48  NORMAL_HD
49 } E_HDMode;
50 
51 /*---Global type defs for public use-------------------------------------------*/
52 
53 /* Function initialising 'VBox' must ensure that
54  * the box maps wholely on the visible screen
55  * (i.e. for SD screen, within 0,0 to 720,576
56  * or for a typical HD screen, within 0,0 to 1920,1080 )
57  */
58 typedef struct _VBox
59 {
60  U16BIT left;
61  U16BIT top;
62  U16BIT width;
63  U16BIT height;
64 } VBox, *pVBox;
65 
66 typedef struct _CacheSbit
67 {
68  U32BIT bmp_ndx;
69  S8BIT advance;
70  S8BIT top;
71  S8BIT left;
72  U8BIT height;
73  U8BIT width;
74  S8BIT sdleft;
75 } CacheSbit;
76 
77 typedef struct sFontSize
78 {
79  struct sFontSize *next;
80  U16BIT height;
81  U16BIT width;
82  VBox bound_box;
83  U32BIT mem_size; /*sizeof bitmaps in sbit_cache*/
84  CacheSbit *sbit_cache;
85  U32BIT cache_hit;
86  U32BIT cache_last;
87  U32BIT fnt_id;
88  S8BIT space_adv;
89  S8BIT figure_adv;
90  U8BIT bb_sd_height; /* in SD coord value */
91  U8BIT bb_sd_width;
92  U8BIT bb_sd_top;
93  U8BIT spxl_xleftoffset;
94  U8BIT pnts_xleftoffset;
95 } S_FontSize;
96 
97 typedef struct sFontDetails
98 {
99  struct sFontDetails *next;
100  U8BIT *file_data;
101  U32BIT file_size;
102  FT_Face face;
103  S_FontSize *first_sz;
104  FT_UInt glyph_ndx_space;
105  FT_UInt space_horiz_adv;
106  FT_UInt fig_horiz_adv;
107  FT_UInt horiz_adv[CHAR_CACHE_SIZE]; /* for chars 0x20..0x7e */
108  FT_UInt glyph_ndx[CHAR_CACHE_SIZE]; /* for chars 0x21..0x7e */
109  U16BIT font_ndx;
110  U16BIT face_type;
111  U32BIT current_fnt_id;
112  FT_UInt metric_resolution;
113 } S_FontDetails;
114 
115 
116 /*---Global Function prototypes for public use---------------------------------*/
117 
118 S_FontDetails* MG_GetFontPtr( S16BIT font_index );
119 void MG_ReleaseFontPtr( S_FontDetails *fp );
120 S_FontSize* MG_GetFontSize( U16BIT fnt_index, U8BIT fnt_size, U8BIT fnt_style );
121 void MG_CheckCache( S_FontSize *sz_data );
128 
129 extern E_HDMode mg_hd_mode;
130 
131 #endif /*_MG_FONT_H*/
Definition: mg_font.h:66
S_FontSize * MG_GetFontSize(U16BIT fnt_index, U8BIT fnt_size, U8BIT fnt_style)
Definition: mg_font.c:600
S_FontDetails * MG_FindFont(S_FontSize *f_sz)
Get font from size.
void MG_ReleaseFontPtr(S_FontDetails *fp)
Definition: mg_font.c:412
Definition: mg_font.h:97
Definition: mg_font.h:58
System Wide Global Technical Data Type Definitions.
Definition: mg_font.h:77
S_FontDetails * MG_GetFontPtr(S16BIT font_index)
Get Pointer to Font.
Definition: mg_font.c:400
void MG_CheckCache(S_FontSize *sz_data)
Definition: mg_font.c:841