MHEG5  15.3.0
source/graphics/src/mg_font.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
00003  * Copyright © 2010 Ocean Blue Software Ltd
00004  *
00005  * This file is part of a DTVKit Software Component
00006  * You are permitted to copy, modify or distribute this file subject to the terms
00007  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
00008  * 
00009  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
00010  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
00011  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
00012  * 
00013  * If you or your organisation is not a member of DTVKit then you have access
00014  * to this source code outside of the terms of the licence agreement
00015  * and you are expected to delete this and any associated files immediately.
00016  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
00017  *******************************************************************************/
00025 #ifndef _MG_FONT_H
00026 #define _MG_FONT_H
00027 
00028 #include <ft2build.h>
00029 #include FT_FREETYPE_H
00030 #include FT_PFR_H
00031 
00032 #include "techtype.h"
00033 
00034 #define FIRST_CACHE_CHAR    ('!')
00035 #define CHAR_CACHE_SIZE     0x5e
00036 #define BUILT_IN_FONT       0
00037 
00038 #define FTYPE_TTF 0
00039 #define FTYPE_PFR 1
00040 
00041 /*---Constant and macro definitions for public use-----------------------------*/
00042 
00043 /*---Enumerations for public use-----------------------------------------------*/
00044 
00045 typedef enum
00046 {
00047    NORMAL_SD,
00048    NORMAL_HD
00049 } E_HDMode;
00050 
00051 /*---Global type defs for public use-------------------------------------------*/
00052 
00053 /* Function initialising 'VBox' must ensure that
00054  * the box maps wholely on the visible screen
00055  * (i.e. for SD screen, within 0,0 to 720,576
00056  *  or for a typical HD screen, within 0,0 to 1920,1080 )
00057  */
00058 typedef struct _VBox
00059 {
00060    U16BIT left;
00061    U16BIT top;
00062    U16BIT width;
00063    U16BIT height;
00064 } VBox, *pVBox;
00065 
00066 typedef struct _CacheSbit
00067 {
00068    U32BIT bmp_ndx;
00069    S8BIT advance;
00070    S8BIT top;
00071    S8BIT left;
00072    U8BIT height;
00073    U8BIT width;
00074    S8BIT sdleft;
00075 } CacheSbit;
00076 
00077 typedef struct sFontSize
00078 {
00079    struct sFontSize *next;
00080    U16BIT height;
00081    U16BIT width;
00082    VBox bound_box;
00083    U32BIT mem_size;      /*sizeof bitmaps in sbit_cache*/
00084    CacheSbit *sbit_cache;
00085    U32BIT cache_hit;
00086    U32BIT cache_last;
00087    U32BIT fnt_id;
00088    S8BIT space_adv;
00089    S8BIT figure_adv;
00090    U8BIT bb_sd_height;       /* in SD coord value */
00091    U8BIT bb_sd_width;
00092    U8BIT bb_sd_top;
00093    U8BIT spxl_xleftoffset;
00094    U8BIT pnts_xleftoffset;
00095 } S_FontSize;
00096 
00097 typedef struct sFontDetails
00098 {
00099    struct sFontDetails *next;
00100    U8BIT *file_data;
00101    U32BIT file_size;
00102    FT_Face face;
00103    S_FontSize *first_sz;
00104    FT_UInt glyph_ndx_space;
00105    FT_UInt space_horiz_adv;
00106    FT_UInt fig_horiz_adv;
00107    FT_UInt horiz_adv[CHAR_CACHE_SIZE];    /* for chars 0x20..0x7e */
00108    FT_UInt glyph_ndx[CHAR_CACHE_SIZE];    /* for chars 0x21..0x7e */
00109    U16BIT font_ndx;
00110    U16BIT face_type;
00111    U32BIT current_fnt_id;
00112    FT_UInt metric_resolution;
00113 } S_FontDetails;
00114 
00115 
00116 /*---Global Function prototypes for public use---------------------------------*/
00117 
00118 S_FontDetails* MG_GetFontPtr( S16BIT font_index );
00119 void MG_ReleaseFontPtr( S_FontDetails *fp );
00120 S_FontSize* MG_GetFontSize( U16BIT fnt_index, U8BIT fnt_size, U8BIT fnt_style );
00121 void MG_CheckCache( S_FontSize *sz_data );
00127 S_FontDetails* MG_FindFont( S_FontSize *f_sz );
00128 
00129 extern E_HDMode mg_hd_mode;
00130 
00131 #endif /*_MG_FONT_H*/
 All Data Structures Files Functions Variables Typedefs Defines