From f5b5cdef011a3c64904632224c07c01d62050a40 Mon Sep 17 00:00:00 2001 From: srs5694 Date: Thu, 24 Jan 2013 20:26:33 -0500 Subject: [PATCH] Support for loading fonts (as PNG files); new default font. --- NEWS.txt | 9 + docs/refind/configfile.html | 2 +- fonts/damaged.png | Bin 12631 -> 0 bytes libeg/egemb_font.h | 885 ++++++++++++++++++++++++------------ libeg/libeg.h | 5 +- libeg/screen.c | 8 +- libeg/text.c | 89 +++- refind.conf-sample | 11 + refind/config.c | 3 + refind/main.c | 3 +- refind/menu.c | 163 ++++--- refind/screen.c | 4 - refind/screen.h | 6 +- 13 files changed, 789 insertions(+), 399 deletions(-) delete mode 100644 fonts/damaged.png diff --git a/NEWS.txt b/NEWS.txt index a4b5d8b..c03d9ca 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,6 +1,15 @@ 0.6.6 (?/??/2013): ------------------ +- Added new "font" token to refind.conf, which enables specifying a font in + the form of a PNG file. This file must contain monospace glyphs for the + 95 characters from ASCII 32 to 126 (space through tilde), inclusive, plus + a glyph to be displayed for characters outside of this range, for a total + of 96 glyphs. + +- Replaced the old font (inherited from rEFInd) with an anti-aliased + version of Luxi Mono Regular 14 point. + - Fixed bug that caused rEFInd to ignore manual boot stanzas in files included via the "include" token in refind.conf. diff --git a/docs/refind/configfile.html b/docs/refind/configfile.html index bc9cf98..a1dbf40 100644 --- a/docs/refind/configfile.html +++ b/docs/refind/configfile.html @@ -327,7 +327,7 @@ default_selection elilo loader filename - Sets the filename for the boot loader. You may use either Unix-style slashes (/) or Windows/EFI-style backslashes (\) to separate directory elements. In either case, the references are to files on the ESP from which rEFInd launched or to the one identified by a preceding volume token. This option should normally be the first in the body of an OS stanza; if it's not, some other options may be ignored. An exception is if you want to boot a loader from a volume other than the one on which rEFInd resides, in which case volume should precede loader. + Sets the filename for the boot loader. You may use either Unix-style slashes (/) or Windows/EFI-style backslashes (\) to separate directory elements. In either case, the references are to files on the ESP from which rEFInd launched or to the one identified by a preceding volume token. The filename is specified as a path relative to the root of the filesystem, so if the file is in a directory, you must include its complete path, as in \EFI\myloader\loader.efi. This option should normally be the first in the body of an OS stanza; if it's not, some other options may be ignored. An exception is if you want to boot a loader from a volume other than the one on which rEFInd resides, in which case volume should precede loader. initrd diff --git a/fonts/damaged.png b/fonts/damaged.png deleted file mode 100644 index e3efcfbddf8c35109460c5d7b4a3e28dd16ffa6e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12631 zcmZvDWmpu<_xA46NQZO_EJ!NST}#R$DAFa}-LSOM2+}Mq;Ddm4?*al60s_({;nJP% z!v6VP@7MR5Yx3KfIdjgO``q&Z`VvA)%t#CX07x}8R9^uAxY&m=Jt6)>8=Lml`=JB+ zyn-kLYR8#(A13%V+7ML$_J5_gyE5Zpg~(IG*arZ3ME$=C1mqRaKP(dXYU-*HtN(!O+N2n0^`N68s zc!89|h|%hCz6UIZN()@_|7!%M^8v2__K7|b8|^eO|4(mQYb*81TJ;|NdffV1zlRRS z3D^htlC)pHp7n{yJN^fN9S*0FRW#0z7d_EUhbl`!l7F}$IF8N8*98GXyt)}sWg_k- zmC1YM)|S-%uOW5ow{z1qE}tvm@jmtDSGXcY$JcXOHIUZfVX3nfZMm=_K}LYpGuR72 z3vixfofm)|^$vl<|M?=3qsu623b^vRLh7#Rv=Um9At48Wjcd;K-%(yc^M`-fgLV7VXbp_Ru~662k4 zg)c&>7y=Lm1(GOI15gGGJ$b1Aw>@8O4MA2len$@b*9OpDP^D5N9os<7<_o~|!0{dM zAiwPJ8$D79^H-*r*$S%>r>X8sK$6zMfCK?dfm^_NZYTJU3w+oc48oLb;$gQJ`J6~; zI3tu|LfE#ur_f&V6Q5MUSa}%26h&rpn>BkY3&^e?W2^!<)4)if#dFZ!w*b7EWsnss zOc&4-wf5h$%rT7BP_sN>HSX-p6?T?j##|;RaV{sEv_KxvxEw=oH*TFf0AN&a!%iI3 zfvOyHX=T?~kYRv4p6L>1^TDgaopw0Ex;KCg1jdDuY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mode->Mode)) { -// SwitchToGraphics(); Status = refit_call2_wrapper(ST->ConOut->SetMode, ST->ConOut, RequestedMode); if (Status == EFI_SUCCESS) { ChangedIt = TRUE; @@ -431,12 +430,13 @@ VOID egDisplayMessage(IN CHAR16 *Text, EG_PIXEL *BGColor) { EG_IMAGE *Box; if ((Text != NULL) && (BGColor != NULL)) { - BoxWidth = (StrLen(Text) + 2) * FONT_CELL_WIDTH; + egMeasureText(Text, &BoxWidth, &BoxHeight); + BoxWidth += 14; + BoxHeight *= 2; if (BoxWidth > egScreenWidth) BoxWidth = egScreenWidth; - BoxHeight = 2 * FONT_CELL_HEIGHT; Box = egCreateFilledImage(BoxWidth, BoxHeight, FALSE, BGColor); - egRenderText(Text, Box, FONT_CELL_WIDTH, FONT_CELL_HEIGHT / 2, (BGColor->r + BGColor->g + BGColor->b) / 3); + egRenderText(Text, Box, 7, BoxHeight / 4, (BGColor->r + BGColor->g + BGColor->b) / 3); egDrawImage(Box, (egScreenWidth - BoxWidth) / 2, (egScreenHeight - BoxHeight) / 2); } // if non-NULL inputs } // VOID egDisplayMessage() diff --git a/libeg/text.c b/libeg/text.c index 2084356..6f2f405 100644 --- a/libeg/text.c +++ b/libeg/text.c @@ -38,22 +38,52 @@ //#include "../refind/screen.h" #include "egemb_font.h" -#define FONT_CELL_WIDTH (7) -#define FONT_CELL_HEIGHT (12) +#define FONT_NUM_CHARS 96 -static EG_IMAGE *BlackFontImage = NULL; -static EG_IMAGE *WhiteFontImage = NULL; +static EG_IMAGE *BaseFontImage = NULL; +static EG_IMAGE *DarkFontImage = NULL; +static EG_IMAGE *LightFontImage = NULL; + +static UINTN FontCellWidth = 7; // // Text rendering // +static VOID egPrepareFont() { + if (BaseFontImage == NULL) { + BaseFontImage = egPrepareEmbeddedImage(&egemb_font, TRUE); + } + if (BaseFontImage != NULL) + FontCellWidth = BaseFontImage->Width / FONT_NUM_CHARS; +} // VOID egPrepareFont(); + +UINTN egGetFontHeight(VOID) { + egPrepareFont(); + return BaseFontImage->Height; +} // UINTN egGetFontHeight() + +UINTN egGetFontCellWidth(VOID) { + return FontCellWidth; +} + +UINTN egComputeTextWidth(IN CHAR16 *Text) { + UINTN Width = 0; + + egPrepareFont(); + if (Text != NULL) + Width = FontCellWidth * StrLen(Text); + return Width; +} // UINTN egComputeTextWidth() + VOID egMeasureText(IN CHAR16 *Text, OUT UINTN *Width, OUT UINTN *Height) { + egPrepareFont(); + if (Width != NULL) - *Width = StrLen(Text) * FONT_CELL_WIDTH; + *Width = StrLen(Text) * FontCellWidth; if (Height != NULL) - *Height = FONT_CELL_HEIGHT; + *Height = BaseFontImage->Height; } VOID egRenderText(IN CHAR16 *Text, IN OUT EG_IMAGE *CompImage, IN UINTN PosX, IN UINTN PosY, IN UINT8 BGBrightness) @@ -65,33 +95,35 @@ VOID egRenderText(IN CHAR16 *Text, IN OUT EG_IMAGE *CompImage, IN UINTN PosX, IN UINTN TextLength; UINTN i, c; + egPrepareFont(); + // clip the text if (Text) TextLength = StrLen(Text); else TextLength = 0; - if (TextLength * FONT_CELL_WIDTH + PosX > CompImage->Width) - TextLength = (CompImage->Width - PosX) / FONT_CELL_WIDTH; + if (TextLength * FontCellWidth + PosX > CompImage->Width) + TextLength = (CompImage->Width - PosX) / FontCellWidth; if (BGBrightness < 128) { - if (WhiteFontImage == NULL) { - WhiteFontImage = egPrepareEmbeddedImage(&egemb_font, TRUE); - if (WhiteFontImage == NULL) + if (LightFontImage == NULL) { + LightFontImage = egCopyImage(BaseFontImage); + if (LightFontImage == NULL) return; - for (i = 0; i < (WhiteFontImage->Width * WhiteFontImage->Height); i++) { - WhiteFontImage->PixelData[i].r = 255 - WhiteFontImage->PixelData[i].r; - WhiteFontImage->PixelData[i].g = 255 - WhiteFontImage->PixelData[i].g; - WhiteFontImage->PixelData[i].b = 255 - WhiteFontImage->PixelData[i].b; + for (i = 0; i < (LightFontImage->Width * LightFontImage->Height); i++) { + LightFontImage->PixelData[i].r = 255 - LightFontImage->PixelData[i].r; + LightFontImage->PixelData[i].g = 255 - LightFontImage->PixelData[i].g; + LightFontImage->PixelData[i].b = 255 - LightFontImage->PixelData[i].b; } // for } // if - FontImage = WhiteFontImage; + FontImage = LightFontImage; } else { - if (BlackFontImage == NULL) - BlackFontImage = egPrepareEmbeddedImage(&egemb_font, TRUE); - if (BlackFontImage == NULL) + if (DarkFontImage == NULL) + DarkFontImage = egCopyImage(BaseFontImage); + if (DarkFontImage == NULL) return; - FontImage = BlackFontImage; + FontImage = DarkFontImage; } // if/else // render it @@ -106,11 +138,22 @@ VOID egRenderText(IN CHAR16 *Text, IN OUT EG_IMAGE *CompImage, IN UINTN PosX, IN c = 95; else c -= 32; - egRawCompose(BufferPtr, FontPixelData + c * FONT_CELL_WIDTH, - FONT_CELL_WIDTH, FONT_CELL_HEIGHT, + egRawCompose(BufferPtr, FontPixelData + c * FontCellWidth, + FontCellWidth, FontImage->Height, BufferLineOffset, FontLineOffset); - BufferPtr += FONT_CELL_WIDTH; + BufferPtr += FontCellWidth; } } +// Load a font bitmap from the specified file +VOID egLoadFont(IN CHAR16 *Filename) { + if (BaseFontImage) + egFreeImage(BaseFontImage); + + BaseFontImage = egLoadImage(SelfDir, Filename, TRUE); + if (BaseFontImage == NULL) + Print(L"Note: Font image file %s is invalid! Using default font!\n"); + egPrepareFont(); +} // BOOLEAN egLoadFont() + /* EOF */ diff --git a/refind.conf-sample b/refind.conf-sample index e5380f8..b7ccc2e 100644 --- a/refind.conf-sample +++ b/refind.conf-sample @@ -58,6 +58,17 @@ timeout 20 #selection_big selection-big.bmp #selection_small selection-small.bmp +# Set the font to be used for all textual displays in graphics mode. +# The font must be a PNG file with alpha channel transparency. It must +# contain ASCII characters 32-126 (space through tilde), inclusive, plus +# a glyph to be displayed in place of characters outside of this range, +# for a total of 96 glyphs. Only monospaced fonts are supported. Fonts +# may be of any size, although large fonts can produce display +# irregularities. +# The default is rEFInd's built-in font, Luxi Mono Regular 12 point. +# +#font myfont.png + # Use text mode only. When enabled, this option forces rEFInd into text mode. # Passing this option a "0" value causes graphics mode to be used. Pasing # it no value or any non-0 value causes text mode to be used. diff --git a/refind/config.c b/refind/config.c index 88388b5..63cfad6 100644 --- a/refind/config.c +++ b/refind/config.c @@ -511,6 +511,9 @@ VOID ReadConfig(CHAR16 *FileName) } } // for (graphics_on tokens) + } else if ((StriCmp(TokenList[0], L"font") == 0) && (TokenCount == 2)) { + egLoadFont(TokenList[1]); + } else if (StriCmp(TokenList[0], L"scan_all_linux_kernels") == 0) { if ((TokenCount >= 2) && (StriCmp(TokenList[1], L"0") == 0)) { GlobalConfig.ScanAllLinux = FALSE; diff --git a/refind/main.c b/refind/main.c index 3e1061a..d5ec6ce 100644 --- a/refind/main.c +++ b/refind/main.c @@ -128,7 +128,7 @@ static VOID AboutrEFInd(VOID) if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.6.5.5"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.6.5.6"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith"); @@ -2044,7 +2044,6 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) // further bootstrap (now with config available) MokProtocol = SecureBootSetup(); -// ScanVolumes(); LoadDrivers(); ScanForBootloaders(); ScanForTools(); diff --git a/refind/menu.c b/refind/menu.c index 071017b..8b072c1 100644 --- a/refind/menu.c +++ b/refind/menu.c @@ -71,8 +71,8 @@ static CHAR16 ArrowDown[2] = { ARROW_DOWN, 0 }; // Text and icon spacing constants.... #define TEXT_YMARGIN (2) -#define TEXT_XMARGIN (8) -#define TEXT_LINE_HEIGHT (FONT_CELL_HEIGHT + TEXT_YMARGIN * 2) +//#define TEXT_XMARGIN (8) +//#define TEXT_LINE_HEIGHT (FONT_CELL_HEIGHT + TEXT_YMARGIN * 2) #define TITLEICON_SPACING (16) #define ROW0_TILESIZE (144) @@ -363,6 +363,7 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty INTN ShortcutEntry; BOOLEAN HaveTimeout = FALSE; UINTN TimeoutCountdown = 0; + INTN PreviousTime = -1, CurrentTime; CHAR16 TimeoutMessage[256]; CHAR16 KeyAsString[2]; UINTN MenuExit; @@ -393,8 +394,12 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty } if (HaveTimeout) { - SPrint(TimeoutMessage, 255, L"%s in %d seconds", Screen->TimeoutText, (TimeoutCountdown + 5) / 10); - StyleFunc(Screen, &State, MENU_FUNCTION_PAINT_TIMEOUT, TimeoutMessage); + CurrentTime = (TimeoutCountdown + 5) / 10; + if (CurrentTime != PreviousTime) { + SPrint(TimeoutMessage, 255, L"%s in %d seconds", Screen->TimeoutText, CurrentTime); + StyleFunc(Screen, &State, MENU_FUNCTION_PAINT_TIMEOUT, TimeoutMessage); + PreviousTime = CurrentTime; + } } // read key press (and wait for it if applicable) @@ -405,7 +410,7 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty MenuExit = MENU_EXIT_TIMEOUT; break; } else if (HaveTimeout) { - refit_call1_wrapper(BS->Stall, 100000); + refit_call1_wrapper(BS->Stall, 100000); // Pause for 100 ms TimeoutCountdown--; } else refit_call3_wrapper(BS->WaitForEvent, 1, &ST->ConIn->WaitForKey, &index); @@ -632,17 +637,23 @@ static VOID TextMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, // graphical generic style // +inline static UINTN TextLineHeight(VOID) { + return egGetFontHeight() + TEXT_YMARGIN * 2; +} // UINTN TextLineHeight() + // // Display a submenu // -// Display text with a solid background (MenuBackgroundPixel or SelectionBackgroundPixel) +// Display text with a solid background (MenuBackgroundPixel or SelectionBackgroundPixel). +// Indents text by one character and placed TEXT_YMARGIN pixels down from the +// specified XPos and YPos locations. static VOID DrawText(IN CHAR16 *Text, IN BOOLEAN Selected, IN UINTN FieldWidth, IN UINTN XPos, IN UINTN YPos) { EG_IMAGE *TextBuffer; EG_PIXEL Bg; - TextBuffer = egCreateImage(FieldWidth, TEXT_LINE_HEIGHT, FALSE); + TextBuffer = egCreateImage(FieldWidth, TextLineHeight(), FALSE); egFillImage(TextBuffer, &MenuBackgroundPixel); Bg = MenuBackgroundPixel; @@ -653,7 +664,7 @@ static VOID DrawText(IN CHAR16 *Text, IN BOOLEAN Selected, IN UINTN FieldWidth, } // render the text - egRenderText(Text, TextBuffer, TEXT_XMARGIN, TEXT_YMARGIN, (Bg.r + Bg.g + Bg.b) / 3); + egRenderText(Text, TextBuffer, egGetFontCellWidth(), TEXT_YMARGIN, (Bg.r + Bg.g + Bg.b) / 3); egDrawImageWithTransparency(TextBuffer, NULL, XPos, YPos, TextBuffer->Width, TextBuffer->Height); // BltImage(TextBuffer, XPos, YPos); } @@ -677,37 +688,46 @@ static UINT8 AverageBrightness(EG_IMAGE *Image) { return (UINT8) (Sum / (Image->Width * Image->Height * 3)); } // UINT8 AverageBrightness() -// Display text against the screen's background image +// Display text against the screen's background image. Special case: If Text is NULL +// or 0-length, clear the line. Does NOT indent the text or reposition it relative +// to the specified XPos and YPos values. static VOID DrawTextWithTransparency(IN CHAR16 *Text, IN UINTN XPos, IN UINTN YPos) { - UINTN TextWidth, TextPosX; - EG_IMAGE *TextBuffer; + UINTN TextWidth; + EG_IMAGE *TextBuffer = NULL; - TextBuffer = egCropImage(GlobalConfig.ScreenBackground, XPos, YPos, LAYOUT_TEXT_WIDTH, TEXT_LINE_HEIGHT); + if (Text == NULL) + Text = L""; - // render the text egMeasureText(Text, &TextWidth, NULL); - if (TextWidth > TextBuffer->Width) - TextPosX = 0; - else - TextPosX = (TextBuffer->Width - TextWidth) / 2; - egRenderText(Text, TextBuffer, TextPosX, 0, AverageBrightness(TextBuffer)); + if (TextWidth == 0) { + TextWidth = UGAWidth; + XPos = 0; + } + + TextBuffer = egCropImage(GlobalConfig.ScreenBackground, XPos, YPos, TextWidth, TextLineHeight()); + if (TextBuffer == NULL) { + Print(L"Error: NULL TextBuffer in DrawTextWithTransparency()\n"); + return; + } + + // render the text + egRenderText(Text, TextBuffer, 0, 0, AverageBrightness(TextBuffer)); egDrawImageWithTransparency(TextBuffer, NULL, XPos, YPos, TextBuffer->Width, TextBuffer->Height); + egFreeImage(TextBuffer); } // Compute the size & position of the window that will hold a subscreen's information. -static VOID ComputeSubScreenWindowSize(REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, UINTN *XPos, UINTN *YPos, UINTN *Width, UINTN *Height, UINTN *LineWidth) { +static VOID ComputeSubScreenWindowSize(REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, UINTN *XPos, UINTN *YPos, + UINTN *Width, UINTN *Height, UINTN *LineWidth) { UINTN i, ItemWidth, HintTop, BannerBottomEdge, TitleWidth; + UINTN FontCellWidth = egGetFontCellWidth(); + UINTN FontCellHeight = egGetFontHeight(); *Width = 20; *Height = 5; - TitleWidth = StrLen(Screen->Title); - if ((Screen->TitleImage) && (TitleWidth > (Screen->TitleImage->Width / FONT_CELL_WIDTH))) { - TitleWidth -= (Screen->TitleImage->Width / FONT_CELL_WIDTH); - } - if (TitleWidth > *Width) { - *Width = TitleWidth; - } + TitleWidth = egComputeTextWidth(Screen->Title); + for (i = 0; i < Screen->InfoLineCount; i++) { ItemWidth = StrLen(Screen->InfoLines[i]); if (*Width < ItemWidth) { @@ -722,43 +742,44 @@ static VOID ComputeSubScreenWindowSize(REFIT_MENU_SCREEN *Screen, IN SCROLL_STAT } (*Height)++; } - *Width = TEXT_XMARGIN * 2 + *Width * FONT_CELL_WIDTH; + *Width = (*Width + 2) * FontCellWidth; *LineWidth = *Width; if (Screen->TitleImage) - *Width += (Screen->TitleImage->Width + TITLEICON_SPACING * 2 + FONT_CELL_WIDTH); + *Width += (Screen->TitleImage->Width + TITLEICON_SPACING * 2 + FontCellWidth); else - *Width += FONT_CELL_WIDTH; + *Width += FontCellWidth; + + if (*Width < TitleWidth) + *Width = TitleWidth + 2 * FontCellWidth; // Keep it within the bounds of the screen, or 2/3 of the screen's width // for screens over 800 pixels wide if (*Width > UGAWidth) *Width = UGAWidth; - if ((*Width > (2 * UGAWidth) / 3) && (UGAWidth > 800)) - *Width = (2 * UGAWidth) / 3; *XPos = (UGAWidth - *Width) / 2; - HintTop = UGAHeight - (FONT_CELL_HEIGHT * 3); // top of hint text - *Height *= TEXT_LINE_HEIGHT; - if (Screen->TitleImage && (*Height < (Screen->TitleImage->Height + TEXT_LINE_HEIGHT * 4))) - *Height = Screen->TitleImage->Height + TEXT_LINE_HEIGHT * 4; + HintTop = UGAHeight - (FontCellHeight * 3); // top of hint text + *Height *= TextLineHeight(); + if (Screen->TitleImage && (*Height < (Screen->TitleImage->Height + TextLineHeight() * 4))) + *Height = Screen->TitleImage->Height + TextLineHeight() * 4; if (GlobalConfig.BannerBottomEdge >= HintTop) { // probably a full-screen image; treat it as an empty banner BannerBottomEdge = 0; } else { BannerBottomEdge = GlobalConfig.BannerBottomEdge; } - if (*Height > (HintTop - BannerBottomEdge - FONT_CELL_HEIGHT * 2)) { + if (*Height > (HintTop - BannerBottomEdge - FontCellHeight * 2)) { BannerBottomEdge = 0; } - if (*Height > (HintTop - BannerBottomEdge - FONT_CELL_HEIGHT * 2)) { + if (*Height > (HintTop - BannerBottomEdge - FontCellHeight * 2)) { // TODO: Implement scrolling in text screen. - *Height = (HintTop - BannerBottomEdge - FONT_CELL_HEIGHT * 2); + *Height = (HintTop - BannerBottomEdge - FontCellHeight * 2); } *YPos = ((UGAHeight - *Height) / 2); if (*YPos < BannerBottomEdge) - *YPos = BannerBottomEdge + FONT_CELL_HEIGHT + (HintTop - BannerBottomEdge - *Height) / 2; + *YPos = BannerBottomEdge + FontCellHeight + (HintTop - BannerBottomEdge - *Height) / 2; } // VOID ComputeSubScreenWindowSize() // Displays sub-menus @@ -766,37 +787,48 @@ static VOID GraphicsMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *Sta { INTN i; UINTN ItemWidth; - static UINTN LineWidth, MenuWidth, MenuHeight, EntriesPosX, EntriesPosY, TimeoutPosY; + static UINTN LineWidth, MenuWidth, MenuHeight, EntriesPosX, TitlePosX, EntriesPosY, TimeoutPosY, CharWidth; EG_IMAGE *Window; EG_PIXEL *BackgroundPixel = &(GlobalConfig.ScreenBackground->PixelData[0]); + CharWidth = egGetFontCellWidth(); State->ScrollMode = SCROLL_MODE_TEXT; switch (Function) { case MENU_FUNCTION_INIT: InitScroll(State, Screen->EntryCount, 0); ComputeSubScreenWindowSize(Screen, State, &EntriesPosX, &EntriesPosY, &MenuWidth, &MenuHeight, &LineWidth); - TimeoutPosY = EntriesPosY + (Screen->EntryCount + 1) * TEXT_LINE_HEIGHT; + TimeoutPosY = EntriesPosY + (Screen->EntryCount + 1) * TextLineHeight(); // initial painting SwitchToGraphicsAndClear(); Window = egCreateFilledImage(MenuWidth, MenuHeight, FALSE, BackgroundPixel); egDrawImage(Window, EntriesPosX, EntriesPosY); - egMeasureText(Screen->Title, &ItemWidth, NULL); - DrawText(Screen->Title, FALSE, (StrLen(Screen->Title) + 2) * FONT_CELL_WIDTH, - EntriesPosX + (MenuWidth - ItemWidth) / 2, EntriesPosY += TEXT_LINE_HEIGHT); + ItemWidth = egComputeTextWidth(Screen->Title); + if (MenuWidth > ItemWidth) { + TitlePosX = EntriesPosX + (MenuWidth - ItemWidth) / 2 - CharWidth; + } else { + TitlePosX = EntriesPosX; + if (CharWidth > 0) { + i = MenuWidth / CharWidth - 2; + if (i > 0) + Screen->Title[i] = 0; + } // if + } // if/else + + DrawText(Screen->Title, FALSE, (StrLen(Screen->Title) + 2) * CharWidth, TitlePosX, EntriesPosY += TextLineHeight()); if (Screen->TitleImage) { - BltImageAlpha(Screen->TitleImage, EntriesPosX + TITLEICON_SPACING, EntriesPosY + TEXT_LINE_HEIGHT * 2, + BltImageAlpha(Screen->TitleImage, EntriesPosX + TITLEICON_SPACING, EntriesPosY + TextLineHeight() * 2, BackgroundPixel); EntriesPosX += (Screen->TitleImage->Width + TITLEICON_SPACING * 2); } - EntriesPosY += (TEXT_LINE_HEIGHT * 2); + EntriesPosY += (TextLineHeight() * 2); if (Screen->InfoLineCount > 0) { for (i = 0; i < (INTN)Screen->InfoLineCount; i++) { DrawText(Screen->InfoLines[i], FALSE, LineWidth, EntriesPosX, EntriesPosY); - EntriesPosY += TEXT_LINE_HEIGHT; + EntriesPosY += TextLineHeight(); } - EntriesPosY += TEXT_LINE_HEIGHT; // also add a blank line + EntriesPosY += TextLineHeight(); // also add a blank line } break; @@ -808,22 +840,24 @@ static VOID GraphicsMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *Sta case MENU_FUNCTION_PAINT_ALL: for (i = 0; i <= State->MaxIndex; i++) { DrawText(Screen->Entries[i]->Title, (i == State->CurrentSelection), LineWidth, EntriesPosX, - EntriesPosY + i * TEXT_LINE_HEIGHT); + EntriesPosY + i * TextLineHeight()); } if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_HINTS)) { if ((Screen->Hint1 != NULL) && (StrLen(Screen->Hint1) > 0)) - DrawTextWithTransparency(Screen->Hint1, (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3)); + DrawTextWithTransparency(Screen->Hint1, (UGAWidth - egComputeTextWidth(Screen->Hint1)) / 2, + UGAHeight - (egGetFontHeight() * 3)); if ((Screen->Hint2 != NULL) && (StrLen(Screen->Hint2) > 0)) - DrawTextWithTransparency(Screen->Hint2, (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2)); + DrawTextWithTransparency(Screen->Hint2, (UGAWidth - egComputeTextWidth(Screen->Hint2)) / 2, + UGAHeight - (egGetFontHeight() * 2)); } // if break; case MENU_FUNCTION_PAINT_SELECTION: // redraw selection cursor DrawText(Screen->Entries[State->PreviousSelection]->Title, FALSE, LineWidth, - EntriesPosX, EntriesPosY + State->PreviousSelection * TEXT_LINE_HEIGHT); + EntriesPosX, EntriesPosY + State->PreviousSelection * TextLineHeight()); DrawText(Screen->Entries[State->CurrentSelection]->Title, TRUE, LineWidth, - EntriesPosX, EntriesPosY + State->CurrentSelection * TEXT_LINE_HEIGHT); + EntriesPosX, EntriesPosY + State->CurrentSelection * TextLineHeight()); break; case MENU_FUNCTION_PAINT_TIMEOUT: @@ -871,12 +905,16 @@ static VOID PaintAll(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, UINTN } } if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) + DrawTextWithTransparency(L"", 0, textPosY); DrawTextWithTransparency(Screen->Entries[State->CurrentSelection]->Title, - (UGAWidth - LAYOUT_TEXT_WIDTH) >> 1, textPosY); + (UGAWidth - egComputeTextWidth(Screen->Entries[State->CurrentSelection]->Title)) >> 1, + textPosY); if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_HINTS)) { - DrawTextWithTransparency(Screen->Hint1, (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3)); - DrawTextWithTransparency(Screen->Hint2, (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2)); + DrawTextWithTransparency(Screen->Hint1, (UGAWidth - egComputeTextWidth(Screen->Hint1)) / 2, + UGAHeight - (egGetFontHeight() * 3)); + DrawTextWithTransparency(Screen->Hint2, (UGAWidth - egComputeTextWidth(Screen->Hint2)) / 2, + UGAHeight - (egGetFontHeight() * 2)); } // if } // static VOID PaintAll() @@ -903,9 +941,12 @@ static VOID PaintSelection(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, } // if/else DrawMainMenuEntry(Screen->Entries[State->PreviousSelection], FALSE, itemPosX[XSelectPrev], YPosPrev); DrawMainMenuEntry(Screen->Entries[State->CurrentSelection], TRUE, itemPosX[XSelectCur], YPosCur); - if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) + if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) { + DrawTextWithTransparency(L"", 0, textPosY); DrawTextWithTransparency(Screen->Entries[State->CurrentSelection]->Title, - (UGAWidth - LAYOUT_TEXT_WIDTH) >> 1, textPosY); + (UGAWidth - egComputeTextWidth(Screen->Entries[State->CurrentSelection]->Title)) >> 1, + textPosY); + } } else { // Current selection not visible; must redraw the menu.... MainMenuStyle(Screen, State, MENU_FUNCTION_PAINT_ALL, NULL); } @@ -1041,8 +1082,10 @@ VOID MainMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, IN UINT break; case MENU_FUNCTION_PAINT_TIMEOUT: - if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) - DrawTextWithTransparency(ParamText, (UGAWidth - LAYOUT_TEXT_WIDTH) >> 1, textPosY + TEXT_LINE_HEIGHT); + if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) { + DrawTextWithTransparency(L"", 0, textPosY + TextLineHeight()); + DrawTextWithTransparency(ParamText, (UGAWidth - egComputeTextWidth(ParamText)) >> 1, textPosY + TextLineHeight()); + } break; } diff --git a/refind/screen.c b/refind/screen.c index cd2af67..fd29f5c 100644 --- a/refind/screen.c +++ b/refind/screen.c @@ -394,7 +394,6 @@ BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CHAR16 *where) if (!EFI_ERROR(Status)) return FALSE; -// StatusToString(ErrorName, Status); gST->ConOut->SetAttribute (gST->ConOut, ATTR_ERROR); Print(L"Fatal Error: %r %s\n", Status, where); gST->ConOut->SetAttribute (gST->ConOut, ATTR_BASIC); @@ -407,12 +406,9 @@ BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CHAR16 *where) BOOLEAN CheckError(IN EFI_STATUS Status, IN CHAR16 *where) { -// CHAR16 ErrorName[64]; - if (!EFI_ERROR(Status)) return FALSE; -// StatusToString(ErrorName, Status); gST->ConOut->SetAttribute (gST->ConOut, ATTR_ERROR); Print(L"Error: %r %s\n", Status, where); gST->ConOut->SetAttribute (gST->ConOut, ATTR_BASIC); diff --git a/refind/screen.h b/refind/screen.h index 2647fc7..f17e549 100644 --- a/refind/screen.h +++ b/refind/screen.h @@ -60,11 +60,11 @@ #define ATTR_SCROLLARROW (EFI_LIGHTGREEN | EFI_BACKGROUND_BLACK) //#define LAYOUT_TEXT_WIDTH (512) -#define LAYOUT_TEXT_WIDTH (425) +//#define LAYOUT_TEXT_WIDTH (425) #define LAYOUT_BANNER_YGAP 32 -#define FONT_CELL_WIDTH (7) -#define FONT_CELL_HEIGHT (12) +//#define FONT_CELL_WIDTH (7) +//#define FONT_CELL_HEIGHT (12) extern UINTN ConWidth; extern UINTN ConHeight; -- 2.39.2