MHEG  17.9.0
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Pages
mh5text.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  * Copyright © 2000 Koninklijke Philips Electronics N.V
5  *
6  * This file is part of a DTVKit Software Component
7  * You are permitted to copy, modify or distribute this file subject to the terms
8  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
9  *
10  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
11  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
12  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
13  *
14  * If you or your organisation is not a member of DTVKit then you have access
15  * to this source code outside of the terms of the licence agreement
16  * and you are expected to delete this and any associated files immediately.
17  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
18  *******************************************************************************/
31 #ifndef _MH5TEXT_H
32 #define _MH5TEXT_H
33 
34 /*---includes for this file--------------------------------------------------*/
35 #include "mh5visible.h"
36 
37 /*---Constant and macro definitions for public use---------------------------*/
38 
39 #define HJUSTIFICATION_START (0)
40 #define HJUSTIFICATION_END (1)
41 #define HJUSTIFICATION_CENTRE (2)
42 #define HJUSTIFICATION_JUSTIFIED (3)
43 
44 #define VJUSTIFICATION_START (0)
45 #define VJUSTIFICATION_END (1)
46 #define VJUSTIFICATION_CENTRE (2)
47 #define VJUSTIFICATION_JUSTIFIED (3)
48 
49 #define LINE_ORIENTATION_HORIZONTAL (MHEG5FALSE)
50 #define LINE_ORIENTATION_VERTICAL (MHEG5TRUE)
51 
52 #define BOM_NONE 0
53 #define BOM_LITTLE_ENDIAN 1
54 #define BOM_BIG_ENDIAN 2
55 
56 /*---Enumerations for public use---------------------------------------------*/
57 
58 /*---Global type defs for public use-----------------------------------------*/
59 typedef struct
60 {
61  /* Base class */
62  MHEG5Visible visible;
63 
64  /* Exchanged attributes */
65  MHEG5FontBody originalFont;
66  MHEG5String originalFontAttributes;
67  MHEG5Colour originalTextColour;
68  MHEG5Colour originalBackgroundColour;
69  MHEG5Int characterSet;
70  MHEG5Int horizontalJustification;
71  MHEG5Int verticalJustification;
72  MHEG5Bool verticalLineOrientation;
73  MHEG5Int startCorner;
74  MHEG5Bool textWrapping;
75 
76  /* Internal attributes */
77  /* Text data internal attribute is stored in both raw format and adapted
78  * (unicode) format. The raw format is stored in the textDataRaw attribute
79  * of the Text class, the adapted format is stored in data attribute of the
80  * Ingredient class. The two formats are stored to allow invalid UTF-8 data
81  * to be loaded into a text object, then retrieved by a GetTextData action.
82  *
83  * Raw data is only stored for the Text and HyperText classes (not
84  * EntryField since this can alter the TextData attribute through
85  * interaction).
86  */
87  MHEG5String textDataRaw;
88  MHEG5FontBody font;
89  MHEG5String fontAttributes;
90  MHEG5Colour textColour;
91  MHEG5Colour backgroundColour;
92 
93  /*for engine use*/
94  MHEG5Bool characterSetEncoded;
95  MHEG5Int byteOrderMark;
96 } MHEG5Text;
97 
98 
99 /*---Global variable declarations for public use-----------------------------*/
100 
101 /*---Global Function prototypes for public use-------------------------------*/
102 
113 void MHEG5textInit(MHEG5Text *text);
114 
115 
123 void MHEG5textFree(MHEG5Text *text);
124 
125 
127 
128 
129 /*
130  Internal behaviours
131  */
132 void MHEG5textPrepare(MHEG5Text *text);
133 void MHEG5textActivate(MHEG5Text *text);
134 void MHEG5textDeactivate(MHEG5Text *text);
135 void MHEG5textDestruct(MHEG5Text *text);
136 
137 
138 MHEG5ErrorCode MHEG5getTextData(MHEG5Root *target, MHEG5GList *params);
139 MHEG5ErrorCode MHEG5getTextContent(MHEG5Root *target, MHEG5GList *params);
140 MHEG5ErrorCode MHEG5setFontAttributes(MHEG5Root *target, MHEG5GList *params);
141 MHEG5ErrorCode MHEG5setTextColour(MHEG5Root *target, MHEG5GList *params);
142 MHEG5ErrorCode MHEG5setBackgroundColour(MHEG5Root *target, MHEG5GList *params);
143 MHEG5ErrorCode MHEG5setFontRef(MHEG5Root *target, MHEG5GList *params);
144 
145 void MHEG5textRedraw(MHEG5Text *text);
146 
155 void MHEG5textUtf8Content(MHEG5Text *text, unsigned char *data, int len);
156 
164 void MHEG5textUtf16Content(MHEG5Text *text, unsigned char *data, int len);
165 
174 void MHEG5textContentUnadapt(MHEG5Text *text, MHEG5Byte **utf8Data,
175  MHEG5Int *utf8Len);
176 
177 void MHEG5textContentUnadaptUTF16(MHEG5Text *text, MHEG5Byte **utf16Data,
178  MHEG5Int *utf16Len);
185 
186 
187 /*
188  Debug
189  */
190 #ifdef MH5PRINTOUT
191 
197 void MHEG5textPrint(MHEG5Text *text, char *out);
198 #endif
199 
200 #endif /*_MH5TEXT_H*/
void MHEG5textClearTextData(MHEG5Text *text)
Clear text data.
Definition: mh5text.c:1377
void MHEG5textContentUnadapt(MHEG5Text *text, MHEG5Byte **utf8Data, MHEG5Int *utf8Len)
Undo the adaption of content for Text objects. Adapted content is stored as 16 bit unicode - this is ...
Definition: mh5text.c:1143
Definition: mh5base.h:82
MHEG5ErrorCode MHEG5setTextColour(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to set the TextColour to the given colour. Implementation of the MHEG5se...
Definition: mh5text.c:585
void MHEG5textUtf16Content(MHEG5Text *text, unsigned char *data, int len)
Content for Text objects is encoded using UTF16.
Definition: mh5text.c:961
void MHEG5textDestruct(MHEG5Text *text)
Destruct a text object.
Definition: mh5text.c:365
Definition: mh5visible.h:46
MHEG5ErrorCode MHEG5getTextData(MHEG5Root *target, MHEG5GList *params)
Set the Variable referenced by TextDataVar to the value of the TextData attribute. Implementation of the GetTextData (Target, TextDataVar) action of the text class.
Definition: mh5text.c:470
void MHEG5textContentUnadaptUTF16(MHEG5Text *text, MHEG5Byte **utf16Data, MHEG5Int *utf16Len)
Undo the adaption of content for Text objects. Adapted content is stored as 16 bit unicode - this is ...
Definition: mh5text.c:1261
MHEG5ErrorCode MHEG5setBackgroundColour(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to set the BackgroundColour to the given colour. Implementation of the M...
Definition: mh5text.c:620
void MHEG5textPrepare(MHEG5Text *text)
Apply the preparation behaviour of the text class Apply the preparation behaviour of the text class...
Definition: mh5text.c:293
Definition: mh5base.h:240
Definition: mh5base.h:169
void MHEG5textUtf8Content(MHEG5Text *text, unsigned char *data, int len)
Adapt new content for Text objects. Content is encoded using UTF8 - this is converted to 16 bit unico...
Definition: mh5text.c:765
Definition: mh5text.h:59
Implement the MHEG5 Visible Class Defines the behaviour of Presentables that have a visual representa...
void MHEG5textDeactivate(MHEG5Text *text)
Apply the deactivation behaviour of the text class. As this class has no own deactivation behaviour t...
Definition: mh5text.c:348
void MHEG5textInit(MHEG5Text *text)
<Function description>="">
Definition: mh5text.c:190
Definition: mh5base.h:147
MHEG5Text * MHEG5textClone(MHEG5Text *source)
Copy a text object with original values.
Definition: mh5text.c:232
MHEG5ErrorCode MHEG5getTextContent(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to transfer the data of the content attribute of the text to the variabl...
Definition: mh5text.c:421
void MHEG5textActivate(MHEG5Text *text)
Apply the activation behaviour of the text class. As this class has no own activation behaviour this ...
Definition: mh5text.c:330
MHEG5ErrorCode MHEG5setFontRef(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to change the character font used to preset a text. Implementation of th...
Definition: mh5text.c:655
Definition: mh5root.h:43
void MHEG5textFree(MHEG5Text *text)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
Definition: mh5text.c:204
MHEG5ErrorCode MHEG5setFontAttributes(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to set the FontAttributes to the given attributes. Implementation of the...
Definition: mh5text.c:548