MHEG  17.9.0
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Pages
mg_drawtext.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2008 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_DRAWTEXT_H
26 #define _MG_DRAWTEXT_H
27 
28 #include "mg_osd.h"
29 #include "mg_fontapi.h"
30 #include "dtvstring.h"
31 
32 #define FONT_STYLE_PLAIN 0x00
33 #define FONT_STYLE_SQUARE 0x10
34 #define FONT_STYLE_NO_SCALE 0x80
35 
36 /* Justification */
37 #define JUSTIFY_H_START 0x00
38 #define JUSTIFY_H_END 0x01
39 #define JUSTIFY_H_CENTRE 0x02
40 #define JUSTIFY_H_JUSTIFIED 0x03
41 /* wrap words when reach line limit */
42 #define WRAP_WORDS 0x04
43 /* wrap on every character - vertical orientation*/
44 #define WRAP_VERTICAL 0x08
45 
46 #define JFY_HZ_MASK 0x03
47 #define JFY_WRAP_MASK 0x0c
48 #define JFY_HZ_WRAP_MASK 0x0f
49 
50 #define JUSTIFY_V_START 0x00
51 #define JUSTIFY_V_END 0x10
52 #define JUSTIFY_V_CENTRE 0x20
53 #define JUSTIFY_V_JUSTIFIED 0x30
54 #define JUSTIFY_VERTI_MASK 0x30
55 
56 /* #define OBSCURE_INPUT 0x40 */
57 
58 /* Characters used for Entryfield obscured input and cursor */
59 #define OBSCURED_INPUT_CHAR ('*')
60 #define ENTRY_INSERT_CHAR ('_')
61 #define ENTRY_OVERWRITE_CHAR ('<')
62 
63 #define HK_FNT_MAGIC 0xFEFF
64 
65 typedef struct
66 {
67  S16BIT left;
68  S16BIT top;
69  U16BIT width;
70  U16BIT height;
71 } VRect, *pVRect;
72 
73 /* 'TextString' is structure referencing unicode strings */
74 typedef struct _TextString
75 {
76  U16BIT len;
77  U16BIT *data; /*unicode data*/
79 
80 typedef struct _HyperAttribs
81 {
82  /* hypertext specific colours - can be changed by "body attrib" in text*/
83  OSDColor link_colour;
84  OSDColor active_colour;
85  OSDColor visit_colour;
86  S16BIT focus_position; /*zero when not interacting*/
87  S16BIT number_of_links; /*MG_drawText returns number of links found in text*/
88  /*default below to zero*/
89  U8BIT markup_state;
90  U8BIT anchor_wrap; /*MG_drawText returns with value (set by "body attrib" in text)*/
91  U8BIT save_colour; /*temp var*/
92  /* U8BIT interacting; *not used*/
94 
95 typedef struct s_FontProp
96 {
97  S16BIT index; /* value returned by MG_FontLoadFile() */
98  U8BIT size; /* vertical point size */
99  U8BIT style; /* plain/square */
100 } S_FontProp;
101 
102 typedef struct _DrawTextAttrib
103 {
104  pHyperAttribs p_ha; /* Pointer to Hypertext attributes (default: NULL) */
105  OSDColor fore_colour;
106  OSDColor back_colour;
107  U32BIT character_set;
108  S16BIT entry_point; /* position of 'caret' for Entryfield text box (default: -1) */
109  S16BIT letter_space; /* extra spacing between chars in 1/256 points */
110  U16BIT caret;
111  U8BIT line_space; /* line spacing in points */
112  U8BIT justify; /* horz and vert and wrapping */
113  union
114  {
115  H_FontSize hdl;
116  S_FontProp fp;
117  } font;
118  S_STRING font_name;
120 
121 
130 void* MG_DrawText( const TextString unistr, pDrawTextAttrib attrib, const VRect txt_box );
131 
139 S16BIT MG_TextWidth( const TextString unistr, pDrawTextAttrib attrib );
140 
148 void MG_DrawScreenText( const TextString unistr, pDrawTextAttrib attrib, S_SURFACE *canvas );
149 
150 #endif /*_MG_DRAWTEXT_H*/
Define MHEG5 String type.
Definition: dtvstring.h:28
S16BIT MG_TextWidth(const TextString unistr, pDrawTextAttrib attrib)
Definition: mg_drawtext.c:2124
Definition: mg_drawtext.h:74
Interface to OSD.
Definition: mg_drawtext.h:95
Definition: mg_drawtext.h:80
Font file handling with the Freetype.
void * MG_DrawText(const TextString unistr, pDrawTextAttrib attrib, const VRect txt_box)
Create Surface and draw text string on it and terminate freetype library.
Definition: mg_drawtext.c:2275
Definition: mg_font.h:77
Definition: mg_drawtext.h:102
Definition: mg_drawtext.h:65
Definition: mg_osd.h:37
void MG_DrawScreenText(const TextString unistr, pDrawTextAttrib attrib, S_SURFACE *canvas)
Single line text string drawn on existing Surface.
Definition: mg_drawtext.c:2178