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 <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Dandan Bi 2016-06-08 14:13:36 +08:00 committed by Star Zeng
parent 7e74fd570d
commit 8f88f023fc
1 changed files with 16 additions and 0 deletions

View File

@ -839,6 +839,14 @@ FindGlyphBlock (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return 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); BufferLen = BITMAP_LEN_1_BIT (DefaultCell.Width, DefaultCell.Height);
if (CharCurrent == CharValue) { if (CharCurrent == CharValue) {
@ -861,6 +869,14 @@ FindGlyphBlock (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return 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); BufferLen = BITMAP_LEN_1_BIT (DefaultCell.Width, DefaultCell.Height);
BlockPtr += sizeof (EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK) - sizeof (UINT8); BlockPtr += sizeof (EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK) - sizeof (UINT8);
for (Index = 0; Index < Length16; Index++) { for (Index = 0; Index < Length16; Index++) {