From: Eli Zaretskii <eliz@gnu.org>
To: Keith David Bershatsky <esq@lawlist.com>
Cc: emacs-devel@gnu.org
Subject: Re: IT testing for multiple characters (ִרֹ) that occupy 1 display string.
Date: Mon, 01 Oct 2018 09:35:29 +0300 [thread overview]
Message-ID: <83d0su41ji.fsf@gnu.org> (raw)
In-Reply-To: <m2in2mplpv.wl%esq@lawlist.com> (message from Keith David Bershatsky on Sun, 30 Sep 2018 17:14:04 -0700)
> Date: Sun, 30 Sep 2018 17:14:04 -0700
> From: Keith David Bershatsky <esq@lawlist.com>
>
> When using move_it_in_display_line_to, ִרֹ is treated as one display string; however, it is 3 different characters occupying 3 HPOS. it->c only reports 1460.
>
> I initially guessed that this was a composition situation, however, it.what returns a 0, which is the same as any other regular character.
It is definitely a composition, but you've put the individual
codepoints in the wrong order, at least in your email. The correct
order should be: first u+05e8, the base character, and after that
u+5b4 (1460 decimal) and u+5b9, in any order.
Here's what Emacs reports about this composition on my system:
position: 1 of 3 (0%), column: 0
character: ר (displayed as ר) (codepoint 1512, #o2750, #x5e8)
preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0x05E8
script: hebrew
syntax: w which means: word
category: .:Base, R:Right-to-left (strong)
to input: type "C-x 8 RET 5e8" or "C-x 8 RET HEBREW LETTER RESH"
buffer code: #xD7 #xA8
file code: not encodable by coding system iso-latin-1-dos
display: composed to form "רִֹ" (see below)
Composed with the following character(s) "ִֹ" using this font:
uniscribe:-outline-Courier New-normal-normal-normal-mono-13-*-*-*-c-*-iso10646-1
by these glyphs:
[0 2 1512 696 8 1 6 6 0 nil]
[0 2 1465 662 8 4 5 8 -7 [-9 0 0]]
[0 2 1460 657 8 4 5 -1 2 [-9 0 0]]
> Q: How do we test for this situation, so that we know all of the different characters and each of their individual pixel widths?
If I put a breakpoint in move_it_in_display_line_to, at or after the
call to PRODUCE_GLYPHS, I see a composition:
(gdb) p it->what
$2 = IT_COMPOSITION
(gdb) p it->c
$3 = 1512
(gdb) p it->cmp_it
$4 = {
stop_pos = 1,
id = 0,
ch = 1465,
rule_idx = 2,
lookback = 1,
nglyphs = 3,
reversed_p = false,
charpos = 1,
nchars = 3,
nbytes = 6,
from = 0,
to = 3,
width = 1
}
The nchars and nbytes members of the cmp_it structure clearly show
that Emacs composes 3 characters whose combined length in the internal
buffer representation is 6 bytes.
You didn't tell how and where you took the iterator information, so I
don't know why this didn't look like a composition to you. Maybe you
had the codepoints in the wrong order, like in your mail, in which
case the u+5b4 character will indeed not compose with the other 2.
As for knowing how many pixels this composed character takes -- the
answer as the same as with any other display element: you subtract the
X coordinate (it->current_x) before the glyph from the X coordinate
after it.
next prev parent reply other threads:[~2018-10-01 6:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-01 0:14 IT testing for multiple characters (ִרֹ) that occupy 1 display string Keith David Bershatsky
2018-10-01 6:35 ` Eli Zaretskii [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-10-01 20:45 Keith David Bershatsky
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=83d0su41ji.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=esq@lawlist.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).