From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?4KS44KSu4KWA4KSwIOCkuOCkv+CkguCkuSBTYW1lZXIgU2luZ2g=?= Newsgroups: gmane.emacs.devel Subject: Re: Implementing Vertical Text support in Emacs Date: Sat, 10 Sep 2022 21:23:32 +0530 Message-ID: References: <83r13sttj6.fsf@gnu.org> <87wndi6xau.fsf@yahoo.com> <83mtebq0nd.fsf@gnu.org> <838rmtelfg.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000cf2f1105e854aad1" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39940"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 10 17:54:32 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oX2oS-000AGg-E2 for ged-emacs-devel@m.gmane-mx.org; Sat, 10 Sep 2022 17:54:32 +0200 Original-Received: from localhost ([::1]:37754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oX2oQ-0004NJ-Ul for ged-emacs-devel@m.gmane-mx.org; Sat, 10 Sep 2022 11:54:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oX2nk-0003hQ-2p for emacs-devel@gnu.org; Sat, 10 Sep 2022 11:53:48 -0400 Original-Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]:44886) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oX2ni-0001YV-82; Sat, 10 Sep 2022 11:53:47 -0400 Original-Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-11eab59db71so11681651fac.11; Sat, 10 Sep 2022 08:53:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=DWFm9STu4SMgxftcEWzNblH7UlhhQA8DGOnI+xUOiuM=; b=AZfBvdAkIksSldRDTFvzup3UDSf/Bw/vr1cSUDsO5s2zb3wFnIm/MbIlfaB3OM0mxo fj57sANyHscAC79toA9sOGWAIaISN+dYqK583Il+viCDAUz+bspJzqjWBEq4tyD0swQP MhXt9cQ8Tg1SFmH7a+BXvydmDc2yoL4HqrPGW9SCgp7ywD+WL1SQUgcjxLrStt+codGi Ac9jayGGNJFCDZsBi91fzHzXE6vTGxoj3xmExIhs/SjBOwY/hbanVoro6bKKPjHsiGsN BSuU6Sj3V1ZhoZo+260R/Z7hik6uQ3CeYD6yg7xdSMdGt1Xic6yT3vkMp9fsz4ezuJrm FArg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=DWFm9STu4SMgxftcEWzNblH7UlhhQA8DGOnI+xUOiuM=; b=XaR3jXFbIozMHGyO9tEMWNlChtnl57IElOm4+frYTuDAK5FlGUCpZ3VhxzpQK61+eP 0nzOEmiaiWKMzrNfKo9TKkcgtcOl5LE/bHKh/2T/RuU5/clbQ6nM00WMUl0E/1JQZpsn DJGQyo2LlV6ew+S/DBr9EVHOLGxewquG7C3J+b8WY6a5t3VdX54pFKp7NDyZ6efzzm2H h17UvEnXfM9Ll/XtEcqOwigRqWFMc4DDx6fEDB/13uGqqN3i+evFAg9wiIHeCeC3RDPh zeCcco8BAKnpzZhKFrTD0BZpjcwZG6N2mLp0x+EPeLQZNZjYk8S7k75mHuYeSO9s3NFi d2AQ== X-Gm-Message-State: ACgBeo0Md9DwmOLIkS/G3meZO98gpkIWn5DrCgMO9NPOTE8WNITSqkbq VLlHBOy570bVS5SV8FxgJPwu1kw4r9IVJZyNh9mrFhzIuDj5eQ== X-Google-Smtp-Source: AA6agR7byuZxL6WBoQaf2zZejHenhM+K1P2/3JrB/3Ce5aQmWioh/hpAi7CbBk5M2hZjpp+QxWp12E0e1uU0dujWJj4= X-Received: by 2002:a05:6870:d1d4:b0:12a:f8b5:6bd0 with SMTP id b20-20020a056870d1d400b0012af8b56bd0mr5968978oac.42.1662825224145; Sat, 10 Sep 2022 08:53:44 -0700 (PDT) In-Reply-To: <838rmtelfg.fsf@gnu.org> Received-SPF: pass client-ip=2001:4860:4864:20::33; envelope-from=lumarzeli30@gmail.com; helo=mail-oa1-x33.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:295137 Archived-At: --000000000000cf2f1105e854aad1 Content-Type: multipart/alternative; boundary="000000000000cf2f1005e854aacf" --000000000000cf2f1005e854aacf Content-Type: text/plain; charset="UTF-8" In order to find the "real meat" of the display_line function I started to slowly remove most of the lines of the function as long as it does not break emacs and text can be typed. In the end I was left with this a 20-25 lines function (excluding comments and spaces): (I have attached this function too) static bool display_line (struct it *it, int cursor_vpos) { struct glyph_row *row = it->glyph_row; /* Clear the result glyph row and enable it. */ prepare_desired_row (it->w, row, false); row->y = it->current_y; /* Loop generating characters. The loop is left with IT on the next character to display. */ while (true) { /* Retrieve the next thing to display. Value is false if end of buffer reached. */ if (!get_next_display_element (it)) { break; } PRODUCE_GLYPHS (it); at_end_of_line: /* Is this a line end? If yes, we're also done, after making sure that a non-default face is extended up to the right margin of the window. */ if (ITERATOR_AT_END_OF_LINE_P (it)) { /* Consume the line end. This skips over invisible lines. */ set_iterator_to_next (it, true); break; } set_iterator_to_next (it, true); } /* Compute pixel dimensions of this line. */ compute_line_metrics (it); /* Prepare for the next line. This line starts horizontally at (X HPOS) = (0 0). Vertical positions are incremented. As a convenience for the caller, IT->glyph_row is set to the next row to be used. */ it->current_y += row->height; ++it->glyph_row; return MATRIX_ROW_DISPLAYS_TEXT_P (row); } Obviously most of the things do not work such as bidi, word wrapping, displaying cursor and line numbers but still text is being shown in rows one after the other and it can be scrolled, but now there are no lines mentioning the hpos, the x-coordinate, first_visible_x or last_visible_x, does that mean I do not understand the display_line function? I thought its function was to fill a row with glyphs in the desired matrix to display it on the glass but now I cannot find a line which fills the matrix. You had advised to swap the x and y coordinates, but here there is no x coordinate present! How can the redisplay still work? >> Regrettably my inexperience is causing hurdles therefore any guidance would be a huge help. > Don't give up. And thanks for working on this. Thank you for bearing with me. --000000000000cf2f1005e854aacf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
In order to find the "real meat" of the dis= play_line function I started to slowly remove most of the lines of the
function as long as it does not break emacs and text can be typed.

