unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: valizadeh.ho@gmail.com, 41005@debbugs.gnu.org, nicholasdrozd@gmail.com
Subject: bug#41005: problem with rendering Persian text in Emacs 27
Date: Sat, 06 Jun 2020 09:11:36 +0000	[thread overview]
Message-ID: <875zc4zhh3.fsf@gmail.com> (raw)
In-Reply-To: <831rmsa7ln.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 06 Jun 2020 12:04:04 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Pip Cet <pipcet@gmail.com>
>> Cc: valizadeh.ho@gmail.com,  41005@debbugs.gnu.org,  nicholasdrozd@gmail.com
>> Date: Sat, 06 Jun 2020 08:38:39 +0000
>> 
>> >> Given these two bugs, I wonder whether it wouldn't be more reasonable
>> >> always to let HarfBuzz guess the direction, at least for Emacs-27:
                                                  ~~~~~~~~~~~~~~~~~~~~~

I should have been clearer here and said I was only concerned with Emacs 27.

>> >> scripts which change direction, if they are supported by HarfBuzz, won't
>> >> work anyway.
>> >
>> > Please explain "scripts that change direction" and "won't work
>> > anyway", I don't think I understand that part.
>> 
>> I think your example (RLO..PDF in RTL text) is better: that won't work
>> anyway, right now, because if, for example, you type
>> 
>> <HEBREW LETTER SHIN> <RIGHT-TO-LEFT OVERRIDE> f i
>> 
>> and have set the char table to treat "fi" as a ligature, the result will
>> (at least sometimes) be an "fi" ligature, but it should look like the
>> word "if".
>
> That's not how shaping engines work, at least not how HarfBuzz does
> AFAIU.  It gets the characters in the logical order, so it always
> wants to see "fi", even if the directionality of the characters was
> overridden, and it also wants to know the local text directionality.
> What is produced from that depends on the font: if it has different
> ligatures for "fi" in different directions, then HarfBuzz should give
> us back the ligature appropriate for the direction it was passed.
>
> (Personally, I think that when some text uses a directional override,
> they don't intend to see ligatures, because the override is mostly for
> treating characters as independent of the surrounding context.  But
> this is eventually up to the font to specify.  AFAIU, Arabic shaping
> works differently in different directional contexts, for example.)
>
>> > The reason we don't let HarfBuzz guess in all cases is because the
>> > resolved bidi level, when we have it, is a more accurate indication of
>> > the required direction.
>> 
>> Yes, but we'll still cache the wrong direction.
>
> Why "wrong"?  We will cache the same direction as we passed to
> HarfBuzz, and thus the produced glyphs will be consistent with the
> cached direction.  And if we ever need to display the same sequence of
> characters with a different direction, the cached sequence will fail
> to match, and we will call HarfBuzz again to produce glyphs for this
> other direction.  That sounds TRT to me.

You're absolutely correct, sorry for wasting so much of your time with
this: caching directions is the right thing, I was just concerned about
what to do in Emacs 27 where AIUI we don't want to cache directions...

> Once the caching of direction is
> implemented, my point is that passing the direction to HarfBuzz and
> caching it will produce better results for text in a directional
> override than if we let HarfBuzz guess the direction.

Again, I agree. Sorry for the misunderstanding.





  reply	other threads:[~2020-06-06  9:11 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 18:02 bug#41005: problem with rendering Persian text in Emacs 27 hossein valizadeh
2020-05-01 18:51 ` Eli Zaretskii
     [not found]   ` <CAMyfNNp7FiFgAN5EVcVauawiy8ZB7U+eKY7qOeqZOnbMQfs5iQ@mail.gmail.com>
2020-06-03 14:34     ` Eli Zaretskii
2020-06-03 17:24 ` Nicholas Drozd
2020-06-03 18:01   ` Eli Zaretskii
2020-06-04  2:39     ` hossein valizadeh
2020-06-04  3:01       ` hossein valizadeh
2020-06-04  4:01         ` Eli Zaretskii
2020-06-04  4:10           ` Eli Zaretskii
2020-06-04  6:27             ` hossein valizadeh
2020-06-04  8:28               ` Pip Cet
2020-06-04 13:15                 ` Eli Zaretskii
2020-06-04 19:52                   ` Pip Cet
2020-06-05  4:46                     ` hossein valizadeh
2020-06-05  6:21                       ` Eli Zaretskii
2020-06-05 11:07                         ` Basil L. Contovounesios
2020-06-05 12:32                         ` hossein valizadeh
2020-06-05 12:53                           ` Eli Zaretskii
2020-06-05 13:05                             ` Pip Cet
2020-06-05 14:13                               ` Eli Zaretskii
2020-06-06  8:38                                 ` Pip Cet
2020-06-06  9:04                                   ` Eli Zaretskii
2020-06-06  9:11                                     ` Pip Cet [this message]
2020-06-06  9:24                                       ` Eli Zaretskii
2020-06-06 13:09                                         ` Pip Cet
2020-06-05 14:23                               ` hossein valizadeh
2020-06-05 14:25                                 ` Eli Zaretskii
2020-06-05  6:39                       ` Pip Cet
2020-06-05  8:01                     ` Eli Zaretskii
2020-06-05  8:41                       ` Pip Cet
2020-06-05 11:42                         ` Eli Zaretskii
2020-07-21 12:40                           ` Amin Bandali
2020-07-21 13:34                             ` Robert Pluim
2020-07-21 17:53                               ` Amin Bandali
2020-07-21 18:27                                 ` Eli Zaretskii
2020-07-22  2:12                                   ` Amin Bandali
2020-07-22 14:20                                     ` Eli Zaretskii
2020-07-24  4:11                                       ` Amin Bandali
2020-07-24  6:09                                         ` Eli Zaretskii
2020-07-25  4:19                                           ` Amin Bandali
2020-07-25  6:48                                             ` Eli Zaretskii
2020-07-25 15:53                                               ` Amin Bandali
2020-07-25 16:28                                                 ` Eli Zaretskii
2020-07-25 16:44                                                   ` Amin Bandali
2020-07-25 16:56                                                     ` 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

  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=875zc4zhh3.fsf@gmail.com \
    --to=pipcet@gmail.com \
    --cc=41005@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=nicholasdrozd@gmail.com \
    --cc=valizadeh.ho@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).