[PATCH v2 1/3] Handle CJK wide glyph rendering

David Herrmann dh.herrmann at gmail.com
Tue Jul 23 00:22:39 PDT 2013


Hi

On Tue, Jul 23, 2013 at 4:44 AM, Peng Wu <peng.e.wu at gmail.com> wrote:
> Yes, I just followed the gnome vte terminal widget code.
> I will try to send v3 patch set to remove glib dependencies soon.

Please first address the issues I mentioned in v1. You cannot just
redraw characters and be fine. That's not how it works. You need to
adjust handle_char() to move the cursor two columns for
wide-characters.

Imagine MODE_AUTOWRAP is set and you draw 10 wide-characters on a 10
cell-line. We expect a vt320-compat terminal to draw 5 chars on the
first line and the other 5 chars on the next line.

Assume MODE_AUTOWRAP not set and you draw 10 wide-characters on a 10
cell-line. We expect the first 4 chars on the line and the last char
to be the last character written.

Really, multi-width characters isn't about drawing. It's about
correctly interpreting the incoming characters in your vt100-like
state-machine. Why do you want to support that in terminal.c anyway?
It's an example, it misses support for a lot of things and I recommend
avoiding adding complex features.

Anyhow, here is an example how to move the cursor for multi-width characters:
  https://github.com/dvdhrm/kmscon/blob/master/src/tsm_screen.c#L1000

Regards
David

> On Sun, 2013-07-21 at 23:22 -0500, Thomas Daede wrote:
>> This is for a VT-100 style terminal emulator, right? It's designed to
>> implement a grid of characters. Therefore, drawing it like a grid
>> based on single or double character widths makes a lot more sense than
>> detecting the length of a string. On any other UI element, detecting
>> the string length would be more appropriate.
>>
>> Ideally I would imagine you would always pick a fixed width font (aka
>> only single or double widths) but the terminal should work "okay" with
>> a proportional font, forcing it into fixed positions.
>>
>> I think Peng's implementation is in line with other virtual terminals.
>>
>> On Sun, Jul 21, 2013 at 9:46 PM, Peng Wu <peng.e.wu at gmail.com> wrote:
>> > Frankly speaking, I suspect that your new fix will break some program
>> > which uses newt with proportional font.
>> > PS: newt is a library for text mode user interfaces.
>> >
>> >
>> > On Thu, 2013-07-18 at 11:23 -0700, Bill Spitzak wrote:
>> >> I propose the drawing code be changed to something like this:
>> >>
>> >>    char* string = the_line_to_draw;
>> >>    cairo_draw_text_at(x, y, string);
>> >>
>> >> And this:
>> >>
>> >> int where_is_position_n(int n, char* string) {
>> >>    return cairo_text_width(string, n);
>> >> }
>> >
>> >
>> > _______________________________________________
>> > wayland-devel mailing list
>> > wayland-devel at lists.freedesktop.org
>> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list