In the end I was left with this a 20-25 lines fu= nction (excluding comments and spaces):
(I have attached this fun= ction too)

static bool
display_line (struct it = *it, int cursor_vpos)
{
=C2=A0 struct glyph_row *row =3D it->glyph= _row;
=C2=A0
=C2=A0 /* Clear the result glyph row and enable it. =C2= =A0*/
=C2=A0 prepare_desired_row (it->w, row, false);

=C2=A0 r= ow->y =3D it->current_y;
=C2=A0
=C2=A0 /* Loop generating char= acters.=C2=A0 The loop is left with IT on the next
=C2=A0 =C2=A0 =C2=A0c= haracter to display. =C2=A0*/
=C2=A0 while (true)
=C2=A0 =C2=A0 {
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0 =C2=A0 /* Retri= eve the next thing to display.=C2=A0 Value is false if end of
buffer r= eached. =C2=A0*/
=C2=A0 =C2=A0 =C2=A0 if (!get_next_display_element (it)= )
{
=C2=A0break;
}

=C2=A0 =C2=A0 =C2=A0 PRODUCE_GLYPHS = (it);
=C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0 at_end_of_line:
=C2=A0 = =C2=A0 =C2=A0 /* Is this a line end?=C2=A0 If yes, we're also done, aft= er making
sure that a non-default face is extended up to the right
= margin of the window. =C2=A0*/
=C2=A0 =C2=A0 =C2=A0 if (ITERATOR_AT_EN= D_OF_LINE_P (it))
{ =C2=A0
=C2=A0/* Consume the line end.=C2=A0 T= his skips over invisible lines. =C2=A0*/
=C2=A0set_iterator_to_next (i= t, true);
=C2=A0break;
}

=C2=A0 =C2=A0 =C2=A0 set_iterator_= to_next (it, true);
=C2=A0 =C2=A0 }

=C2=A0 /* Compute pixel dimen= sions of this line. =C2=A0*/
=C2=A0 compute_line_metrics (it);

= =C2=A0 /* Prepare for the next line.=C2=A0 This line starts horizontally at= (X
=C2=A0 =C2=A0 =C2=A0HPOS) =3D (0 0).=C2=A0 Vertical positions are in= cremented.=C2=A0 As a
=C2=A0 =C2=A0 =C2=A0convenience for the caller, IT= ->glyph_row is set to the next
=C2=A0 =C2=A0 =C2=A0row to be used. = =C2=A0*/

=C2=A0 it->cu= rrent_y +=3D row->height;
=C2=A0 ++it->glyph_row;
=C2=A0 return= MATRIX_ROW_DISPLAYS_TEXT_P (row);
}

