summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-03-15 05:04:45 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-03-15 05:04:45 +0000
commitdca8c6d8d28652ae24b4f4a42fb677b17b59006e (patch)
treeed228b8a3ad26ba7b765390bdb9a393fec016391
parentc67896b19fadf74d5ed0d779e7571e4ea71aef84 (diff)
downloadedk2-platforms-dca8c6d8d28652ae24b4f4a42fb677b17b59006e.tar.xz
[Description]:
1) Remove HiiLibAddFontPackageToHiiDatabase as it is not properly defined API. It only cover Simplified Font. User is recomended to use Hii Font Protocol API to add various font into HII database. [Impaction]: All modules that may reference HiiLibAddFontPackageToHiiDatabase function. [Reference Info]: No. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4856 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c57
1 files changed, 32 insertions, 25 deletions
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
index 6a624af1e7..827f6b34db 100644
--- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
+++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
@@ -263,6 +263,11 @@ GraphicsConsoleControllerDriverStart (
UINTN Columns;
UINTN Rows;
UINT32 ModeNumber;
+ EFI_HII_SIMPLE_FONT_PACKAGE_HDR *SimplifiedFont;
+ UINTN PackageLength;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
+ UINT8 *Package;
+ UINT8 *Location;
ModeNumber = 0;
@@ -305,34 +310,36 @@ GraphicsConsoleControllerDriverStart (
NarrowFontSize = ReturnNarrowFontSize ();
-#if 1
if (mFirstAccessFlag) {
- HiiLibAddFontPackageToHiiDatabase (NarrowFontSize, (UINT8 *) UsStdNarrowGlyphData, &mFontPackageListGuid, &(Private->HiiHandle));
+ //
+ // Add 4 bytes to the header for entire length for HiiLibPreparePackageList use only.
+ // Looks ugly. Might be updated when font tool is ready.
+ //
+ PackageLength = sizeof (EFI_HII_SIMPLE_FONT_PACKAGE_HDR) + NarrowFontSize + 4;
+ Package = AllocateZeroPool (PackageLength);
+ if (Package == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ CopyMem (Package, &PackageLength, 4);
+ SimplifiedFont = (EFI_HII_SIMPLE_FONT_PACKAGE_HDR*) (Package + 4);
+ SimplifiedFont->Header.Length = (UINT32) (PackageLength - 4);
+ SimplifiedFont->Header.Type = EFI_HII_PACKAGE_SIMPLE_FONTS;
+ SimplifiedFont->NumberOfNarrowGlyphs = (UINT16) (NarrowFontSize / sizeof (EFI_NARROW_GLYPH));
+
+ Location = (UINT8 *) (&SimplifiedFont->NumberOfWideGlyphs + 1);
+ CopyMem (Location, UsStdNarrowGlyphData, NarrowFontSize);
+
+ //
+ // Add this simplified font package to a package list then install it.
+ //
+ PackageList = HiiLibPreparePackageList (1, &mFontPackageListGuid, Package);
+ Status = mHiiDatabase->NewPackageList (mHiiDatabase, PackageList, NULL, &(Private->HiiHandle));
+ ASSERT_EFI_ERROR (Status);
+ SafeFreePool (PackageList);
+ SafeFreePool (Package);
+
mFirstAccessFlag = FALSE;
}
-#else
- FontPack = AllocateZeroPool (sizeof (EFI_HII_FONT_PACK) + NarrowFontSize);
- ASSERT (FontPack);
-
- FontPack->Header.Length = (UINT32) (sizeof (EFI_HII_FONT_PACK) + NarrowFontSize);
- FontPack->Header.Type = EFI_HII_FONT;
- FontPack->NumberOfNarrowGlyphs = (UINT16) (NarrowFontSize / sizeof (EFI_NARROW_GLYPH));
-
- Location = (UINT8 *) (&FontPack->NumberOfWideGlyphs + sizeof (UINT8));
- CopyMem (Location, UsStdNarrowGlyphData, NarrowFontSize);
-
- //
- // Register our Fonts into the global database
- //
- Package = PreparePackages (1, NULL, FontPack);
- mHii->NewPack (mHii, Package, &(Private->HiiHandle));
- FreePool (Package);
-
- //
- // Free the font database
- //
- FreePool (FontPack);
-#endif
//
// If the current mode information can not be retrieved, then attemp to set the default mode
// of 800x600, 32 bit colot, 60 Hz refresh.