Skip to content

Commit

Permalink
OpenCanopy: Account for text position when rejecting font images
Browse files Browse the repository at this point in the history
  • Loading branch information
mhaeuser committed Apr 4, 2021
1 parent 0cdde8d commit ab5abe4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
5 changes: 3 additions & 2 deletions Platform/OpenCanopy/BitmapFont.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "OpenCanopy.h"
#include "BmfLib.h"
#include "GuiApp.h"

CONST BMF_CHAR *
BmfGetChar (
Expand Down Expand Up @@ -621,8 +622,8 @@ GuiGetLabel (
&Context->BmfContext,
String,
StringLen,
2 * Context->Scale,
2 * Context->Scale
BOOT_ENTRY_LABEL_TEXT_OFFSET * Context->Scale,
BOOT_ENTRY_LABEL_TEXT_OFFSET * Context->Scale
);
if (TextInfo == NULL) {
DEBUG ((DEBUG_WARN, "BMF: GetTextInfo failed\n"));
Expand Down
4 changes: 2 additions & 2 deletions Platform/OpenCanopy/GuiApp.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,12 @@ InternalContextConstruct (
FontDataSize,
Context->Scale
);
if (Context->FontContext.BmfContext.Height != BOOT_ENTRY_LABEL_HEIGHT * Context->Scale) {
if (Context->FontContext.BmfContext.Height != (BOOT_ENTRY_LABEL_HEIGHT - BOOT_ENTRY_LABEL_TEXT_OFFSET) * Context->Scale) {
DEBUG((
DEBUG_WARN,
"OCUI: Font has height %d instead of %d\n",
Context->FontContext.BmfContext.Height,
BOOT_ENTRY_LABEL_HEIGHT * Context->Scale
(BOOT_ENTRY_LABEL_HEIGHT - BOOT_ENTRY_LABEL_TEXT_OFFSET) * Context->Scale
));
Result = FALSE;
}
Expand Down
11 changes: 6 additions & 5 deletions Platform/OpenCanopy/GuiApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

#define BOOT_CURSOR_OFFSET 4U

#define BOOT_ENTRY_DIMENSION 144U
#define BOOT_ENTRY_ICON_DIMENSION APPLE_DISK_ICON_DIMENSION
#define BOOT_ENTRY_ICON_SPACE ((BOOT_ENTRY_DIMENSION - BOOT_ENTRY_ICON_DIMENSION) / 2)
#define BOOT_ENTRY_LABEL_SPACE 4U
#define BOOT_ENTRY_LABEL_HEIGHT 12U
#define BOOT_ENTRY_DIMENSION 144U
#define BOOT_ENTRY_ICON_DIMENSION APPLE_DISK_ICON_DIMENSION
#define BOOT_ENTRY_ICON_SPACE ((BOOT_ENTRY_DIMENSION - BOOT_ENTRY_ICON_DIMENSION) / 2)
#define BOOT_ENTRY_LABEL_SPACE 4U
#define BOOT_ENTRY_LABEL_HEIGHT 12U
#define BOOT_ENTRY_LABEL_TEXT_OFFSET 2U

#define BOOT_ENTRY_SPACE 8U

Expand Down

0 comments on commit ab5abe4

Please sign in to comment.