[Question] Using hii to display any size of font string


Liu Xin
 

Hello,



I use HiiAddPackages add a font data to hii, it can display characters by
StringToImage.

But when set the font size by using StringToImage, input
EFI_FONT_DISPLAY_INFO,

the characters are not displayed in the correct size,

is there any sample about changing font size?



EFI_FONT_DISPLAY_INFO *fontDisplayInfo;



fontDisplayInfo = (EFI_FONT_DISPLAY_INFO
*)AllocateZeroPool(sizeof(EFI_FONT_DISPLAY_INFO) + StrLen((const
CHAR16*)L"A") * 2 + 2);

fontDisplayInfo->ForegroundColor = *fontForegroundColor;

fontDisplayInfo->BackgroundColor = *fontBackgroundColor;



fontDisplayInfo->FontInfoMask = EFI_FONT_INFO_SYS_FORE_COLOR |
EFI_FONT_INFO_SYS_BACK_COLOR | EFI_FONT_INFO_RESIZE;

fontDisplayInfo->FontInfo.FontStyle = EFI_HII_FONT_STYLE_NORMAL;

fontDisplayInfo->FontInfo.FontSize = FontSize; //50

CopyMem(fontDisplayInfo->FontInfo.FontName, (const
CHAR16*)L"FZLKSXSJW", StrLen((const CHAR16*)L"A") * 2 + 2);



gSystemFrameBuffer.Width =
(UINT16)gGraphicsOutput->Mode->Info->HorizontalResolution;

gSystemFrameBuffer.Height =
(UINT16)gGraphicsOutput->Mode->Info->VerticalResolution;

gSystemFrameBuffer.Image.Screen = gGraphicsOutput;



Status = gHiiFont->StringToImage(

gHiiFont,

EFI_HII_IGNORE_IF_NO_GLYPH |

EFI_HII_DIRECT_TO_SCREEN | EFI_HII_OUT_FLAG_TRANSPARENT,

String,

fontDisplayInfo,

&pSystemFrameBuffer,

(UINTN)x,

(UINTN)y,

0,

0,

0

);