MHEG-5  19.3.0
MHEG-5 Documentation
mh5font.c
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  *******************************************************************************/
32 /*---includes for this file--------------------------------------------------*/
33 #include <stdlib.h>
34 #include "mh5font.h"
35 #include "mh5memory.h" /* for constructor */
36 #include "mh5queue.h" /* Events */
37 #include "mh5application.h"
38 #include "mh5scene.h"
39 #include "mh5text.h"
40 #include "mh5object.h"
41 #include "mh5gate.h"
42 #include "mh5display.h"
43 #include "mh5text.h"
44 
45 /*
46  Debug
47  */
48 #ifdef MH5PRINTOUT
49 
50 void MHEG5fontPrint(MHEG5Font *font, char *out)
51 {
52  MHEG5ingredientPrint(&font->ingredient, out);
53 }
54 
55 #endif
56 
57 static void MHEG5fontRefreshText( MHEG5Group *group, MHEG5Font *font )
58 {
59  MHEG5Ingredient *item;
60  MHEG5Text *text;
61  assert(font);
62  if (group)
63  {
64  item = group->itemHead;
65  while (item != 0)
66  {
67  switch (item->root.clazz)
68  {
69  case MHEG5TEXT:
70  case MHEG5HYPERTEXT:
71  case MHEG5ENTRYFIELD:
72  text = (MHEG5Text *)item;
73  if (text->font.referenced &&
74  text->font.ref.referenced.id == font->ingredient.root.id)
75  {
76  if ((text->font.ref.referenced.grp.ptr.group == font->ingredient.root.grp) ||
77  ((text->font.ref.referenced.grp.len != 0) &&
78  MHEG5sameGroup(font->ingredient.root.grp, text->font.ref.referenced.grp))
79  )
80  {
81  /* Found a Text object that references this Font object, redraw text */
82  MHEG5textRedraw( text );
83  }
84  }
85  default:;
86  }
87  item = item->next;
88  }
89  }
90 }
91 
102 {
103  MHEG5fontRefreshText((MHEG5Group *)MHEG5getCurrentApplication(), font );
104  MHEG5fontRefreshText((MHEG5Group *)MHEG5getCurrentScene(), font );
105 }
106 
107 /*
108  Constructor
109  */
116 {
117  assert(font);
118 
119  MHEG5ingredientInit(&font->ingredient);
120 }
121 
130 {
131  assert(font);
132 
133  MHEG5ingredientFree(&font->ingredient);
134 }
135 
136 /*
137  Internal behaviours
138  */
139 /*
140  no special Prepare Function
141  */
142 void MHEG5fontPrepare(MHEG5Font *font)
143 {
144  assert(font);
145  MHEG5ingredientPrepare(&font->ingredient);
146 }
147 
148 /*
149  freeMem of Font
150  */
151 void MHEG5fontDestruct(MHEG5Font *font)
152 {
153  assert(font);
154  MHEG5ingredientDestruct(&font->ingredient);
155 }
156 
157 /*
158  Activation
159  */
160 void MHEG5fontActivate(MHEG5Font *font)
161 {
162  assert(font);
163  if (!font->ingredient.root.runningStatus)
164  {
165  if (!font->ingredient.root.availabilityStatus)
166  {
167  MHEG5fontPrepare( font );
168  }
169  MHEG5ingredientActivate(&font->ingredient);
170  font->ingredient.root.runningStatus = MHEG5TRUE;
171  MHEG5sendSync((MHEG5Root *) font, MHEG5ISRUNNING, 0);
172  }
173 }
174 
175 /*
176  Deactivation
177  */
178 void MHEG5fontDeactivate(MHEG5Font *font)
179 {
180  assert(font);
181  MHEG5ingredientDeactivate(&font->ingredient);
182 }
183 
void MHEG5ingredientInit(MHEG5Ingredient *ingredient)
Initialise a ingredient object with default values.
MHEG5Bool MHEG5sameGroup(MH5GroupPtr gptr, MH5GroupRef gref)
Compares group ptr with group ref to see whether they both reference the same group. The first is pointer to group, the second can be a relative group name and will be converted to absolute prior to the comparison, so two different references that resolve to reference the same group name produces a True return value.
Definition: mh5gate.c:517
Implement the MHEG5 Text Class 36 Text Class Defines attributes and behaviour of pieces of textual in...
void MHEG5ingredientDestruct(MHEG5Ingredient *ingredient)
Implementation of the Destruction behaviour Execute the following sequence of actions: ...
void MHEG5ingredientActivate(MHEG5Ingredient *ingredient)
Implementation of Activate behaviour Inherrited from Root class.
void MHEG5fontFree(MHEG5Font *font)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
Definition: mh5font.c:129
void MHEG5fontInit(MHEG5Font *font)
Initialise a font object with default values.
Definition: mh5font.c:115
Implement Functions to support Service Gateways. Functions for standarizing several GroupIDs like +DS...
Implement the MHEG5 Font Class Font Class Defines a class to represent a character font used for rend...
Event handling. Implementation of a combined queue for events and actions. This is the eventsystem wh...
void MHEG5ingredientDeactivate(MHEG5Ingredient *ingredient)
Implementation of Deactivate behaviour Inherrited from Root class.
Implement functions to retrieve MHEG5objects by GroupID and ID.
void MHEG5ingredientPrepare(MHEG5Ingredient *ingredient)
Implementation of the Preparation behaviour Inherrited from Root class.
Implementation of the MHEG5 Application Class Defines a set of Ingredient objects, which are shared within an application scope. Base class: Group Subclasses: None Status: Concrete class.
Implementation of the MHEG5 Scene Class Scene Class Defines a set of Ingredient objects to be activat...
redirection include
MHEG5Scene * MHEG5getCurrentScene(void)
<Function description>="">
Definition: mh5scene.c:207
void MHEG5ingredientFree(MHEG5Ingredient *ingredient)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
Implement generic MHEG5-display functions - independent from the OSD These are generic functions used...
void MHEG5fontRefreshTexts(MHEG5Font *font)
Refresh Text objects that reference this Font object. This function may be called after the font has ...
Definition: mh5font.c:101
void MHEG5sendSync(MHEG5Root *source, MHEG5EventType event, MHEG5Int data)
Store an event in the synchronous event queue.
Definition: mh5queue.c:1651
MHEG5Application * MHEG5getCurrentApplication(void)
<Function description>="">