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