From 8f88f023fc59961973bb1ef121c7bee7b0a61975 Mon Sep 17 00:00:00 2001 From: Dandan Bi Date: Wed, 8 Jun 2016 14:13:36 +0800 Subject: [PATCH] MdeModulePkg/Database: Fix incorrect calculation of baseline in FontPackage When adding font package, there exists 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 Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi Reviewed-by: Eric Dong Reviewed-by: Liming Gao --- 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 5ecd6bd4a1..7e5d3bdc71 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c @@ -839,6 +839,14 @@ FindGlyphBlock ( 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) { @@ -861,6 +869,14 @@ FindGlyphBlock ( 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++) { -- 2.39.5