WebRadioApp  0.1
ewextfnt.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * E M B E D D E D W I Z A R D P R O J E C T
4  *
5  * Copyright (c) TARA Systems
6  *GmbH written by Paul Banach and Manfred Schweyer
7  *
8  ********************************************************************************
9  *
10  * This software and related documentation ("Software") are intellectual
11  * property owned by TARA Systems and are copyright of TARA Systems.
12  * Any modification, copying, reproduction or redistribution of the Software in
13  * whole or in part by any means not in accordance with the End-User License
14  * Agreement for Embedded Wizard is expressly prohibited. The removal of this
15  * preamble is expressly prohibited.
16  *
17  ********************************************************************************
18  *
19  * DESCRIPTION:
20  * The header 'ewextfnt' declares the platform dependent representation of a
21  * font resource. This includes data structures to store the attributes of a
22  * font resource and a set of macros to cover these structures.
23  *
24  * This header file provides the interface between the platform independent
25  * Graphics Engine and the platform specific representation of resources as
26  * they will be generated by the Embedded Wizard resource converters of the
27  * particular target system.
28  *
29  *******************************************************************************/
30 
31 #ifndef EWEXTFNT_H
32 #define EWEXTFNT_H
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /* The following is an identification number for font resources. */
39 #define EW_MAGIC_NO_FONT 0x666E7464
40 
41 /* The macro EW_FONT_PIXEL_SECTION_NAME is used to determine the section where
42  the linker should locate the memory areas containing font pixel data. */
43 #if defined EW_FONT_PIXEL_SECTION_NAME && !defined EW_FONT_PIXEL_PRAGMA
44 #define EW_STRINGIZE(aArg) EW_STRINGIZE_ARG(aArg)
45 #define EW_STRINGIZE_ARG(aArg) #aArg
46 
47 #if defined __ICCARM__
48 #define EW_FONT_PIXEL_PRAGMA \
49  _Pragma(EW_STRINGIZE(location = EW_STRINGIZE(EW_BITMAP_PIXEL_SECTION_NAME)))
50 #elif defined __CC_ARM
51 #define EW_FONT_PIXEL_PRAGMA \
52  __attribute__((section(EW_STRINGIZE(EW_FONT_PIXEL_SECTION_NAME))))
53 #elif defined __GNUC__
54 #define EW_FONT_PIXEL_PRAGMA \
55  __attribute__((section(EW_STRINGIZE(EW_FONT_PIXEL_SECTION_NAME))))
56 #endif
57 #endif
58 
59 #ifndef EW_FONT_PIXEL_PRAGMA
60 #define EW_FONT_PIXEL_PRAGMA
61 #endif
62 
63 /*******************************************************************************
64  * TYPE:
65  * XFntGlyphRes
66  *
67  * DESCRIPTION:
68  * The XFntGlyphRes structure describes a single glyph of a font resource. The
69  * structure stores the glyph metrics and the bit-offset to the location where
70  * the glyph pixel data starts. Within a font, all glyphs share a common pixel
71  * memory area.
72  *
73  * ELEMENTS:
74  * CharCode - Character code of the glyph.
75  * OriginX,
76  * OriginY - Offset in pixel to the top-left corner of the glyph, relative to
77  * the printing position on the text base-line.
78  * Width,
79  * Height - Size in pixel of the glyph (= size of the ink box).
80  * Advance - Advance in horizontal direction added to the printing position.
81  * Pixel - Bit offset to the compressed pixel data of the glyph stored in
82  * a linear order in the font's pixel memory area.
83  *
84  *******************************************************************************/
85 typedef struct {
86  unsigned short CharCode;
87  signed short OriginX;
88  signed short OriginY;
89  signed short Width;
90  signed short Height;
91  signed short Advance;
92  unsigned int Pixel;
93 } XFntGlyphRes;
94 
95 /*******************************************************************************
96  * TYPE:
97  * XFntRes
98  *
99  * DESCRIPTION:
100  * The structure XFntRes describes the attributes of a single font resource as
101  * it will be stored in the code memory.
102  *
103  * ELEMENTS:
104  * MagicNo - Unique ID of this resource type. It exists for verification
105  * purpose only.
106  * Ascent - Ascent of the font (means the area above the baseline).
107  * Descent - Descent of the font (means the area below the baseline).
108  * Leading - Leading of the font (additional distance between two
109  * rows).
110  * NoOfColors - Quality of the rasterized pixel information. Only the
111  *values 2, 4 or 16 are valid. NoOfGlyphs - Number of glyphs within this font
112  *resource. Glyphs - Table containing the description of all glyphs. The
113  *glyphs are sorted by their character codes. Pixel - Pointer to the
114  *memory area containing the compressed pixel data of all glyphs. KerningCodes
115  *- List of sorted kerning pairs as 32-bit entries. The first value in the array
116  *determines the total number of kerning pairs. Every entry stores in the lower
117  *16 bit the code of the first character and in the upper 16 bit the code of the
118  *second character. KerningValues - Values corresponding 1:1 to the entries from
119  *the array KerningCodes. The entries are interpreted as 8-bit signed values.
120  *Thus the kerning is limited to +/- 127 pixel. DefChar - Code of the
121  *character to use instead of missing characters. Name - The name of
122  *the respective font resource within Embedded Wizard project. This information
123  *is used to display error messages if glyphs are missing.
124  *
125  *******************************************************************************/
126 typedef struct XFntRes {
127  unsigned int MagicNo;
128  int Ascent;
129  int Descent;
130  int Leading;
131  int NoOfColors;
132  int NoOfGlyphs;
133  const XFntGlyphRes *Glyphs;
134  const void *Pixel;
135  const unsigned int *KerningCodes;
136  const unsigned char *KerningValues;
137  unsigned short DefChar;
138  const char *Name;
139 } XFntRes;
140 
141 /*******************************************************************************
142  * MACRO:
143  * EW_DECLARE_FONT_RES
144  * EW_DEFINE_FONT_RES
145  * EW_END_OF_FONT_RES
146  * EW_GLYPH
147  * EW_FONT_PIXEL
148  *
149  * DESCRIPTION:
150  * Following macros are used to build up the structure of a font resource in
151  * a better readable way. These macros are used by the Embedded Wizard font
152  * resource converter.
153  *
154  *******************************************************************************/
155 #define EW_DECLARE_FONT_RES(aName) extern const XVariant aName;
156 
157 #define EW_DEFINE_FONT_RES(aName, aAscent, aDescent, aLeading, aNoOfColors, \
158  aDefChar, aNoOfGlyphs) \
159  extern const unsigned int ____##aName[]; \
160  extern const XFntGlyphRes ___##aName[]; \
161  extern const unsigned int _kc_##aName[]; \
162  extern const unsigned char _kv_##aName[]; \
163  static const XFntRes __##aName = { \
164  EW_MAGIC_NO_FONT, aAscent, aDescent, aLeading, \
165  aNoOfColors, aNoOfGlyphs, ___##aName, ____##aName, \
166  _kc_##aName, _kv_##aName, aDefChar, #aName}; \
167  const XFntGlyphRes ___##aName[] = {
168 #define EW_GLYPH(aCode, aOriginX, aOriginY, aWidth, aHeight, aAdvance, aPixel) \
169  { \
170  aCode, aOriginX, aOriginY, aWidth, aHeight, aAdvance, aPixel \
171  }
172 
173 #define EW_FONT_PIXEL(aName, aSize) \
174  { \
175  0, 0, 0, 0, 0, 0, aSize \
176  } \
177  } \
178  ; \
179  EW_FONT_PIXEL_PRAGMA const unsigned int ____##aName[] = {
180 #define EW_FONT_KERNING_CODES(aName) \
181  } \
182  ; \
183  const unsigned int _kc_##aName[] = {
184 #define EW_FONT_KERNING_VALUES(aName) \
185  0 \
186  } \
187  ; \
188  const unsigned char _kv_##aName[] = {
189 #define EW_END_OF_FONT_RES(aName) \
190  0 \
191  } \
192  ; \
193  static const XResource _##aName[] = {{Default, &__##aName}};
194 
195 #ifdef __cplusplus
196 }
197 #endif
198 
199 #endif /* EWEXTFNT_H */
200 
201 /* pba, msy */
XFntRes::Descent
int Descent
Definition: ewextfnt.h:159
XFntRes::NoOfColors
int NoOfColors
Definition: ewextfnt.h:161
XFntRes
struct XFntRes XFntRes
XFntRes::Leading
int Leading
Definition: ewextfnt.h:160
XFntRes::Name
const char * Name
Definition: ewextfnt.h:168
XFntGlyphRes
Definition: ewextfnt.h:85
XFntRes::MagicNo
unsigned int MagicNo
Definition: ewextfnt.h:157
XFntRes::Ascent
int Ascent
Definition: ewextfnt.h:158
XFntRes::NoOfGlyphs
int NoOfGlyphs
Definition: ewextfnt.h:162
XFntRes::DefChar
unsigned short DefChar
Definition: ewextfnt.h:167
XFntRes
Definition: ewextfnt.h:126
XFntRes::Glyphs
const XFntGlyphRes * Glyphs
Definition: ewextfnt.h:163
XFntRes::Pixel
const void * Pixel
Definition: ewextfnt.h:164
XFntRes::KerningValues
const unsigned char * KerningValues
Definition: ewextfnt.h:166
XFntRes::KerningCodes
const unsigned int * KerningCodes
Definition: ewextfnt.h:165