When adding font package, there exits the case that only have the
EFI_HII_GIBT_GLYPH_DEFAULT or EFI_HII_GIBT_GLYPHS_DEFAULT glyph block
and use the default cell info in font package fixed header. In this
case, we can't get the correct baseline now. This patch is to fix this
issue by recalculating the baseline when the glyph block type is
EFI_HII_GIBT_GLYPH_DEFAULT or EFI_HII_GIBT_GLYPHS_DEFAULT.

Cc: Liming Gao <liming....@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan...@intel.com>
---
 MdeModulePkg/Universal/HiiDatabaseDxe/Font.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
index 5ecd6bd..7e5d3bd 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
@@ -837,10 +837,18 @@ FindGlyphBlock (
     case EFI_HII_GIBT_GLYPH_DEFAULT:
       Status = GetCell (CharCurrent, &FontPackage->GlyphInfoList, 
&DefaultCell);
       if (EFI_ERROR (Status)) {
         return Status;
       }
+      if (CharValue == (CHAR16) (-1)) {
+        if (BaseLine < DefaultCell.Height + DefaultCell.OffsetY) {
+          BaseLine = (UINT16) (DefaultCell.Height + DefaultCell.OffsetY);
+        }
+        if (MinOffsetY > DefaultCell.OffsetY) {
+          MinOffsetY = DefaultCell.OffsetY;
+        }
+      }
       BufferLen = BITMAP_LEN_1_BIT (DefaultCell.Width, DefaultCell.Height);
 
       if (CharCurrent == CharValue) {
         return WriteOutputParam (
                  BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK),
@@ -859,10 +867,18 @@ FindGlyphBlock (
       CopyMem (&Length16, BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK), sizeof 
(UINT16));
       Status = GetCell (CharCurrent, &FontPackage->GlyphInfoList, 
&DefaultCell);
       if (EFI_ERROR (Status)) {
         return Status;
       }
+      if (CharValue == (CHAR16) (-1)) {
+        if (BaseLine < DefaultCell.Height + DefaultCell.OffsetY) {
+          BaseLine = (UINT16) (DefaultCell.Height + DefaultCell.OffsetY);
+        }
+        if (MinOffsetY > DefaultCell.OffsetY) {
+          MinOffsetY = DefaultCell.OffsetY;
+        }
+      }
       BufferLen = BITMAP_LEN_1_BIT (DefaultCell.Width, DefaultCell.Height);
       BlockPtr += sizeof (EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK) - sizeof (UINT8);
       for (Index = 0; Index < Length16; Index++) {
         if (CharCurrent + Index == CharValue) {
           return WriteOutputParam (
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to