diff mbox series

[v3,4/7] efi_selftest: Add international characters test

Message ID 20240316-vidconsole-utf8-uefi-v3-4-4e8a3d349447@jannau.net
State Accepted, archived
Delegated to: Heinrich Schuchardt
Headers show
Series video: Add UTF-8 support for UEFI applications | expand

Commit Message

Janne Grunau via B4 Relay March 16, 2024, 9:50 p.m. UTC
From: Andre Przywara <andre.przywara@arm.com>

UEFI relies entirely on unicode output, which actual fonts displayed on
the screen might not be ready for.

Add a test displaying some international characters, to reveal missing
glyphs, especially in our builtin fonts.
This would be needed to be manually checked on the screen for
correctness.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Janne Grunau <j@jannau.net>
---
 lib/efi_selftest/efi_selftest_textoutput.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Heinrich Schuchardt March 17, 2024, 9:24 a.m. UTC | #1
On 3/16/24 22:50, Janne Grunau via B4 Relay wrote:
> From: Andre Przywara <andre.przywara@arm.com>
>
> UEFI relies entirely on unicode output, which actual fonts displayed on
> the screen might not be ready for.
>
> Add a test displaying some international characters, to reveal missing
> glyphs, especially in our builtin fonts.
> This would be needed to be manually checked on the screen for
> correctness.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Signed-off-by: Janne Grunau <j@jannau.net>
> ---
>   lib/efi_selftest/efi_selftest_textoutput.c | 21 +++++++++++++++++++++
>   1 file changed, 21 insertions(+)
>
> diff --git a/lib/efi_selftest/efi_selftest_textoutput.c b/lib/efi_selftest/efi_selftest_textoutput.c
> index cc44b38bc2..917903473d 100644
> --- a/lib/efi_selftest/efi_selftest_textoutput.c
> +++ b/lib/efi_selftest/efi_selftest_textoutput.c
> @@ -31,6 +31,21 @@ static int execute(void)
>   		0xD804, 0xDC22,
>   		0};
>
> +	const u16 text[] =
> +u"This should render international characters as described\n"
> +u"U+00D6 \u00D6 - Latin capital letter O with diaresis\n"
> +u"U+00DF \u00DF - Latin small letter sharp s\n"
> +u"U+00E5 \u00E5 - Latin small letter a with ring above\n"
> +u"U+00E9 \u00E9 - Latin small letter e with acute\n"
> +u"U+00F1 \u00F1 - Latin small letter n with tilde\n"
> +u"U+00F6 \u00F6 - Latin small letter o with diaresis\n"
> +u"The following characters will render as '?' with bitmap fonts\n"
> +u"U+00F8 \u00F8 - Latin small letter o with stroke\n"
> +u"U+03AC \u03AC - Greek small letter alpha with tonus\n"
> +u"U+03BB \u03BB - Greek small letter lambda\n"
> +u"U+03C2 \u03C2 - Greek small letter final sigma\n"
> +u"U+1F19 \u1F19 - Greek capital letter epsilon with dasia\n";

The strings should be indented by two tabs.

