Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Unicode Box Drawing characters with ASCII characters #271

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

tonper
Copy link
Contributor

@tonper tonper commented Feb 15, 2021

Solves #177. Many ASRock boards will not render MokManager correctly if the Unicode Box Drawing characters are used. This PR replace the BOXDRAW_ characters with ASCII characters.

I'm not sure how many systems are affected by this problem, so I can't say if ugly ASCII boxes are worth it. A nicer solution would be to detect the issue and use ASCII as a fallback, but I'm not sure if that's possible.

Tested on an ASRock X399 Taichi.

@vathpela
Copy link
Contributor

Is it possible to figure out that this is an ASRock board and conditionalize on that? I'm really hesitant to make this look worse for everyone else because of one vendor of super-low-quality motherboards.

@vathpela vathpela linked an issue Feb 19, 2021 that may be closed by this pull request
@vathpela vathpela self-requested a review February 19, 2021 17:25
@vathpela vathpela marked this pull request as draft February 19, 2021 17:25
@mjg59
Copy link
Collaborator

mjg59 commented Feb 19, 2021

One somewhat horrifying approach - draw a box character, read back the framebuffer, see whether it looks like a box character?

Many ASRock boards will not render MokManager correctly if the Unicode
Box Drawing characters are used.

Signed-off-by: Tony Persson <tony@tonypersson.se>
@tonper
Copy link
Contributor Author

tonper commented Feb 22, 2021

Turns out you can use the return value from co->OutputString() to detect the problem. I've modified the branch to use ASCII as a fallback instead.

@vathpela vathpela added this to the shim 16 milestone Mar 11, 2021
@xnox
Copy link
Contributor

xnox commented Mar 15, 2021

@vathpela can this be undrafted? or is this somehow not appropriate to go in?

co->SetCursorPosition(co, start_col, start_row);
Line[0] = boxdraw[0].up_left;
Line[1] = L'\0';
char_set = co->OutputString(co, Line) == 0 ? 0 : 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UEFI Specification Version 2.8 Errata B does specify the BOXDRAW characters as mandatory. As per the Spec's page 448, the Status Codes that can be returned here are EFI_SUCCESS, EFI_DEVICE_ERROR, EFI_UNSUPPORTED, and EFI_WARN_UNKNOWN_GLYPH.

I would prefer to test for EFI_WARN_UNKNONW_GLYPH (and if that's in fact what is returned on ASRock) and then switch to the other character set based on that.

Also it would be nice to retest that the one one works and doesn't also return EFI_WARN_UNKNOWN_GLYPH in case the firware just returns that always irrespective if it was successful or not.

@vathpela vathpela marked this pull request as ready for review October 12, 2021 14:55
@vathpela vathpela merged commit 8c6904e into rhboot:main Oct 12, 2021
@vathpela
Copy link
Contributor

Pushed with a minor fix (WCHAR vs CHAR16) as e5bf2ba.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MokManager screen not being drawn properly
4 participants