+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- HiiFont.h\r
- \r
-Abstract:\r
-\r
- EFI_HII_FONT_PROTOCOL from UEFI 2.1 specification.\r
- \r
- This protocol provides interfaces to retrieve font information.\r
-\r
-Revision History\r
-\r
---*/\r
-\r
-#ifndef __EFI_HII_FONT_PROTOCOL_H__\r
-#define __EFI_HII_FONT_PROTOCOL_H__\r
-\r
-#include EFI_PROTOCOL_DEFINITION (GraphicsOutput)\r
-#include EFI_PROTOCOL_DEFINITION (HiiImage)\r
-\r
-//\r
-// Global ID for the Hii Font Protocol.\r
-//\r
-\r
-#define EFI_HII_FONT_PROTOCOL_GUID \\r
- { \\r
- 0xe9ca4775, 0x8657, 0x47fc, {0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24} \\r
- }\r
-\r
-EFI_FORWARD_DECLARATION (EFI_HII_FONT_PROTOCOL);\r
-\r
-typedef UINT32 EFI_HII_OUT_FLAGS;\r
-typedef UINT32 EFI_FONT_INFO_MASK;\r
-typedef VOID* EFI_FONT_HANDLE;\r
-\r
-typedef struct _EFI_HII_ROW_INFO {\r
- UINTN StartIndex;\r
- UINTN EndIndex;\r
- UINTN LineHeight;\r
- UINTN LineWidth;\r
- UINTN BaselineOffset;\r
-} EFI_HII_ROW_INFO;\r
-\r
-typedef struct {\r
- EFI_HII_FONT_STYLE FontStyle;\r
- UINT16 FontSize; // character cell height in pixels\r
- CHAR16 FontName[1];\r
-} EFI_FONT_INFO;\r
-\r
-typedef struct _EFI_FONT_DISPLAY_INFO {\r
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL ForegroundColor;\r
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL BackgroundColor;\r
- EFI_FONT_INFO_MASK FontInfoMask;\r
- EFI_FONT_INFO FontInfo; \r
-} EFI_FONT_DISPLAY_INFO;\r
-\r
-#define EFI_HII_OUT_FLAG_CLIP 0x00000001\r
-#define EFI_HII_OUT_FLAG_WRAP 0x00000002\r
-#define EFI_HII_OUT_FLAG_CLIP_CLEAN_Y 0x00000004\r
-#define EFI_HII_OUT_FLAG_CLIP_CLEAN_X 0x00000008\r
-#define EFI_HII_OUT_FLAG_TRANSPARENT 0x00000010\r
-#define EFI_HII_IGNORE_IF_NO_GLYPH 0x00000020\r
-#define EFI_HII_IGNORE_LINE_BREAK 0x00000040\r
-#define EFI_HII_DIRECT_TO_SCREEN 0x00000080\r
-\r
-#define EFI_FONT_INFO_SYS_FONT 0x00000001\r
-#define EFI_FONT_INFO_SYS_SIZE 0x00000002\r
-#define EFI_FONT_INFO_SYS_STYLE 0x00000004\r
-#define EFI_FONT_INFO_SYS_FORE_COLOR 0x00000010\r
-#define EFI_FONT_INFO_SYS_BACK_COLOR 0x00000020\r
-#define EFI_FONT_INFO_RESIZE 0x00001000\r
-#define EFI_FONT_INFO_RESTYLE 0x00002000\r
-#define EFI_FONT_INFO_ANY_FONT 0x00010000\r
-#define EFI_FONT_INFO_ANY_SIZE 0x00020000\r
-#define EFI_FONT_INFO_ANY_STYLE 0x00040000\r
-\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_STRING_TO_IMAGE) (\r
- IN CONST EFI_HII_FONT_PROTOCOL *This,\r
- IN EFI_HII_OUT_FLAGS Flags,\r
- IN CONST EFI_STRING String,\r
- IN CONST EFI_FONT_DISPLAY_INFO *StringInfo OPTIONAL,\r
- IN OUT EFI_IMAGE_OUTPUT **Blt,\r
- IN UINTN BltX,\r
- IN UINTN BltY,\r
- OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL,\r
- OUT UINTN *RowInfoArraySize OPTIONAL,\r
- OUT UINTN *ColumnInfoArray OPTIONAL\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Renders a string to a bitmap or to the display.\r
-\r
- Arguments: \r
- This - A pointer to the EFI_HII_FONT_PROTOCOL instance.\r
- Flags - Describes how the string is to be drawn. \r
- String - Points to the null-terminated string to be displayed.\r
- StringInfo - Points to the string output information, including the color and font. \r
- If NULL, then the string will be output in the default system font and color.\r
- Blt - If this points to a non-NULL on entry, this points to the image, which is Width pixels \r
- wide and Height pixels high. The string will be drawn onto this image and \r
- EFI_HII_OUT_FLAG_CLIP is implied. If this points to a NULL on entry, then a \r
- buffer will be allocated to hold the generated image and the pointer updated on exit. It\r
- is the caller's responsibility to free this buffer. \r
- BltX,BLTY - Specifies the offset from the left and top edge of the image of the first character cell in\r
- the image. \r
- RowInfoArray - If this is non-NULL on entry, then on exit, this will point to an allocated buffer \r
- containing row information and RowInfoArraySize will be updated to contain the \r
- number of elements. This array describes the characters which were at least partially\r
- drawn and the heights of the rows. It is the caller's responsibility to free this buffer. \r
- RowInfoArraySize - If this is non-NULL on entry, then on exit it contains the number of elements in\r
- RowInfoArray. \r
- ColumnInfoArray - If this is non-NULL, then on return it will be filled with the horizontal offset for each \r
- character in the string on the row where it is displayed. Non-printing characters will \r
- have the offset ~0. The caller is responsible to allocate a buffer large enough so that \r
- there is one entry for each character in the string, not including the null-terminator. It\r
- is possible when character display is normalized that some character cells overlap. \r
- \r
- Returns:\r
- EFI_SUCCESS - The string was successfully rendered. \r
- EFI_OUT_OF_RESOURCES - Unable to allocate an output buffer for RowInfoArray or Blt.\r
- EFI_INVALID_PARAMETER - The String or Blt was NULL.\r
- EFI_INVALID_PARAMETER - Flags were invalid combination.\r
- \r
---*/\r
-;\r
-\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_STRING_ID_TO_IMAGE) (\r
- IN CONST EFI_HII_FONT_PROTOCOL *This,\r
- IN EFI_HII_OUT_FLAGS Flags, \r
- IN EFI_HII_HANDLE PackageList,\r
- IN EFI_STRING_ID StringId,\r
- IN CONST CHAR8* Language,\r
- IN CONST EFI_FONT_DISPLAY_INFO *StringInfo OPTIONAL,\r
- IN OUT EFI_IMAGE_OUTPUT **Blt,\r
- IN UINTN BltX,\r
- IN UINTN BltY,\r
- OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL,\r
- OUT UINTN *RowInfoArraySize OPTIONAL,\r
- OUT UINTN *ColumnInfoArray OPTIONAL\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Render a string to a bitmap or the screen containing the contents of the specified string.\r
-\r
- Arguments: \r
- This - A pointer to the EFI_HII_FONT_PROTOCOL instance.\r
- Flags - Describes how the string is to be drawn. \r
- PackageList - The package list in the HII database to search for the specified string. \r
- StringId - The string's id, which is unique within PackageList. \r
- Language - Points to the language for the retrieved string. If NULL, then the current system\r
- language is used. \r
- StringInfo - Points to the string output information, including the color and font. \r
- If NULL, then the string will be output in the default system font and color.\r
- Blt - If this points to a non-NULL on entry, this points to the image, which is Width pixels \r
- wide and Height pixels high. The string will be drawn onto this image and \r
- EFI_HII_OUT_FLAG_CLIP is implied. If this points to a NULL on entry, then a \r
- buffer will be allocated to hold the generated image and the pointer updated on exit. It\r
- is the caller's responsibility to free this buffer. \r
- BltX,BLTY - Specifies the offset from the left and top edge of the image of the first character cell in\r
- the image. \r
- RowInfoArray - If this is non-NULL on entry, then on exit, this will point to an allocated buffer \r
- containing row information and RowInfoArraySize will be updated to contain the \r
- number of elements. This array describes the characters which were at least partially\r
- drawn and the heights of the rows. It is the caller's responsibility to free this buffer. \r
- RowInfoArraySize - If this is non-NULL on entry, then on exit it contains the number of elements in\r
- RowInfoArray. \r
- ColumnInfoArray - If this is non-NULL, then on return it will be filled with the horizontal offset for each \r
- character in the string on the row where it is displayed. Non-printing characters will \r
- have the offset ~0. The caller is responsible to allocate a buffer large enough so that \r
- there is one entry for each character in the string, not including the null-terminator. It\r
- is possible when character display is normalized that some character cells overlap. \r
- \r
- Returns:\r
- EFI_SUCCESS - The string was successfully rendered.\r
- EFI_OUT_OF_RESOURCES - Unable to allocate an output buffer for RowInfoArray or Blt.\r
- EFI_INVALID_PARAMETER - The Blt or PackageList was NULL.\r
- EFI_INVALID_PARAMETER - Flags were invalid combination.\r
- EFI_NOT_FOUND - The specified PackageList is not in the Database or the stringid is not \r
- in the specified PackageList. \r
- \r
---*/\r
-;\r
-\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_GET_GLYPH) (\r
- IN CONST EFI_HII_FONT_PROTOCOL *This,\r
- IN CHAR16 Char,\r
- IN CONST EFI_FONT_DISPLAY_INFO *StringInfo,\r
- OUT EFI_IMAGE_OUTPUT **Blt,\r
- OUT UINTN *Baseline OPTIONAL\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Convert the glyph for a single character into a bitmap.\r
-\r
- Arguments: \r
- This - A pointer to the EFI_HII_FONT_PROTOCOL instance.\r
- Char - Character to retrieve.\r
- StringInfo - Points to the string font and color information or NULL if the string should use the\r
- default system font and color. \r
- Blt - Thus must point to a NULL on entry. A buffer will be allocated to hold the output and\r
- the pointer updated on exit. It is the caller's responsibility to free this buffer. \r
- Baseline - Number of pixels from the bottom of the bitmap to the baseline.\r
-\r
- Returns:\r
- EFI_SUCCESS - Glyph bitmap created.\r
- EFI_OUT_OF_RESOURCES - Unable to allocate the output buffer Blt. \r
- EFI_WARN_UNKNOWN_GLYPH - The glyph was unknown and was \r
- replaced with the glyph for Unicode\r
- character 0xFFFD. \r
- EFI_INVALID_PARAMETER - Blt is NULL or *Blt is not NULL.\r
- \r
---*/ \r
-;\r
-\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_GET_FONT_INFO) (\r
- IN CONST EFI_HII_FONT_PROTOCOL *This,\r
- IN OUT EFI_FONT_HANDLE *FontHandle,\r
- IN CONST EFI_FONT_DISPLAY_INFO *StringInfoIn, OPTIONAL\r
- OUT EFI_FONT_DISPLAY_INFO **StringInfoOut,\r
- IN CONST EFI_STRING String OPTIONAL\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- This function iterates through fonts which match the specified font, using \r
- the specified criteria. If String is non-NULL, then all of the characters in \r
- the string must exist in order for a candidate font to be returned.\r
- \r
- Arguments: \r
- This - A pointer to the EFI_HII_FONT_PROTOCOL instance.\r
- FontHandle - On entry, points to the font handle returned by a previous \r
- call to GetFontInfo() or points to NULL to start with the \r
- first font. On return, points to the returned font handle or\r
- points to NULL if there are no more matching fonts.\r
- StringInfoIn - Upon entry, points to the font to return information about.\r
- If NULL, then the information about the system default \r
- font will be returned.\r
- StringInfoOut - Upon return, contains the matching font's information. \r
- If NULL, then no information is returned.\r
- It's caller's responsibility to free this buffer.\r
- String - Points to the string which will be tested to determine \r
- if all characters are available. If NULL, then any font \r
- is acceptable.\r
-\r
- Returns:\r
- EFI_SUCCESS - Matching font returned successfully.\r
- EFI_NOT_FOUND - No matching font was found.\r
- EFI_INVALID_PARAMETER - StringInfoIn->FontInfoMask is an invalid combination.\r
- EFI_OUT_OF_RESOURCES - There were insufficient resources to complete the request.\r
- \r
---*/\r
-;\r
-\r
-\r
-//\r
-// Interface structure for the EFI_HII_FONT_PROTOCOL\r
-//\r
-struct _EFI_HII_FONT_PROTOCOL {\r
- EFI_HII_STRING_TO_IMAGE StringToImage;\r
- EFI_HII_STRING_ID_TO_IMAGE StringIdToImage;\r
- EFI_HII_GET_GLYPH GetGlyph;\r
- EFI_HII_GET_FONT_INFO GetFontInfo;\r
-};\r
-\r
-extern EFI_GUID gEfiHiiFontProtocolGuid;\r
-\r
-#endif\r