Otherwise:

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> +
>   	/* SetAttribute */
>   	efi_st_printf("\nColor palette\n");
>   	for (foreground = 0; foreground < 0x10; ++foreground) {
> @@ -119,6 +134,12 @@ static int execute(void)
>   		return EFI_ST_FAILURE;
>   	}
>   	efi_st_printf("\n");
> +	ret = con_out->output_string(con_out, text);
> +	if (ret != EFI_ST_SUCCESS) {
> +		efi_st_error("OutputString failed for international chars\n");
> +		return EFI_ST_FAILURE;
> +	}
> +	efi_st_printf("\n");
>
>   	return EFI_ST_SUCCESS;
>   }
>
Janne Grunau March 19, 2024, 9:28 p.m. UTC | #2
On Sun, Mar 17, 2024 at 10:24:13AM +0100, Heinrich Schuchardt wrote:
> On 3/16/24 22:50, Janne Grunau via B4 Relay wrote:
> > From: Andre Przywara <andre.przywara@arm.com>
> >
> > UEFI relies entirely on unicode output, which actual fonts displayed on
> > the screen might not be ready for.
> >
> > Add a test displaying some international characters, to reveal missing
> > glyphs, especially in our builtin fonts.
> > This would be needed to be manually checked on the screen for
> > correctness.
> >
> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > Signed-off-by: Janne Grunau <j@jannau.net>
> > ---
> >   lib/efi_selftest/efi_selftest_textoutput.c | 21 +++++++++++++++++++++
> >   1 file changed, 21 insertions(+)
> >
> > diff --git a/lib/efi_selftest/efi_selftest_textoutput.c b/lib/efi_selftest/efi_selftest_textoutput.c
> > index cc44b38bc2..917903473d 100644
> > --- a/lib/efi_selftest/efi_selftest_textoutput.c
> > +++ b/lib/efi_selftest/efi_selftest_textoutput.c
> > @@ -31,6 +31,21 @@ static int execute(void)
> >   		0xD804, 0xDC22,
> >   		0};
> >
> > +	const u16 text[] =
> > +u"This should render international characters as described\n"
> > +u"U+00D6 \u00D6 - Latin capital letter O with diaresis\n"
> > +u"U+00DF \u00DF - Latin small letter sharp s\n"
> > +u"U+00E5 \u00E5 - Latin small letter a with ring above\n"
> > +u"U+00E9 \u00E9 - Latin small letter e with acute\n"
> > +u"U+00F1 \u00F1 - Latin small letter n with tilde\n"
> > +u"U+00F6 \u00F6 - Latin small letter o with diaresis\n"
> > +u"The following characters will render as '?' with bitmap fonts\n"
> > +u"U+00F8 \u00F8 - Latin small letter o with stroke\n"
> > +u"U+03AC \u03AC - Greek small letter alpha with tonus\n"
> > +u"U+03BB \u03BB - Greek small letter lambda\n"
> > +u"U+03C2 \u03C2 - Greek small letter final sigma\n"
> > +u"U+1F19 \u1F19 - Greek capital letter epsilon with dasia\n";
> 
> The strings should be indented by two tabs.

done locally for all selftests, I'm waiting on fedback for Patch 2 and 3
before resending.

thanks

Janne
diff mbox series

Patch

diff --git a/lib/efi_selftest/efi_selftest_textoutput.c b/lib/efi_selftest/efi_selftest_textoutput.c
index cc44b38bc2..917903473d 100644
--- a/lib/efi_selftest/efi_selftest_textoutput.c
+++ b/lib/efi_selftest/efi_selftest_textoutput.c
@@ -31,6 +31,21 @@  static int execute(void)
 		0xD804, 0xDC22,
 		0};
 
+	const u16 text[] =
+u"This should render international characters as described\n"
+u"U+00D6 \u00D6 - Latin capital letter O with diaresis\n"
+u"U+00DF \u00DF - Latin small letter sharp s\n"
+u"U+00E5 \u00E5 - Latin small letter a with ring above\n"
+u"U+00E9 \u00E9 - Latin small letter e with acute\n"
+u"U+00F1 \u00F1 - Latin small letter n with tilde\n"
+u"U+00F6 \u00F6 - Latin small letter o with diaresis\n"
+u"The following characters will render as '?' with bitmap fonts\n"
+u"U+00F8 \u00F8 - Latin small letter o with stroke\n"
+u"U+03AC \u03AC - Greek small letter alpha with tonus\n"
+u"U+03BB \u03BB - Greek small letter lambda\n"
+u"U+03C2 \u03C2 - Greek small letter final sigma\n"
+u"U+1F19 \u1F19 - Greek capital letter epsilon with dasia\n";
+
 	/* SetAttribute */
 	efi_st_printf("\nColor palette\n");
 	for (foreground = 0; foreground < 0x10; ++foreground) {
@@ -119,6 +134,12 @@  static int execute(void)
 		return EFI_ST_FAILURE;
 	}
 	efi_st_printf("\n");
+	ret = con_out->output_string(con_out, text);
+	if (ret != EFI_ST_SUCCESS) {
+		efi_st_error("OutputString failed for international chars\n");
+		return EFI_ST_FAILURE;
+	}
+	efi_st_printf("\n");
 
 	return EFI_ST_SUCCESS;
 }