]> git.proxmox.com Git - mirror_edk2.git/commitdiff
[Description]:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 15 Mar 2008 05:04:45 +0000 (05:04 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 15 Mar 2008 05:04:45 +0000 (05:04 +0000)
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

MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c

index 6a624af1e76006ccb87754ea5d34bd5dde40b2ad..827f6b34db976d98adb3c2e5df65cd1322a47bb7 100644 (file)
@@ -263,6 +263,11 @@ GraphicsConsoleControllerDriverStart (
   UINTN                                Columns;\r
   UINTN                                Rows;\r
   UINT32                               ModeNumber;\r
+  EFI_HII_SIMPLE_FONT_PACKAGE_HDR      *SimplifiedFont;\r
+  UINTN                                PackageLength;\r
+  EFI_HII_PACKAGE_LIST_HEADER          *PackageList;\r
+  UINT8                                *Package;\r
+  UINT8                                *Location;\r
 \r
   ModeNumber = 0;\r
 \r
@@ -305,34 +310,36 @@ GraphicsConsoleControllerDriverStart (
 \r
   NarrowFontSize  = ReturnNarrowFontSize ();\r
 \r
-#if 1\r
   if (mFirstAccessFlag) {\r
-    HiiLibAddFontPackageToHiiDatabase (NarrowFontSize, (UINT8 *) UsStdNarrowGlyphData, &mFontPackageListGuid, &(Private->HiiHandle));\r
+    //\r
+    // Add 4 bytes to the header for entire length for HiiLibPreparePackageList use only.\r
+    // Looks ugly. Might be updated when font tool is ready.\r
+    //\r
+    PackageLength   = sizeof (EFI_HII_SIMPLE_FONT_PACKAGE_HDR) + NarrowFontSize + 4;\r
+    Package = AllocateZeroPool (PackageLength);\r
+    if (Package == NULL) {\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+    CopyMem (Package, &PackageLength, 4);\r
+    SimplifiedFont = (EFI_HII_SIMPLE_FONT_PACKAGE_HDR*) (Package + 4);\r
+    SimplifiedFont->Header.Length        = (UINT32) (PackageLength - 4);\r
+    SimplifiedFont->Header.Type          = EFI_HII_PACKAGE_SIMPLE_FONTS;\r
+    SimplifiedFont->NumberOfNarrowGlyphs = (UINT16) (NarrowFontSize / sizeof (EFI_NARROW_GLYPH));\r
+    \r
+    Location = (UINT8 *) (&SimplifiedFont->NumberOfWideGlyphs + 1);\r
+    CopyMem (Location, UsStdNarrowGlyphData, NarrowFontSize);\r
+    \r
+    //\r
+    // Add this simplified font package to a package list then install it.\r
+    //\r
+    PackageList = HiiLibPreparePackageList (1, &mFontPackageListGuid, Package);\r
+    Status = mHiiDatabase->NewPackageList (mHiiDatabase, PackageList, NULL, &(Private->HiiHandle));\r
+    ASSERT_EFI_ERROR (Status);\r
+    SafeFreePool (PackageList);\r
+    SafeFreePool (Package);    \r
+\r
     mFirstAccessFlag = FALSE;\r
   }\r
-#else\r
-  FontPack        = AllocateZeroPool (sizeof (EFI_HII_FONT_PACK) + NarrowFontSize);\r
-  ASSERT (FontPack);\r
-\r
-  FontPack->Header.Length         = (UINT32) (sizeof (EFI_HII_FONT_PACK) + NarrowFontSize);\r
-  FontPack->Header.Type           = EFI_HII_FONT;\r
-  FontPack->NumberOfNarrowGlyphs  = (UINT16) (NarrowFontSize / sizeof (EFI_NARROW_GLYPH));\r
-\r
-  Location                        = (UINT8 *) (&FontPack->NumberOfWideGlyphs + sizeof (UINT8));\r
-  CopyMem (Location, UsStdNarrowGlyphData, NarrowFontSize);\r
-\r
-  //\r
-  // Register our Fonts into the global database\r
-  //\r
-  Package = PreparePackages (1, NULL, FontPack);\r
-  mHii->NewPack (mHii, Package, &(Private->HiiHandle));\r
-  FreePool (Package);\r
-\r
-  //\r
-  // Free the font database\r
-  //\r
-  FreePool (FontPack);\r
-#endif\r
   //\r
   // If the current mode information can not be retrieved, then attemp to set the default mode\r
   // of 800x600, 32 bit colot, 60 Hz refresh.\r