mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Nicolas Pitre <nico@fluxnic.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Nicolas Pitre <npitre@baylibre.com>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/8] vt: move glyph determination to a separate function
Date: Tue, 6 May 2025 08:06:43 +0200	[thread overview]
Message-ID: <fe312c65-99de-4519-9072-caeebf44227b@kernel.org> (raw)
In-Reply-To: <20250505170021.29944-4-nico@fluxnic.net>

On 05. 05. 25, 18:55, Nicolas Pitre wrote:
> From: Nicolas Pitre <npitre@baylibre.com>
> 
> No logical changes. Make it easier for enhancements to come.
...
> @@ -2984,12 +2985,40 @@ static int vc_process_ucs(struct vc_data *vc, int *c, int *tc)
>   	return 0;
>   }
>   
> +static int vc_get_glyph(struct vc_data *vc, int tc)
> +{
> +	int glyph = conv_uni_to_pc(vc, tc);
> +	int charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;

Could you keep charmask unsigned? It used to be u16.

> +
> +	if (!(glyph & ~charmask))
> +		return glyph;
> +
> +	if (glyph == -1)
> +		return -1; /* nothing to display */
> +
> +	/* Glyph not found */
> +

Do no additional \n here ^^.

> +	if ((!vc->vc_utf || vc->vc_disp_ctrl || tc < 128) && !(tc & ~charmask)) {
> +		/*
> +		 * In legacy mode use the glyph we get by a 1:1 mapping.
> +		 * This would make absolutely no sense with Unicode in mind,
> +		 * but do this for ASCII characters since a font may lack
> +		 * Unicode mapping info and we don't want to end up with
> +		 * having question marks only.

Generally: feel free to use 100 characters per line.

> +		 */
> +		return tc;
> +	}
> +
> +	/* Display U+FFFD (Unicode Replacement Character). */
> +	return conv_uni_to_pc(vc, UCS_REPLACEMENT);
> +}

thanks,
-- 
js
suse labs

  reply	other threads:[~2025-05-06  6:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05 16:55 [PATCH 0/8] vt: more Unicode handling changes Nicolas Pitre
2025-05-05 16:55 ` [PATCH 1/8] vt: ucs.c: fix misappropriate in_range() usage Nicolas Pitre
2025-05-06  5:58   ` Jiri Slaby
2025-05-05 16:55 ` [PATCH 2/8] vt: make sure displayed double-width characters are remembered as such Nicolas Pitre
2025-05-05 16:55 ` [PATCH 3/8] vt: move glyph determination to a separate function Nicolas Pitre
2025-05-06  6:06   ` Jiri Slaby [this message]
2025-05-05 16:55 ` [PATCH 4/8] vt: introduce gen_ucs_fallback_table.py to create ucs_fallback_table.h Nicolas Pitre
2025-05-06  6:33   ` Jiri Slaby
2025-05-07 14:11     ` Nicolas Pitre
2025-05-05 16:55 ` [PATCH 5/8] vt: create ucs_fallback_table.h_shipped with gen_ucs_fallback_table.py Nicolas Pitre
2025-05-05 16:55 ` [PATCH 6/8] vt: add ucs_get_fallback() Nicolas Pitre
2025-05-05 16:55 ` [PATCH 7/8] vt: make use of ucs_get_fallback() when glyph is unavailable Nicolas Pitre
2025-05-05 16:55 ` [PATCH 8/8] vt: process the full-width ASCII fallback range programmatically Nicolas Pitre
2025-05-06  5:55   ` Jiri Slaby
2025-05-07 14:04     ` Nicolas Pitre

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=fe312c65-99de-4519-9072-caeebf44227b@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=nico@fluxnic.net \
    --cc=npitre@baylibre.com \
    /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

all inboxes | Powered by JetHome®