iPXE
HiiFont.h
Go to the documentation of this file.
1/** @file
2 The file provides services to retrieve font information.
3
4Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 @par Revision Reference:
8 This Protocol was introduced in UEFI Specification 2.1.
9
10**/
11
12#ifndef __HII_FONT_H__
13#define __HII_FONT_H__
14
15FILE_LICENCE ( BSD2_PATENT );
16FILE_SECBOOT ( PERMITTED );
17
20
21#define EFI_HII_FONT_PROTOCOL_GUID \
22{ 0xe9ca4775, 0x8657, 0x47fc, { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 } }
23
25
27
28///
29/// EFI_HII_OUT_FLAGS.
30///
32
33#define EFI_HII_OUT_FLAG_CLIP 0x00000001
34#define EFI_HII_OUT_FLAG_WRAP 0x00000002
35#define EFI_HII_OUT_FLAG_CLIP_CLEAN_Y 0x00000004
36#define EFI_HII_OUT_FLAG_CLIP_CLEAN_X 0x00000008
37#define EFI_HII_OUT_FLAG_TRANSPARENT 0x00000010
38#define EFI_HII_IGNORE_IF_NO_GLYPH 0x00000020
39#define EFI_HII_IGNORE_LINE_BREAK 0x00000040
40#define EFI_HII_DIRECT_TO_SCREEN 0x00000080
41
42/**
43 Definition of EFI_HII_ROW_INFO.
44**/
45typedef struct _EFI_HII_ROW_INFO {
46 ///
47 /// The index of the first character in the string which is displayed on the line.
48 ///
50 ///
51 /// The index of the last character in the string which is displayed on the line.
52 /// If this is the same as StartIndex, then no characters are displayed.
53 ///
55 UINTN LineHeight; ///< The height of the line, in pixels.
56 UINTN LineWidth; ///< The width of the text on the line, in pixels.
57
58 ///
59 /// The font baseline offset in pixels from the bottom of the row, or 0 if none.
60 ///
63
64///
65/// Font info flag. All flags (FONT, SIZE, STYLE, and COLOR) are defined.
66/// They are defined as EFI_FONT_INFO_***
67///
69
70#define EFI_FONT_INFO_SYS_FONT 0x00000001
71#define EFI_FONT_INFO_SYS_SIZE 0x00000002
72#define EFI_FONT_INFO_SYS_STYLE 0x00000004
73#define EFI_FONT_INFO_SYS_FORE_COLOR 0x00000010
74#define EFI_FONT_INFO_SYS_BACK_COLOR 0x00000020
75#define EFI_FONT_INFO_RESIZE 0x00001000
76#define EFI_FONT_INFO_RESTYLE 0x00002000
77#define EFI_FONT_INFO_ANY_FONT 0x00010000
78#define EFI_FONT_INFO_ANY_SIZE 0x00020000
79#define EFI_FONT_INFO_ANY_STYLE 0x00040000
80
81//
82// EFI_FONT_INFO
83//
84typedef struct {
86 UINT16 FontSize; ///< character cell height in pixels
89
90/**
91 Describes font output-related information.
92
93 This structure is used for describing the way in which a string
94 should be rendered in a particular font. FontInfo specifies the
95 basic font information and ForegroundColor and BackgroundColor
96 specify the color in which they should be displayed. The flags
97 in FontInfoMask describe where the system default should be
98 supplied instead of the specified information. The flags also
99 describe what options can be used to make a match between the
100 font requested and the font available.
101**/
108
109/**
110
111 This function renders a string to a bitmap or the screen using
112 the specified font, color and options. It either draws the
113 string and glyphs on an existing bitmap, allocates a new bitmap,
114 or uses the screen. The strings can be clipped or wrapped.
115 Optionally, the function also returns the information about each
116 row and the character position on that row. If
117 EFI_HII_OUT_FLAG_CLIP is set, then text will be formatted only
118 based on explicit line breaks and all pixels which would lie
119 outside the bounding box specified by Width and Height are
120 ignored. The information in the RowInfoArray only describes
121 characters which are at least partially displayed. For the final
122 row, the LineHeight and BaseLine may describe pixels that are
123 outside the limit specified by Height (unless
124 EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is specified) even though those
125 pixels were not drawn. The LineWidth may describe pixels which
126 are outside the limit specified by Width (unless
127 EFI_HII_OUT_FLAG_CLIP_CLEAN_X is specified) even though those
128 pixels were not drawn. If EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set,
129 then it modifies the behavior of EFI_HII_OUT_FLAG_CLIP so that
130 if a character's right-most on pixel cannot fit, then it will
131 not be drawn at all. This flag requires that
132 EFI_HII_OUT_FLAG_CLIP be set. If EFI_HII_OUT_FLAG_CLIP_CLEAN_Y
133 is set, then it modifies the behavior of EFI_HII_OUT_FLAG_CLIP
134 so that if a row's bottom-most pixel cannot fit, then it will
135 not be drawn at all. This flag requires that
136 EFI_HII_OUT_FLAG_CLIP be set. If EFI_HII_OUT_FLAG_WRAP is set,
137 then text will be wrapped at the right-most line-break
138 opportunity prior to a character whose right-most extent would
139 exceed Width. If no line-break opportunity can be found, then
140 the text will behave as if EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set.
141 This flag cannot be used with EFI_HII_OUT_FLAG_CLIP_CLEAN_X. If
142 EFI_HII_OUT_FLAG_TRANSPARENT is set, then BackgroundColor is
143 ignored and all 'off' pixels in the character's drawn
144 will use the pixel value from Blt. This flag cannot be used if
145 Blt is NULL upon entry. If EFI_HII_IGNORE_IF_NO_GLYPH is set,
146 then characters which have no glyphs are not drawn. Otherwise,
147 they are replaced with Unicode character code 0xFFFD (REPLACEMENT
148 CHARACTER). If EFI_HII_IGNORE_LINE_BREAK is set, then explicit
149 line break characters will be ignored. If
150 EFI_HII_DIRECT_TO_SCREEN is set, then the string will be written
151 directly to the output device specified by Screen. Otherwise the
152 string will be rendered to the bitmap specified by Bitmap.
153
154 @param This A pointer to the EFI_HII_FONT_PROTOCOL instance.
155
156 @param Flags Describes how the string is to be drawn.
157
158 @param String Points to the null-terminated string to be
159
160 @param StringInfo Points to the string output information,
161 including the color and font. If NULL, then
162 the string will be output in the default
163 system font and color.
164
165 @param Blt If this points to a non-NULL on entry, this points
166 to the image, which is Width pixels wide and
167 Height pixels high. The string will be drawn onto
168 this image and EFI_HII_OUT_FLAG_CLIP is implied.
169 If this points to a NULL on entry, then a buffer
170 will be allocated to hold the generated image and
171 the pointer updated on exit. It is the caller's
172 responsibility to free this buffer.
173
174 @param BltX, BltY Specifies the offset from the left and top
175 edge of the image of the first character
176 cell in the image.
177
178 @param RowInfoArray If this is non-NULL on entry, then on
179 exit, this will point to an allocated buffer
180 containing row information and
181 RowInfoArraySize will be updated to contain
182 the number of elements. This array describes
183 the characters that were at least partially
184 drawn and the heights of the rows. It is the
185 caller's responsibility to free this buffer.
186
187 @param RowInfoArraySize If this is non-NULL on entry, then on
188 exit it contains the number of
189 elements in RowInfoArray.
190
191 @param ColumnInfoArray If this is non-NULL, then on return it
192 will be filled with the horizontal
193 offset for each character in the
194 string on the row where it is
195 displayed. Non-printing characters
196 will have the offset ~0. The caller is
197 responsible for allocating a buffer large
198 enough so that there is one entry for
199 each character in the string, not
200 including the null-terminator. It is
201 possible when character display is
202 normalized that some character cells
203 overlap.
204
205 @retval EFI_SUCCESS The string was successfully updated.
206
207 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for RowInfoArray or Blt.
208
209 @retval EFI_INVALID_PARAMETER The String or Blt was NULL.
210
211 @retval EFI_INVALID_PARAMETER Flags were invalid combination.
212**/
213typedef
218 IN CONST EFI_STRING String,
219 IN CONST EFI_FONT_DISPLAY_INFO *StringInfo,
220 IN OUT EFI_IMAGE_OUTPUT **Blt,
221 IN UINTN BltX,
222 IN UINTN BltY,
223 OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL,
224 OUT UINTN *RowInfoArraySize OPTIONAL,
225 OUT UINTN *ColumnInfoArray OPTIONAL
226 );
227
228/**
229
230 This function renders a string as a bitmap or to the screen
231 and can clip or wrap the string. The bitmap is either supplied
232 by the caller or allocated by the function. The
233 strings are drawn with the font, size and style specified and
234 can be drawn transparently or opaquely. The function can also
235 return information about each row and each character's
236 position on the row. If EFI_HII_OUT_FLAG_CLIP is set, then
237 text will be formatted based only on explicit line breaks, and
238 all pixels that would lie outside the bounding box specified
239 by Width and Height are ignored. The information in the
240 RowInfoArray only describes characters which are at least
241 partially displayed. For the final row, the LineHeight and
242 BaseLine may describe pixels which are outside the limit
243 specified by Height (unless EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is
244 specified) even though those pixels were not drawn. If
245 EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set, then it modifies the
246 behavior of EFI_HII_OUT_FLAG_CLIP so that if a character's
247 right-most on pixel cannot fit, then it will not be drawn at
248 all. This flag requires that EFI_HII_OUT_FLAG_CLIP be set. If
249 EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is set, then it modifies the
250 behavior of EFI_HII_OUT_FLAG_CLIP so that if a row's bottom
251 most pixel cannot fit, then it will not be drawn at all. This
252 flag requires that EFI_HII_OUT_FLAG_CLIP be set. If
253 EFI_HII_OUT_FLAG_WRAP is set, then text will be wrapped at the
254 right-most line-break opportunity prior to a character whose
255 right-most extent would exceed Width. If no line-break
256 opportunity can be found, then the text will behave as if
257 EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set. This flag cannot be used
258 with EFI_HII_OUT_FLAG_CLIP_CLEAN_X. If
259 EFI_HII_OUT_FLAG_TRANSPARENT is set, then BackgroundColor is
260 ignored and all off" pixels in the character's glyph will
261 use the pixel value from Blt. This flag cannot be used if Blt
262 is NULL upon entry. If EFI_HII_IGNORE_IF_NO_GLYPH is set, then
263 characters which have no glyphs are not drawn. Otherwise, they
264 are replaced with Unicode character code 0xFFFD (REPLACEMENT
265 CHARACTER). If EFI_HII_IGNORE_LINE_BREAK is set, then explicit
266 line break characters will be ignored. If
267 EFI_HII_DIRECT_TO_SCREEN is set, then the string will be
268 written directly to the output device specified by Screen.
269 Otherwise the string will be rendered to the bitmap specified
270 by Bitmap.
271
272
273 @param This A pointer to the EFI_HII_FONT_PROTOCOL instance.
274
275 @param Flags Describes how the string is to be drawn.
276
277 @param PackageList
278 The package list in the HII database to
279 search for the specified string.
280
281 @param StringId The string's id, which is unique within
282 PackageList.
283
284 @param Language Points to the language for the retrieved
285 string. If NULL, then the current system
286 language is used.
287
288 @param StringInfo Points to the string output information,
289 including the color and font. If NULL, then
290 the string will be output in the default
291 system font and color.
292
293 @param Blt If this points to a non-NULL on entry, this points
294 to the image, which is Width pixels wide and
295 Height pixels high. The string will be drawn onto
296 this image and EFI_HII_OUT_FLAG_CLIP is implied.
297 If this points to a NULL on entry, then a buffer
298 will be allocated to hold the generated image and
299 the pointer updated on exit. It is the caller's
300 responsibility to free this buffer.
301
302 @param BltX, BltY Specifies the offset from the left and top
303 edge of the output image of the first
304 character cell in the image.
305
306 @param RowInfoArray If this is non-NULL on entry, then on
307 exit, this will point to an allocated
308 buffer containing row information and
309 RowInfoArraySize will be updated to
310 contain the number of elements. This array
311 describes the characters which were at
312 least partially drawn and the heights of
313 the rows. It is the caller's
314 responsibility to free this buffer.
315
316 @param RowInfoArraySize If this is non-NULL on entry, then on
317 exit it contains the number of
318 elements in RowInfoArray.
319
320 @param ColumnInfoArray If non-NULL, on return it is filled
321 with the horizontal offset for each
322 character in the string on the row
323 where it is displayed. Non-printing
324 characters will have the offset ~0.
325 The caller is responsible to allocate
326 a buffer large enough so that there is
327 one entry for each character in the
328 string, not including the
329 null-terminator. It is possible when
330 character display is normalized that
331 some character cells overlap.
332
333
334 @retval EFI_SUCCESS The string was successfully updated.
335
336 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output
337 buffer for RowInfoArray or Blt.
338
339 @retval EFI_INVALID_PARAMETER The String, or Blt, or Height, or
340 Width was NULL.
341 @retval EFI_INVALID_PARAMETER The Blt or PackageList was NULL.
342 @retval EFI_INVALID_PARAMETER Flags were invalid combination.
343 @retval EFI_NOT_FOUND The specified PackageList is not in the Database,
344 or the stringid is not in the specified PackageList.
345
346**/
347typedef
352 IN EFI_HII_HANDLE PackageList,
353 IN EFI_STRING_ID StringId,
354 IN CONST CHAR8 *Language,
356 IN OUT EFI_IMAGE_OUTPUT **Blt,
357 IN UINTN BltX,
358 IN UINTN BltY,
359 OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL,
360 OUT UINTN *RowInfoArraySize OPTIONAL,
361 OUT UINTN *ColumnInfoArray OPTIONAL
362 );
363
364/**
365
366 Convert the glyph for a single character into a bitmap.
367
368 @param This A pointer to the EFI_HII_FONT_PROTOCOL instance.
369
370 @param Char The character to retrieve.
371
372 @param StringInfo Points to the string font and color
373 information or NULL if the string should use
374 the default system font and color.
375
376 @param Blt This must point to a NULL on entry. A buffer will
377 be allocated to hold the output and the pointer
378 updated on exit. It is the caller's responsibility
379 to free this buffer.
380
381 @param Baseline The number of pixels from the bottom of the bitmap
382 to the baseline.
383
384
385 @retval EFI_SUCCESS The glyph bitmap created.
386
387 @retval EFI_OUT_OF_RESOURCES Unable to allocate the output buffer Blt.
388
389 @retval EFI_WARN_UNKNOWN_GLYPH The glyph was unknown and was
390 replaced with the glyph for
391 Unicode character code 0xFFFD.
392
393 @retval EFI_INVALID_PARAMETER Blt is NULL, or Width is NULL, or
394 Height is NULL
395
396
397**/
398typedef
402 IN CONST CHAR16 Char,
403 IN CONST EFI_FONT_DISPLAY_INFO *StringInfo,
404 OUT EFI_IMAGE_OUTPUT **Blt,
405 OUT UINTN *Baseline OPTIONAL
406 );
407
408/**
409
410 This function iterates through fonts which match the specified
411 font, using the specified criteria. If String is non-NULL, then
412 all of the characters in the string must exist in order for a
413 candidate font to be returned.
414
415 @param This A pointer to the EFI_HII_FONT_PROTOCOL instance.
416
417 @param FontHandle On entry, points to the font handle returned
418 by a previous call to GetFontInfo() or NULL
419 to start with the first font. On return,
420 points to the returned font handle or points
421 to NULL if there are no more matching fonts.
422
423 @param StringInfoIn Upon entry, points to the font to return
424 information about. If NULL, then the information
425 about the system default font will be returned.
426
427 @param StringInfoOut Upon return, contains the matching font's information.
428 If NULL, then no information is returned. This buffer
429 is allocated with a call to the Boot Service AllocatePool().
430 It is the caller's responsibility to call the Boot
431 Service FreePool() when the caller no longer requires
432 the contents of StringInfoOut.
433
434 @param String Points to the string which will be tested to
435 determine if all characters are available. If
436 NULL, then any font is acceptable.
437
438 @retval EFI_SUCCESS Matching font returned successfully.
439
440 @retval EFI_NOT_FOUND No matching font was found.
441
442 @retval EFI_OUT_OF_RESOURCES There were insufficient resources to complete the request.
443
444**/
445typedef
449 IN OUT EFI_FONT_HANDLE *FontHandle,
451 OUT EFI_FONT_DISPLAY_INFO **StringInfoOut,
453 );
454
455///
456/// The protocol provides the service to retrieve the font informations.
457///
464
466
467#endif
unsigned short UINT16
2-byte unsigned value.
char CHAR8
1-byte Character
UINT64 UINTN
Unsigned value of native width.
unsigned short CHAR16
2-byte Character.
#define EFIAPI
unsigned int UINT32
4-byte unsigned value.
#define CONST
Datum is read-only.
Definition Base.h:262
#define VOID
Undeclared type.
Definition Base.h:272
#define OPTIONAL
Passing the datum to the function is optional, and a NULL is passed if the value is not supplied.
Definition Base.h:293
Graphics Output Protocol from the UEFI 2.0 specification.
UINT32 EFI_FONT_INFO_MASK
Font info flag.
Definition HiiFont.h:68
struct _EFI_HII_FONT_PROTOCOL EFI_HII_FONT_PROTOCOL
Definition HiiFont.h:24
struct _EFI_HII_ROW_INFO EFI_HII_ROW_INFO
Definition of EFI_HII_ROW_INFO.
EFI_STATUS(EFIAPI * EFI_HII_GET_GLYPH)(IN CONST EFI_HII_FONT_PROTOCOL *This, IN CONST CHAR16 Char, IN CONST EFI_FONT_DISPLAY_INFO *StringInfo, OUT EFI_IMAGE_OUTPUT **Blt, OUT UINTN *Baseline OPTIONAL)
Convert the glyph for a single character into a bitmap.
Definition HiiFont.h:400
EFI_GUID gEfiHiiFontProtocolGuid
EFI_STATUS(EFIAPI * EFI_HII_GET_FONT_INFO)(IN CONST EFI_HII_FONT_PROTOCOL *This, IN OUT EFI_FONT_HANDLE *FontHandle, IN CONST EFI_FONT_DISPLAY_INFO *StringInfoIn OPTIONAL, OUT EFI_FONT_DISPLAY_INFO **StringInfoOut, IN CONST EFI_STRING String OPTIONAL)
This function iterates through fonts which match the specified font, using the specified criteria.
Definition HiiFont.h:447
VOID * EFI_FONT_HANDLE
Definition HiiFont.h:26
struct _EFI_FONT_DISPLAY_INFO EFI_FONT_DISPLAY_INFO
Describes font output-related information.
EFI_STATUS(EFIAPI * EFI_HII_STRING_ID_TO_IMAGE)(IN CONST EFI_HII_FONT_PROTOCOL *This, IN EFI_HII_OUT_FLAGS Flags, IN EFI_HII_HANDLE PackageList, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language, IN CONST EFI_FONT_DISPLAY_INFO *StringInfo OPTIONAL, IN OUT EFI_IMAGE_OUTPUT **Blt, IN UINTN BltX, IN UINTN BltY, OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL, OUT UINTN *RowInfoArraySize OPTIONAL, OUT UINTN *ColumnInfoArray OPTIONAL)
This function renders a string as a bitmap or to the screen and can clip or wrap the string.
Definition HiiFont.h:349
UINT32 EFI_HII_OUT_FLAGS
EFI_HII_OUT_FLAGS.
Definition HiiFont.h:31
EFI_STATUS(EFIAPI * EFI_HII_STRING_TO_IMAGE)(IN CONST EFI_HII_FONT_PROTOCOL *This, IN EFI_HII_OUT_FLAGS Flags, IN CONST EFI_STRING String, IN CONST EFI_FONT_DISPLAY_INFO *StringInfo, IN OUT EFI_IMAGE_OUTPUT **Blt, IN UINTN BltX, IN UINTN BltY, OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL, OUT UINTN *RowInfoArraySize OPTIONAL, OUT UINTN *ColumnInfoArray OPTIONAL)
This function renders a string to a bitmap or the screen using the specified font,...
Definition HiiFont.h:215
The file provides services to access to images in the images database.
struct _EFI_IMAGE_OUTPUT EFI_IMAGE_OUTPUT
Definition of EFI_IMAGE_OUTPUT.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
GUID EFI_GUID
128-bit buffer containing a unique identifier value.
CHAR16 * EFI_STRING
UINT32 EFI_HII_FONT_STYLE
VOID * EFI_HII_HANDLE
The following types are currently defined:
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define IN
Definition mlx_utils.h:28
#define OUT
Definition mlx_utils.h:29
UINT16_t Flags
Flags.
Definition pxe_api.h:30
EFI_HII_FONT_STYLE FontStyle
Definition HiiFont.h:85
UINT16 FontSize
character cell height in pixels
Definition HiiFont.h:86
CHAR16 FontName[1]
Definition HiiFont.h:87
Describes font output-related information.
Definition HiiFont.h:102
EFI_GRAPHICS_OUTPUT_BLT_PIXEL ForegroundColor
Definition HiiFont.h:103
EFI_GRAPHICS_OUTPUT_BLT_PIXEL BackgroundColor
Definition HiiFont.h:104
EFI_FONT_INFO FontInfo
Definition HiiFont.h:106
EFI_FONT_INFO_MASK FontInfoMask
Definition HiiFont.h:105
The protocol provides the service to retrieve the font informations.
Definition HiiFont.h:458
EFI_HII_STRING_TO_IMAGE StringToImage
Definition HiiFont.h:459
EFI_HII_GET_FONT_INFO GetFontInfo
Definition HiiFont.h:462
EFI_HII_STRING_ID_TO_IMAGE StringIdToImage
Definition HiiFont.h:460
EFI_HII_GET_GLYPH GetGlyph
Definition HiiFont.h:461
Definition of EFI_HII_ROW_INFO.
Definition HiiFont.h:45
UINTN StartIndex
The index of the first character in the string which is displayed on the line.
Definition HiiFont.h:49
UINTN LineHeight
The height of the line, in pixels.
Definition HiiFont.h:55
UINTN BaselineOffset
The font baseline offset in pixels from the bottom of the row, or 0 if none.
Definition HiiFont.h:61
UINTN LineWidth
The width of the text on the line, in pixels.
Definition HiiFont.h:56
UINTN EndIndex
The index of the last character in the string which is displayed on the line.
Definition HiiFont.h:54