public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: Anatolij Gustschin <agust@denx.de>,
	Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
	Alexander Graf <agraf@csgraf.de>,
	Mark Kettenis <kettenis@openbsd.org>,
	u-boot@lists.denx.de
Subject: Re: [PATCH 7/8] efi_selftest: Add box drawing character selftest
Date: Mon, 10 Jan 2022 11:08:59 +0000	[thread overview]
Message-ID: <20220110110859.5be702cd@donnerap.cambridge.arm.com> (raw)
In-Reply-To: <525648bb-53de-952e-3f71-b0c34e7fb759@canonical.com>

On Mon, 10 Jan 2022 10:23:20 +0100
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> wrote:

Hi Heinrich,

> On 1/10/22 01:56, Andre Przywara wrote:
> > UEFI applications rely on Unicode output capability, and might use that
> > for drawing pseudo-graphical interfaces using Unicode defined box
> > drawing characters.
> > 
> > Add a simple test to display the most basic box characters, which would
> > need to be checked manually on the screen for correctness.
> > To facilitate this, add a three second delay after the output at this
> > point.
> > 
> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > ---
> >   lib/efi_selftest/efi_selftest_textoutput.c | 11 +++++++++++
> >   1 file changed, 11 insertions(+)
> > 
> > diff --git a/lib/efi_selftest/efi_selftest_textoutput.c b/lib/efi_selftest/efi_selftest_textoutput.c
> > index a437732496b..1542c187de7 100644
> > --- a/lib/efi_selftest/efi_selftest_textoutput.c
> > +++ b/lib/efi_selftest/efi_selftest_textoutput.c
> > @@ -123,6 +123,17 @@ static int execute(void)
> >   		efi_st_error("OutputString failed for international chars\n");
> >   		return EFI_ST_FAILURE;
> >   	}
> > +	ret  = con_out->output_string(con_out, L"┌─┬─┐\n");
> > +	ret |= con_out->output_string(con_out, L"│ │ │\n");
> > +	ret |= con_out->output_string(con_out, L"├─┼─┤\n");
> > +	ret |= con_out->output_string(con_out, L"│ │ │\n");
> > +	ret |= con_out->output_string(con_out, L"└─┴─┘\n");  
> 
> %s/L"/u"/
> 
> Unicode characters in code are not supported by all tools. The 
> interpretation may further depend on the users locale. Please, use \u 
> escape sequences. A single output_string() call is enough. A notice for 
> the user might be helpful. So I suggest:
> 
> This should render as four boxes with text
> ┌─────────────┬───────────────┐
> │ left top    │ right top     │
> ├─────────────┼───────────────┤
> │ left bottom │ right bottom  │
> └─────────────┴───────────────┘
> 
> const u16 text[] =
> u"This should render as four boxes with text\n"
> u"\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
> u"\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
> u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502"
> u" left top    \u2502 right top     \u2502\n\u251c\u2500"
> u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
> u"\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
> u"\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 "
> u"left bottom \u2502 right bottom  \u2502\n\u2514\u2500\u2500\u2500"
> u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534"
> u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
> u"\u2500\u2500\u2500\u2500\u2518\n";

Ha, very good, thanks for the hints! And for typing all those numbers!
I was wondering about UTF-8 in source, but since my ancient Slackware could
deal with it, I deemed it safe ;-)

Will fix it accordingly!

Cheers,
Andre

> > +	if (ret != EFI_ST_SUCCESS) {
> > +		efi_st_error("OutputString failed for box drawing chars\n");
> > +		return EFI_ST_FAILURE;
> > +	}
> > +	con_out->output_string(con_out, L"waiting for admiration...\n");
> > +	EFI_CALL(systab.boottime->stall(3000000));
> >   	efi_st_printf("\n");
> >   
> >   	return EFI_ST_SUCCESS;  
> 


  reply	other threads:[~2022-01-10 11:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10  0:56 [PATCH 0/8] video: improve UEFI experience on DM_VIDEO Andre Przywara
2022-01-10  0:56 ` [PATCH 1/8] video: Add cursor support for DM_VIDEO consoles Andre Przywara
2022-01-10  9:41   ` Heinrich Schuchardt
2022-01-10 12:16     ` Andre Przywara
2022-03-13 22:23   ` Simon Glass
2022-01-10  0:56 ` [PATCH 2/8] video: vidconsole: Support wider bitmap fonts Andre Przywara
2022-01-12 20:04   ` Simon Glass
2022-01-10  0:56 ` [PATCH 3/8] video: Kconfig: convert CONFIG_VIDEO_FONT_4X6 to Kconfig Andre Przywara
2022-01-12 20:04   ` Simon Glass
2022-01-10  0:56 ` [PATCH 4/8] video: Add sun12x22 framebuffer front Andre Przywara
2022-01-12 20:04   ` Simon Glass
2022-01-10  0:56 ` [PATCH 5/8] video: Add Terminus 16x32 font Andre Przywara
2022-01-12 20:04   ` Simon Glass
2022-01-10  0:56 ` [PATCH 6/8] efi-selftest: Add international characters test Andre Przywara
2022-01-10  9:34   ` Heinrich Schuchardt
2022-01-10  0:56 ` [PATCH 7/8] efi_selftest: Add box drawing character selftest Andre Przywara
2022-01-10  9:23   ` Heinrich Schuchardt
2022-01-10 11:08     ` Andre Przywara [this message]
2022-01-10  0:56 ` [PATCH 8/8] video: Convert UTF-8 input stream to the 437 code page Andre Przywara
2022-01-10  8:18   ` Heinrich Schuchardt
2022-01-10 11:08     ` Andre Przywara
2022-03-13 22:23   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220110110859.5be702cd@donnerap.cambridge.arm.com \
    --to=andre.przywara@arm.com \
    --cc=agraf@csgraf.de \
    --cc=agust@denx.de \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=kettenis@openbsd.org \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox