]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/HiiFont.h
Updated headers to follow coding standard
[mirror_edk2.git] / MdePkg / Include / Protocol / HiiFont.h
CommitLineData
d1f95000 1/** @file\r
2 The file provides services to retrieve font information.\r
3 \r
4 Copyright (c) 2006 - 2007, Intel Corporation\r
5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
d1f95000 13**/\r
14\r
15#ifndef __HII_FONT_H__\r
16#define __HII_FONT_H__\r
17\r
18#include <Protocol/HiiImage.h>\r
19\r
20#define EFI_HII_FONT_PROTOCOL_GUID \\r
21{ 0xe9ca4775, 0x8657, 0x47fc, { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 } }\r
22\r
23typedef struct _EFI_HII_FONT_PROTOCOL EFI_HII_FONT_PROTOCOL;\r
24\r
25\r
26//\r
27// EFI_HII_OUT_FLAGS\r
28// \r
29typedef UINT32 EFI_HII_OUT_FLAGS;\r
30#define EFI_HII_OUT_FLAG_CLIP 0x00000001\r
31#define EFI_HII_OUT_FLAG_WRAP 0x00000002\r
32#define EFI_HII_OUT_FLAG_CLEAN_Y 0x00000004\r
33#define EFI_HII_OUT_FLAG_CLEAN_X 0x00000008\r
34#define EFI_HII_OUT_FLAG_TRANSPARENT 0x00000010\r
35#define EFI_HII_IGNORE_IF_NO_GLYPH 0x00000020\r
36#define EFI_HII_IGNORE_LINE_BREAK 0x00000040\r
37#define EFI_HII_DIRECT_TO_SCREEN 0x00000080\r
38\r
39/**\r
40\r
41 Definition of EFI_HII_ROW_INFO.\r
42\r
43 @param StartIndex The index of the first character in the\r
44 string which is displayed on the line.\r
45\r
46 @param EndIndex The index of the last character in the string\r
47 which is displayed on the line. If this is the\r
48 same as StartIndex, then no characters are\r
49 displayed.\r
50\r
51 @param LineHeight The height of the line, in pixels.\r
52\r
53 @param LineWidth The width of the text on the line, in\r
54 pixels.\r
55\r
56 @param BaselineOffset The number of pixels above the bottom of\r
57 the row of the font baseline or 0 if\r
58 none.\r
59\r
60**/\r
61typedef struct _EFI_HII_ROW_INFO {\r
62 UINTN StartIndex;\r
63 UINTN EndIndex;\r
64 UINTN LineHeight;\r
65 UINTN LineWidth;\r
66 UINTN BaselineOffset;\r
67} EFI_HII_ROW_INFO;\r
68\r
69//\r
70// EFI_FONT_INFO_MASK\r
71// \r
72typedef UINT32 EFI_FONT_INFO_MASK;\r
73#define EFI_FONT_INFO_SYS_FONT 0x00000001\r
74#define EFI_FONT_INFO_SYS_SIZE 0x00000002\r
75#define EFI_FONT_INFO_SYS_STYLE 0x00000004\r
76#define EFI_FONT_INFO_SYS_FORE_COLOR 0x00000010\r
77#define EFI_FONT_INFO_SYS_BACK_COLOR 0x00000020\r
78#define EFI_FONT_INFO_RESIZE 0x00001000\r
79#define EFI_FONT_INFO_RESTYLE 0x00002000\r
80#define EFI_FONT_INFO_ANY_FONT 0x00010000\r
81#define EFI_FONT_INFO_ANY_SIZE 0x00020000\r
82#define EFI_FONT_INFO_ANY_STYLE 0x00040000\r
83\r
84//\r
85// EFI_FONT_INFO\r
86// \r
87typedef struct {\r
88 UINT32 FontStyle;\r
89 UINT16 FontSize;\r
90 CHAR16 FontName[1];\r
91} EFI_FONT_INFO;\r
92\r
93/**\r
94 This structure is used for describing the way in which a string\r
95 should be rendered in a particular font. FontInfo specifies the\r
96 basic font information and ForegroundColor and BackgroundColor\r
97 specify the color in which they should be displayed. The flags\r
98 in FontInfoMask describe where the system default should be\r
99 supplied instead of the specified information. The flags also\r
100 describe what options can be used to make a match between the\r
101 font requested and the font available. If EFI_FONT_INFO_SYS_FONT\r
102 is specified, then the font name in FontInfo is ignored and the\r
103 system font name is used. This flag cannot be used with\r
104 EFI_FONT_INFO_ANY_FONT. If EFI_FONT_INFO_SYS_SIZE is specified,\r
105 then the font height specified in FontInfo is ignored and the\r
106 system font height is used instead. This flag cannot be used\r
107 with EFI_FONT_INFO_ANY_SIZE. If EFI_FONT_INFO_SYS_STYLE is\r
108 specified, then the font style in FontInfo is ignored and the\r
109 system font style is used. This flag cannot be used with\r
110 EFI_FONT_INFO_ANY_STYLE. If EFI_FONT_INFO_SYS_FORE_COLOR is\r
111 specified, then ForegroundColor is ignored and the system\r
112 foreground color is used. If EFI_FONT_INFO_SYS_BACK_COLOR is\r
113 specified, then BackgroundColor is ignored and the system\r
114 background color is used. If EFI_FONT_INFO_RESIZE is specified,\r
115 then the system may attempt to stretch or shrink a font to meet\r
116 the size requested. This flag cannot be used with\r
117 EFI_FONT_INFO_ANY_SIZE. If EFI_FONT_INFO_RESTYLE is specified,\r
118 then the system may attempt to remove some of the specified\r
119 styles in order to meet the style requested. This flag cannot be\r
120 used with EFI_FONT_INFO_ANY_STYLE. If EFI_FONT_INFO_ANY_FONT is\r
121 specified, then the system may attempt to match with any font.\r
122 This flag cannot be used with EFI_FONT_INFO_SYS_FONT. If\r
123 EFI_FONT_INFO_ANY_SIZE is specified, then the system may attempt\r
124 to match with any font size. This flag cannot be used with\r
125 EFI_FONT_INFO_SYS_SIZE or EFI_FONT_INFO_RESIZE. If\r
126 EFI_FONT_INFO_ANY_STYLE is specified, then the system may\r
127 attempt to match with any font style. This flag cannot be used\r
128 with EFI_FONT_INFO_SYS_STYLE or EFI_FONT_INFO_RESTYLE.\r
129\r
130 @param FontInfo Points to the font information or NULL if the\r
131 string should use the default system font.\r
132 \r
133 @param ForegroundColor The color of the "on" pixels in the\r
134 glyph in the bitmap.\r
135 \r
136 @param BackgroundColor The color of the "off" pixels in the\r
137 glyph in the bitmap.\r
138 \r
139 @param FontInfoMask The font information mask determines\r
140 which portion of the font information\r
141 will be used and what to do if the\r
142 specific font is not available.\r
143 \r
144**/\r
145typedef struct _EFI_FONT_DISPLAY_INFO {\r
146 EFI_FONT_INFO FontInfo;\r
147 EFI_GRAPHICS_OUTPUT_BLT_PIXEL ForegroundColor;\r
148 EFI_GRAPHICS_OUTPUT_BLT_PIXEL BackgroundColor;\r
149 EFI_FONT_INFO_MASK FontInfoMask;\r
150} EFI_FONT_DISPLAY_INFO;\r
151\r
152/**\r
153\r
154 This function renders a string to a bitmap or the screen using\r
155 the specified font, color and options. It either draws the\r
156 string and glyphs on an existing bitmap, allocates a new bitmap\r
157 or uses the screen. The strings can be clipped or wrapped.\r
158 Optionally, the function also returns the information about each\r
159 row and the character position on that row. If\r
160 EFI_HII_OUT_FLAG_CLIP is set, then text will be formatted only\r
161 based on explicit line breaks and all pixels which would lie\r
162 outside the bounding box specified by Width and Height are\r
163 ignored. The information in the RowInfoArray only describes\r
164 characters which are at least partially displayed. For the final\r
165 row, the LineHeight and BaseLine may describe pixels which are\r
166 outside the limit specified by Height (unless\r
167 EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is specified) even though those\r
168 pixels were not drawn. The LineWidth may describe pixels which\r
169 are outside the limit specified by Width (unless\r
170 EFI_HII_OUT_FLAG_CLIP_CLEAN_X is specified) even though those\r
171 pixels were not drawn. If EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set,\r
172 then it modifies the behavior of EFI_HII_OUT_FLAG_CLIP so that\r
173 if a character????s right-most on pixel cannot fit, then it will\r
174 not be drawn at all. This flag requires that\r
175 EFI_HII_OUT_FLAG_CLIP be set. If EFI_HII_OUT_FLAG_CLIP_CLEAN_Y\r
176 is set, then it modifies the behavior of EFI_HII_OUT_FLAG_CLIP\r
177 so that if a row????s bottom-most pixel cannot fit, then it will\r
178 not be drawn at all. This flag requires that\r
179 EFI_HII_OUT_FLAG_CLIP be set. If EFI_HII_OUT_FLAG_WRAP is set,\r
180 then text will be wrapped at the right-most line-break\r
181 opportunity prior to a character whose right-most extent would\r
182 exceed Width. If no line-break opportunity can be found, then\r
183 the text will behave as if EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set.\r
184 This flag cannot be used with EFI_HII_OUT_FLAG_CLIP_CLEAN_X. If\r
185 EFI_HII_OUT_FLAG_TRANSPARENT is set, then BackgroundColor is\r
186 ignored and all ????off???? pixels in the character????s drawn\r
187 will use the pixel value from Blt. This flag cannot be used if\r
188 Blt is NULL upon entry. If EFI_HII_IGNORE_IF_NO_GLYPH is set,\r
189 then characters which have no glyphs are not drawn. Otherwise,\r
190 they are replaced with Unicode character 0xFFFD (REPLACEMENT\r
191 CHARACTER). If EFI_HII_IGNORE_LINE_BREAK is set, then explicit\r
192 line break characters will be ignored. If\r
193 EFI_HII_DIRECT_TO_SCREEN is set, then the string will be written\r
194 directly to the output device specified by Screen. Otherwise the\r
195 string will be rendered to the bitmap specified by Bitmap.\r
196\r
197 @param This A pointer to the EFI_HII_FONT_PROTOCOL instance.\r
198\r
199 @param Flags Describes how the string is to be drawn.\r
200\r
201 @param String Points to the null-terminated string to be\r
202 displayed.\r
203\r
204 @param StringInfo Points to the string output information,\r
205 including the color and font. If NULL, then\r
206 the string will be output in the default\r
207 system font and color.\r
208\r
209 @param Blt If this points to a non-NULL on entry, this points\r
210 to the image, which is Width pixels wide and\r
211 Height pixels high. The string will be drawn onto\r
212 this image and EFI_HII_OUT_FLAG_CLIP is implied.\r
213 If this points to a NULL on entry, then a buffer\r
214 will be allocated to hold the generated image and\r
215 the pointer updated on exit. It is the caller's\r
216 responsibility to free this buffer.\r
217\r
218 @param BltX, BltY Specifies the offset from the left and top\r
219 edge of the image of the first character\r
220 cell in the image.\r
221\r
222 @param RowInfoArray If this is non-NULL on entry, then on\r
223 exit, this will point to an allocated buffer\r
224 containing row information and\r
225 RowInfoArraySize will be updated to contain\r
226 the number of elements. This array describes\r
227 the characters which were at least partially\r
228 drawn and the heights of the rows. It is the\r
229 caller's responsibility to free this buffer.\r
230\r
231 @param RowInfoArraySize If this is non-NULL on entry, then on\r
232 exit it contains the number of\r
233 elements in RowInfoArray.\r
234\r
235 @param ColumnInfoArray If this is non-NULL, then on return it\r
236 will be filled with the horizontal\r
237 offset for each character in the\r
238 string on the row where it is\r
239 displayed. Non-printing characters\r
240 will have the offset ~0. The caller is\r
241 responsible to allocate a buffer large\r
242 enough so that there is one entry for\r
243 each character in the string, not\r
244 including the null-terminator. It is\r
245 possible when character display is\r
246 normalized that some character cells\r
247 overlap.\r
248\r
249 @retval EFI_SUCCESS The string was successfully updated.\r
250 \r
251 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output\r
252 buffer for RowInfoArray or Blt.\r
253 \r
254 @retval EFI_INVALID_PARAMETER The String or Blt or Height or\r
255 Width was NULL.\r
256\r
257 \r
258**/\r
259typedef\r
260EFI_STATUS\r
261(EFIAPI *EFI_HII_STRING_TO_IMAGE) (\r
262 IN CONST EFI_HII_FONT_PROTOCOL *This,\r
263 IN CONST EFI_HII_OUT_FLAGS Flags,\r
264 IN CONST EFI_STRING String,\r
265 IN CONST EFI_FONT_DISPLAY_INFO *StringInfo,\r
266 IN OUT EFI_IMAGE_OUTPUT **Blt,\r
267 IN CONST UINTN BltX,\r
268 IN CONST UINTN BltY,\r
269 OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL,\r
270 OUT UINTN *RowInfoArraySize OPTIONAL,\r
271 OUT UINTN *ColumnInfoArray OPTIONAL\r
272);\r
273\r
274\r
275\r
276/**\r
277\r
278 This function renders a string as a bitmap or to the screen\r
279 and can clip or wrap the string. The bitmap is either supplied\r
280 by the caller or else is allocated by the function. The\r
281 strings are drawn with the font, size and style specified and\r
282 can be drawn transparently or opaquely. The function can also\r
283 return information about each row and each character's\r
284 position on the row. If EFI_HII_OUT_FLAG_CLIP is set, then\r
285 text will be formatted only based on explicit line breaks and\r
286 all pixels which would lie outside the bounding box specified\r
287 by Width and Height are ignored. The information in the\r
288 RowInfoArray only describes characters which are at least\r
289 partially displayed. For the final row, the LineHeight and\r
290 BaseLine may describe pixels which are outside the limit\r
291 specified by Height (unless EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is\r
292 specified) even though those pixels were not drawn. If\r
293 EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set, then it modifies the\r
294 behavior of EFI_HII_OUT_FLAG_CLIP so that if a character????s\r
295 right-most on pixel cannot fit, then it will not be drawn at\r
296 all. This flag requires that EFI_HII_OUT_FLAG_CLIP be set. If\r
297 EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is set, then it modifies the\r
298 behavior of EFI_HII_OUT_FLAG_CLIP so that if a row????s bottom\r
299 most pixel cannot fit, then it will not be drawn at all. This\r
300 flag requires that EFI_HII_OUT_FLAG_CLIP be set. Draft for\r
301 Review HII Protocols Version 2.1 November 3, 2006 1285 If\r
302 EFI_HII_OUT_FLAG_WRAP is set, then text will be wrapped at the\r
303 right-most line-break opportunity prior to a character whose\r
304 right-most extent would exceed Width. If no line-break\r
305 opportunity can be found, then the text will behave as if\r
306 EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set. This flag cannot be used\r
307 with EFI_HII_OUT_FLAG_CLIP_CLEAN_X. If\r
308 EFI_HII_OUT_FLAG_TRANSPARENT is set, then BackgroundColor is\r
309