unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "समीर सिंह Sameer Singh" <lumarzeli30@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Implementing Vertical Text support in Emacs
Date: Thu, 24 Nov 2022 13:39:24 +0200	[thread overview]
Message-ID: <83mt8gwphv.fsf@gnu.org> (raw)
In-Reply-To: <CAOR1sLw3is-54mJv08hOyOZftk3uQAFpE7t_c+1zfM7xZYLqvQ@mail.gmail.com> (message from समीर सिंह Sameer Singh on Sun, 20 Nov 2022 17:38:05 +0530)

> From: समीर सिंह Sameer Singh <lumarzeli30@gmail.com>
> Date: Sun, 20 Nov 2022 17:38:05 +0530
> Cc: emacs-devel@gnu.org
> 
>  I'm not sure I understand the question.  Are you saying that if you ignore
>  the line overflow, termination of a line, etc., you can write code that does
>  display characters column-wise?
> 
> I thought that displaying line row wise is the "base" of the display_line function with code for
> line truncation, overflow, bidi etc added on top of it in "if" blocks

That is basically correct.

> so if I could just get the base to work (i.e.  displaying lines in a
> column) then I could work on the the finer details.  Am I wrong?

No, you are not wrong.  But the base of display_line is very simple:

  prepare_desired_row (it->w, row, false);

  row->y = it->current_y;
  row->start = it->start;
  row->continuation_lines_width = it->continuation_lines_width;
  row->displays_text_p = true;
  row->starts_in_middle_of_char_p = it->starts_in_middle_of_char_p;
  it->starts_in_middle_of_char_p = false;
  it->stretch_adjust = 0;
  row->ascent = it->max_ascent;
  row->height = it->max_ascent + it->max_descent;
  row->phys_ascent = it->max_phys_ascent;
  row->phys_height = it->max_phys_ascent + it->max_phys_descent;
  row->extra_line_spacing = it->max_extra_line_spacing;
  while (true)
    {
      if (!get_next_display_element (it))
	{
	  row->ends_at_zv_p = true;
	  break;
	}

      PRODUCE_GLYPHS (it);
      if (/* Not a newline.  */
	  nglyphs > 0
	  /* Glyphs produced fit entirely in the line.  */
	  && it->current_x < it->last_visible_x)
	{
	  it->hpos += nglyphs;
	  row->ascent = max (row->ascent, it->max_ascent);
	  row->height = max (row->height, it->max_ascent + it->max_descent);
	  row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent);
	  row->phys_height = max (row->phys_height,
				  it->max_phys_ascent + it->max_phys_descent);
	}
      else
	{
	  ++it->hpos;
	  row->ascent = max (row->ascent, it->max_ascent);
	  row->height = max (row->height, it->max_ascent + it->max_descent);
	  row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent);
	  row->phys_height = max (row->phys_height,
				  it->max_phys_ascent + it->max_phys_descent);
	  row->extra_line_spacing = max (row->extra_line_spacing,
					 it->max_extra_line_spacing);
	}
      if (ITERATOR_AT_END_OF_LINE_P (it))
	{
	  /* Add a space at the end of the line that is used to
	     display the cursor there.  */
	  if (!IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
	    append_space_for_newline (it, false);

	  /* Extend the face to the end of the line.  */
	  extend_face_to_end_of_line (it);

	  /* Consume the line end.  This skips over invisible lines.  */
	  set_iterator_to_next (it, true);
	  it->continuation_lines_width = 0;
	  break;
	}
    }
  compute_line_metrics (it);

Basically, it loops calling get_next_display_element, then PRODUCE_GLYPHS,
and then set_iterator_to_next.



      reply	other threads:[~2022-11-24 11:39 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
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 [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83mt8gwphv.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=lumarzeli30@gmail.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.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).