all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "समीर सिंह Sameer Singh" <lumarzeli30@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Implementing Vertical Text support in Emacs
Date: Sat, 10 Sep 2022 21:23:32 +0530	[thread overview]
Message-ID: <CAOR1sLxAVQwsrxr8yJjVOwyV4oALERMOa9i9+P-pLW+iGsgD2A@mail.gmail.com> (raw)
In-Reply-To: <838rmtelfg.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 2410 bytes --]

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.

[-- Attachment #1.2: Type: text/html, Size: 3063 bytes --]

[-- Attachment #2: display.c --]
[-- Type: text/x-csrc, Size: 1331 bytes --]

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);
}

  reply	other threads:[~2022-09-10 15:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13 15:29 Implementing Vertical Text support in Emacs समीर सिंह Sameer Singh
2022-06-13 16:16 ` [External] : " Drew Adams
2022-06-13 16:30 ` Eli Zaretskii
2022-06-15 10:08   ` Richard Stallman
2022-06-15 10:22     ` Po Lu
2022-06-15 11:09       ` समीर सिंह Sameer Singh
2022-06-16 22:48         ` Richard Stallman
2022-06-17  1:43           ` समीर सिंह Sameer Singh
2022-06-17  6:12             ` Eli Zaretskii
2022-09-08 18:44               ` समीर सिंह Sameer Singh
2022-09-08 19:05                 ` Eli Zaretskii
2022-09-10 15:53                   ` समीर सिंह Sameer Singh [this message]
2022-09-10 16:17                     ` Eli Zaretskii
2022-09-29 19:57                       ` समीर सिंह Sameer Singh
2022-09-30  6:30                         ` Eli Zaretskii
2022-11-20 11:18                           ` समीर सिंह Sameer Singh
2022-11-20 11:43                             ` Eli Zaretskii
2022-11-20 12:08                               ` समीर सिंह Sameer Singh
2022-11-24 11:39                                 ` Eli Zaretskii

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=CAOR1sLxAVQwsrxr8yJjVOwyV4oALERMOa9i9+P-pLW+iGsgD2A@mail.gmail.com \
    --to=lumarzeli30@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.