Commit 6802f359 authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Greg Kroah-Hartman
Browse files

vt: make use of ucs_get_fallback() when glyph is unavailable



Attempt to display a fallback character when given character doesn't
have an available glyph. The substitution may not be as good as the
original character but still way more helpful than a squared question
mark.

Example substitutions: À -> A, ç -> c, ø -> o, ─ -> -, © -> C, etc.

See gen_ucs_fallback_table.py for a comprehensive list.

Signed-off-by: default avatarNicolas Pitre <npitre@baylibre.com>
Link: https://lore.kernel.org/r/20250507141535.40655-8-nico@fluxnic.net


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fe26933c
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -3007,6 +3007,19 @@ static int vc_get_glyph(struct vc_data *vc, int tc)
		return tc;
	}

	/*
	 * The Unicode screen memory is allocated only when required.
	 * This is one such case: we're about to "cheat" with the displayed
	 * character meaning the simple screen buffer won't hold the original
	 * information, whereas the Unicode screen buffer always does.
	 */
	vc_uniscr_check(vc);

	/* Try getting a simpler fallback character. */
	tc = ucs_get_fallback(tc);
	if (tc)
		return vc_get_glyph(vc, tc);

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