]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Efi/Protocol/HiiFont/HiiFont.h
Sync all bug fixes between EDK1.04 and EDK1.06 into EdkCompatibilityPkg.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Efi / Protocol / HiiFont / HiiFont.h
CommitLineData
2c40a813 1/*++\r
2\r
3e99020d 3Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
f57387d5 4This program and the accompanying materials \r
2c40a813 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 HiiFont.h\r
15 \r
16Abstract:\r
17\r
18 EFI_HII_FONT_PROTOCOL from UEFI 2.1 specification.\r
19 \r
20 This protocol provides interfaces to retrieve font information.\r
21\r
22Revision History\r
23\r
24--*/\r
25\r
26#ifndef __EFI_HII_FONT_PROTOCOL_H__\r
27#define __EFI_HII_FONT_PROTOCOL_H__\r
28\r
29#include EFI_PROTOCOL_DEFINITION (GraphicsOutput)\r
30#include EFI_PROTOCOL_DEFINITION (HiiImage)\r
31\r
32//\r
33// Global ID for the Hii Font Protocol.\r
34//\r
35\r
36#define EFI_HII_FONT_PROTOCOL_GUID \\r
37 { \\r
7ccf38a3 38 0xe9ca4775, 0x8657, 0x47fc, {0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24} \\r
2c40a813 39 }\r
40\r
41EFI_FORWARD_DECLARATION (EFI_HII_FONT_PROTOCOL);\r
42\r
43typedef UINT32 EFI_HII_OUT_FLAGS;\r
44typedef UINT32 EFI_FONT_INFO_MASK;\r
45typedef VOID* EFI_FONT_HANDLE;\r
46\r
47typedef struct _EFI_HII_ROW_INFO {\r
48 UINTN StartIndex;\r
49 UINTN EndIndex;\r
50 UINTN LineHeight;\r
51 UINTN LineWidth;\r
52 UINTN BaselineOffset;\r
53} EFI_HII_ROW_INFO;\r
54\r
55typedef struct {\r
3e99020d
LG
56 EFI_HII_FONT_STYLE FontStyle;\r
57 UINT16 FontSize; // character cell height in pixels\r
58 CHAR16 FontName[1];\r
2c40a813 59} EFI_FONT_INFO;\r
60\r
61typedef struct _EFI_FONT_DISPLAY_INFO {\r
62 EFI_GRAPHICS_OUTPUT_BLT_PIXEL ForegroundColor;\r
63 EFI_GRAPHICS_OUTPUT_BLT_PIXEL BackgroundColor;\r
64 EFI_FONT_INFO_MASK FontInfoMask;\r
65 EFI_FONT_INFO FontInfo; \r
66} EFI_FONT_DISPLAY_INFO;\r
67\r
3e99020d
LG
68#define EFI_HII_OUT_FLAG_CLIP 0x00000001\r
69#define EFI_HII_OUT_FLAG_WRAP 0x00000002\r
70#define EFI_HII_OUT_FLAG_CLIP_CLEAN_Y 0x00000004\r
71#define EFI_HII_OUT_FLAG_CLIP_CLEAN_X 0x00000008\r
72#define EFI_HII_OUT_FLAG_TRANSPARENT 0x00000010\r
73#define EFI_HII_IGNORE_IF_NO_GLYPH 0x00000020\r
74#define EFI_HII_IGNORE_LINE_BREAK 0x00000040\r
75#define EFI_HII_DIRECT_TO_SCREEN 0x00000080\r
76\r
77#define EFI_FONT_INFO_SYS_FONT 0x00000001\r
78#define EFI_FONT_INFO_SYS_SIZE 0x00000002\r
79#define EFI_FONT_INFO_SYS_STYLE 0x00000004\r
80#define EFI_FONT_INFO_SYS_FORE_COLOR 0x00000010\r
81#define EFI_FONT_INFO_SYS_BACK_COLOR 0x00000020\r
82#define EFI_FONT_INFO_RESIZE 0x00001000\r
83#define EFI_FONT_INFO_RESTYLE 0x00002000\r
84#define EFI_FONT_INFO_ANY_FONT 0x00010000\r
85#define EFI_FONT_INFO_ANY_SIZE 0x00020000\r
86#define EFI_FONT_INFO_ANY_STYLE 0x00040000\r
2c40a813 87\r
88typedef\r
89EFI_STATUS\r
90(EFIAPI *EFI_HII_STRING_TO_IMAGE) (\r
91 IN CONST EFI_HII_FONT_PROTOCOL *This,\r
92 IN EFI_HII_OUT_FLAGS Flags,\r
93 IN CONST EFI_STRING String,\r
94 IN CONST EFI_FONT_DISPLAY_INFO *StringInfo OPTIONAL,\r
95 IN OUT EFI_IMAGE_OUTPUT **Blt,\r
96 IN UINTN BltX,\r
97 IN UINTN BltY,\r
98 OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL,\r
99 OUT UINTN *RowInfoArraySize OPTIONAL,\r
100 OUT UINTN *ColumnInfoArray OPTIONAL\r
101 )\r
102/*++\r
103\r
104 Routine Description:\r
105 Renders a string to a bitmap or to the display.\r
106\r
107 Arguments: \r
108 This - A pointer to the EFI_HII_FONT_PROTOCOL instance.\r
109 Flags - Describes how the string is to be drawn. \r
110 String - Points to the null-terminated string to be displayed.\r
111 StringInfo - Points to the string output information, including the color and font. \r
3e99020d 112 If NULL, then the string will be output in the default system font and color.\r
2c40a813 113 Blt - If this points to a non-NULL on entry, this points to the image, which is Width pixels \r
114 wide and Height pixels high. The string will be drawn onto this image and \r
115 EFI_HII_OUT_FLAG_CLIP is implied. If this points to a NULL on entry, then a \r
116 buffer will be allocated to hold the generated image and the pointer updated on exit. It\r
fd0d281b 117 is the caller's responsibility to free this buffer. \r
2c40a813 118 BltX,BLTY - Specifies the offset from the left and top edge of the image of the first character cell in\r
119 the image. \r
120 RowInfoArray - If this is non-NULL on entry, then on exit, this will point to an allocated buffer \r
121 containing row information and RowInfoArraySize will be updated to contain the \r
122 number of elements. This array describes the characters which were at least partially\r
fd0d281b 123 drawn and the heights of the rows. It is the caller's responsibility to free this buffer. \r
2c40a813 124 RowInfoArraySize - If this is non-NULL on entry, then on exit it contains the number of elements in\r
125 RowInfoArray. \r
126 ColumnInfoArray - If this is non-NULL, then on return it will be filled with the horizontal offset for each \r
127 character in the string on the row where it is displayed. Non-printing characters will \r
128 have the offset ~0. The caller is responsible to allocate a buffer large enough so that \r
129 there is one entry for each character in the string, not including the null-terminator. It\r
130 is possible when character display is normalized that some character cells overlap. \r
131 \r
132 Returns:\r
133 EFI_SUCCESS - The string was successfully rendered. \r
134 EFI_OUT_OF_RESOURCES - Unable to allocate an output buffer for RowInfoArray or Blt.\r
3e99020d
LG
135 EFI_INVALID_PARAMETER - The String or Blt was NULL.\r
136 EFI_INVALID_PARAMETER - Flags were invalid combination.\r
2c40a813 137 \r
138--*/\r
139;\r
140\r
141typedef\r
142EFI_STATUS\r
143(EFIAPI *EFI_HII_STRING_ID_TO_IMAGE) (\r
144 IN CONST EFI_HII_FONT_PROTOCOL *This,\r
145 IN EFI_HII_OUT_FLAGS Flags, \r
146 IN EFI_HII_HANDLE PackageList,\r
147 IN EFI_STRING_ID StringId,\r
148 IN CONST CHAR8* Language,\r
149 IN CONST EFI_FONT_DISPLAY_INFO *StringInfo OPTIONAL,\r
150 IN OUT EFI_IMAGE_OUTPUT **Blt,\r
151 IN UINTN BltX,\r
152 IN UINTN BltY,\r
153 OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL,\r
154 OUT UINTN *RowInfoArraySize OPTIONAL,\r
155 OUT UINTN *ColumnInfoArray OPTIONAL\r
156 )\r
157/*++\r
158\r
159 Routine Description:\r
160 Render a string to a bitmap or the screen containing the contents of the specified string.\r
161\r
162 Arguments: \r
163 This - A pointer to the EFI_HII_FONT_PROTOCOL instance.\r
164 Flags - Describes how the string is to be drawn. \r
165 PackageList - The package list in the HII database to search for the specified string. \r
fd0d281b 166 StringId - The string's id, which is unique within PackageList. \r
2c40a813 167 Language - Points to the language for the retrieved string. If NULL, then the current system\r
168 language is used. \r
169 StringInfo - Points to the string output information, including the color and font. \r
3e99020d 170 If NULL, then the string will be output in the default system font and color.\r
2c40a813 171 Blt - If this points to a non-NULL on entry, this points to the image, which is Width pixels \r
172 wide and Height pixels high. The string will be drawn onto this image and \r
173 EFI_HII_OUT_FLAG_CLIP is implied. If this points to a NULL on entry, then a \r
174 buffer will be allocated to hold the generated image and the pointer updated on exit. It\r
fd0d281b 175 is the caller's responsibility to free this buffer. \r
2c40a813 176 BltX,BLTY - Specifies the offset from the left and top edge of the image of the first character cell in\r
177 the image. \r
178 RowInfoArray - If this is non-NULL on entry, then on exit, this will point to an allocated buffer \r
179 containing row information and RowInfoArraySize will be updated to contain the \r
180 number of elements. This array describes the characters which were at least partially\r
fd0d281b 181 drawn and the heights of the rows. It is the caller's responsibility to free this buffer. \r
2c40a813 182 RowInfoArraySize - If this is non-NULL on entry, then on exit it contains the number of elements in\r
183 RowInfoArray. \r
184 ColumnInfoArray - If this is non-NULL, then on return it will be filled with the horizontal offset for each \r
185 character in the string on the row where it is displayed. Non-printing characters will \r
186 have the offset ~0. The caller is responsible to allocate a buffer large enough so that \r
187 there is one entry for each character in the string, not including the null-terminator. It\r
188 is possible when character display is normalized that some character cells overlap. \r
189 \r
190 Returns:\r
3e99020d 191 EFI_SUCCESS - The string was successfully rendered.\r
2c40a813 192 EFI_OUT_OF_RESOURCES - Unable to allocate an output buffer for RowInfoArray or Blt.\r
3e99020d
LG
193 EFI_INVALID_PARAMETER - The Blt or PackageList was NULL.\r
194 EFI_INVALID_PARAMETER - Flags were invalid combination.\r
195 EFI_NOT_FOUND - The specified PackageList is not in the Database or the stringid is not \r
196 in the specified PackageList. \r
2c40a813 197 \r
198--*/\r
199;\r
200\r
201typedef\r
202EFI_STATUS\r
203(EFIAPI *EFI_HII_GET_GLYPH) (\r
204 IN CONST EFI_HII_FONT_PROTOCOL *This,\r
205 IN CHAR16 Char,\r
206 IN CONST EFI_FONT_DISPLAY_INFO *StringInfo,\r
207 OUT EFI_IMAGE_OUTPUT **Blt,\r
208 OUT UINTN *Baseline OPTIONAL\r
209 )\r
210/*++\r
211\r
212 Routine Description:\r
213 Convert the glyph for a single character into a bitmap.\r
214\r
215 Arguments: \r
216 This - A pointer to the EFI_HII_FONT_PROTOCOL instance.\r
217 Char - Character to retrieve.\r
218 StringInfo - Points to the string font and color information or NULL if the string should use the\r
219 default system font and color. \r
220 Blt - Thus must point to a NULL on entry. A buffer will be allocated to hold the output and\r
fd0d281b 221 the pointer updated on exit. It is the caller's responsibility to free this buffer. \r
2c40a813 222 Baseline - Number of pixels from the bottom of the bitmap to the baseline.\r
223\r
224 Returns:\r
225 EFI_SUCCESS - Glyph bitmap created.\r
226 EFI_OUT_OF_RESOURCES - Unable to allocate the output buffer Blt. \r
227 EFI_WARN_UNKNOWN_GLYPH - The glyph was unknown and was \r
228 replaced with the glyph for Unicode\r
229 character 0xFFFD. \r
230 EFI_INVALID_PARAMETER - Blt is NULL or *Blt is not NULL.\r
231 \r
232--*/ \r
233;\r
234\r
235typedef\r
236EFI_STATUS\r
237(EFIAPI *EFI_HII_GET_FONT_INFO) (\r
238 IN CONST EFI_HII_FONT_PROTOCOL *This,\r
239 IN OUT EFI_FONT_HANDLE *FontHandle,\r
3e99020d 240 IN CONST EFI_FONT_DISPLAY_INFO *StringInfoIn, OPTIONAL\r
2c40a813 241 OUT EFI_FONT_DISPLAY_INFO **StringInfoOut,\r
242 IN CONST EFI_STRING String OPTIONAL\r
243 )\r
244/*++\r
245\r
246 Routine Description:\r
247 This function iterates through fonts which match the specified font, using \r
248 the specified criteria. If String is non-NULL, then all of the characters in \r
249 the string must exist in order for a candidate font to be returned.\r
250 \r
251 Arguments: \r
252 This - A pointer to the EFI_HII_FONT_PROTOCOL instance.\r
3e99020d
LG
253 FontHandle - On entry, points to the font handle returned by a previous \r
254 call to GetFontInfo() or points to NULL to start with the \r
2c40a813 255 first font. On return, points to the returned font handle or\r
3e99020d
LG
256 points to NULL if there are no more matching fonts.\r
257 StringInfoIn - Upon entry, points to the font to return information about.\r
258 If NULL, then the information about the system default \r
259 font will be returned.\r
fd0d281b 260 StringInfoOut - Upon return, contains the matching font's information. \r
2c40a813 261 If NULL, then no information is returned.\r
262 It's caller's responsibility to free this buffer.\r
263 String - Points to the string which will be tested to determine \r
264 if all characters are available. If NULL, then any font \r
265 is acceptable.\r
266\r
267 Returns:\r
268 EFI_SUCCESS - Matching font returned successfully.\r
269 EFI_NOT_FOUND - No matching font was found.\r
3e99020d 270 EFI_INVALID_PARAMETER - StringInfoIn->FontInfoMask is an invalid combination.\r
2c40a813 271 EFI_OUT_OF_RESOURCES - There were insufficient resources to complete the request.\r
272 \r
3e99020d 273--*/\r
2c40a813 274;\r
275\r
276\r
277//\r
278// Interface structure for the EFI_HII_FONT_PROTOCOL\r
279//\r
e5bce275 280struct _EFI_HII_FONT_PROTOCOL {\r
2c40a813 281 EFI_HII_STRING_TO_IMAGE StringToImage;\r
282 EFI_HII_STRING_ID_TO_IMAGE StringIdToImage;\r
283 EFI_HII_GET_GLYPH GetGlyph;\r
284 EFI_HII_GET_FONT_INFO GetFontInfo;\r
e5bce275 285};\r
2c40a813 286\r
287extern EFI_GUID gEfiHiiFontProtocolGuid;\r
288\r
289#endif\r