Obviously = most of the things do not work such as bidi, word wrapping, displaying curs= or and line numbers but still text is being shown
in rows one aft= er the other and it can be scrolled, but now there are no lines mentioning = the hpos, the x-coordinate, first_visible_x or
last_visible_= x, does that mean I do not understand the display_line function? I thought = its function was to fill a row with glyphs in the desired matrix
= to display it on the glass but now I cannot find a line which fills the mat= rix. You had advised to swap the x and y coordinates, but here there
<= div>is no x coordinate present! How can the redisplay still work?


>> Regrettably my inexperience=C2=A0 is causing hurdles therefore any= guidance would be a huge help.

> Don't give up.=C2=A0 And thanks for working on this.
Thank you for bearing with me.
--000000000000cf2f1005e854aacf-- --000000000000cf2f1105e854aad1 Content-Type: text/x-csrc; charset="US-ASCII"; name="display.c" Content-Disposition: attachment; filename="display.c" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l7w2x1ut0 c3RhdGljIGJvb2wKZGlzcGxheV9saW5lIChzdHJ1Y3QgaXQgKml0LCBpbnQgY3Vyc29yX3Zwb3Mp CnsKICBzdHJ1Y3QgZ2x5cGhfcm93ICpyb3cgPSBpdC0+Z2x5cGhfcm93OwogCiAgLyogQ2xlYXIg dGhlIHJlc3VsdCBnbHlwaCByb3cgYW5kIGVuYWJsZSBpdC4gICovCiAgcHJlcGFyZV9kZXNpcmVk X3JvdyAoaXQtPncsIHJvdywgZmFsc2UpOwoKICByb3ctPnkgPSBpdC0+Y3VycmVudF95OwogIAog IC8qIExvb3AgZ2VuZXJhdGluZyBjaGFyYWN0ZXJzLiAgVGhlIGxvb3AgaXMgbGVmdCB3aXRoIElU IG9uIHRoZSBuZXh0CiAgICAgY2hhcmFjdGVyIHRvIGRpc3BsYXkuICAqLwogIHdoaWxlICh0cnVl KQogICAgewogICAgICAgICAgICAKICAgICAgLyogUmV0cmlldmUgdGhlIG5leHQgdGhpbmcgdG8g ZGlzcGxheS4gIFZhbHVlIGlzIGZhbHNlIGlmIGVuZCBvZgoJIGJ1ZmZlci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