MHEG5
15.3.0
|
00001 /******************************************************************************* 00002 * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org) 00003 * Copyright © 2008 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_DRAWTEXT_H 00026 #define _MG_DRAWTEXT_H 00027 00028 #include "mg_osd.h" 00029 #include "mg_fontapi.h" 00030 #include "dtvstring.h" 00031 00032 #define FONT_STYLE_PLAIN 0x00 00033 #define FONT_STYLE_SQUARE 0x10 00034 #define FONT_STYLE_NO_SCALE 0x80 00035 00036 /* Justification */ 00037 #define JUSTIFY_H_START 0x00 00038 #define JUSTIFY_H_END 0x01 00039 #define JUSTIFY_H_CENTRE 0x02 00040 #define JUSTIFY_H_JUSTIFIED 0x03 00041 /* wrap words when reach line limit */ 00042 #define WRAP_WORDS 0x04 00043 /* wrap on every character - vertical orientation*/ 00044 #define WRAP_VERTICAL 0x08 00045 00046 #define JFY_HZ_MASK 0x03 00047 #define JFY_WRAP_MASK 0x0c 00048 #define JFY_HZ_WRAP_MASK 0x0f 00049 00050 #define JUSTIFY_V_START 0x00 00051 #define JUSTIFY_V_END 0x10 00052 #define JUSTIFY_V_CENTRE 0x20 00053 #define JUSTIFY_V_JUSTIFIED 0x30 00054 #define JUSTIFY_VERTI_MASK 0x30 00055 00056 /* #define OBSCURE_INPUT 0x40 */ 00057 00058 /* Characters used for Entryfield obscured input and cursor */ 00059 #define OBSCURED_INPUT_CHAR ('*') 00060 #define ENTRY_INSERT_CHAR ('_') 00061 #define ENTRY_OVERWRITE_CHAR ('<') 00062 00063 #define HK_FNT_MAGIC 0xFEFF 00064 00065 typedef struct 00066 { 00067 S16BIT left; 00068 S16BIT top; 00069 U16BIT width; 00070 U16BIT height; 00071 } VRect, *pVRect; 00072 00073 /* 'TextString' is structure referencing unicode strings */ 00074 typedef struct _TextString 00075 { 00076 U16BIT len; 00077 U16BIT *data; /*unicode data*/ 00078 } TextString, *pTextString; 00079 00080 typedef struct _HyperAttribs 00081 { 00082 /* hypertext specific colours - can be changed by "body attrib" in text*/ 00083 OSDColor link_colour; 00084 OSDColor active_colour; 00085 OSDColor visit_colour; 00086 S16BIT focus_position; /*zero when not interacting*/ 00087 S16BIT number_of_links; /*MG_drawText returns number of links found in text*/ 00088 /*default below to zero*/ 00089 U8BIT markup_state; 00090 U8BIT anchor_wrap; /*MG_drawText returns with value (set by "body attrib" in text)*/ 00091 U8BIT save_colour; /*temp var*/ 00092 /* U8BIT interacting; *not used*/ 00093 } HyperAttribs, *pHyperAttribs; 00094 00095 typedef struct s_FontProp 00096 { 00097 S16BIT index; /* value returned by MG_FontLoadFile() */ 00098 U8BIT size; /* vertical point size */ 00099 U8BIT style; /* plain/square */ 00100 } S_FontProp; 00101 00102 typedef struct _DrawTextAttrib 00103 { 00104 pHyperAttribs p_ha; /* Pointer to Hypertext attributes (default: NULL) */ 00105 OSDColor fore_colour; 00106 OSDColor back_colour; 00107 U32BIT character_set; 00108 S16BIT entry_point; /* position of 'caret' for Entryfield text box (default: -1) */ 00109 S16BIT letter_space; /* extra spacing between chars in 1/256 points */ 00110 U16BIT caret; 00111 U8BIT line_space; /* line spacing in points */ 00112 U8BIT justify; /* horz and vert and wrapping */ 00113 union 00114 { 00115 H_FontSize hdl; 00116 S_FontProp fp; 00117 } font; 00118 S_STRING font_name; 00119 } DrawTextAttrib, *pDrawTextAttrib; 00120 00121 00130 void* MG_DrawText( const TextString unistr, pDrawTextAttrib attrib, const VRect txt_box ); 00131 00139 S16BIT MG_TextWidth( const TextString unistr, pDrawTextAttrib attrib ); 00140 00148 void MG_DrawScreenText( const TextString unistr, pDrawTextAttrib attrib, S_SURFACE *canvas ); 00149 00150 #endif /*_MG_DRAWTEXT_H*/