all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 11860@debbugs.gnu.org, smias@yandex.ru
Subject: bug#11860: 24.1; Arabic - Harakat (diacritics, short vowels) don't appear
Date: Wed, 22 Aug 2012 18:15:05 +0900	[thread overview]
Message-ID: <87txvvguee.fsf@gnu.org> (raw)
In-Reply-To: <83lih8b173.fsf@gnu.org> (message from Eli Zaretskii on Tue, 21 Aug 2012 20:32:32 +0300)

In article <83lih8b173.fsf@gnu.org>, Eli Zaretskii <eliz@gnu.org> writes:

> Well, it turns out that the truth is slightly different.  When the
> Uniscribe shaper is handed a chunk of RTL text with the fLogicalOrder
> flag set to TRUE, it prepares the glyphs in the logical order, but
> assumes that they will be laid out in reverse.  In this reverse order,
> the width advance value is applied _before_ drawing the glyph, and
> positive width advance values move the pen to the _left_.  I found
> this important information on some Web page, which I unfortunately can
> no longer find.

> In addition, it looks like in this "reverse" mode, the X-OFFSET value
> is also interpreted in the reverse direction, so its sign must be
> flipped for glyphs in RTL grapheme clusters.

> Armed with this knowledge, with the information you posted, and after
> studying the drawing code in w32term.c, I made some semi-empirical
> changes in uniscribe_shape that produce good results both with Arabic
> and with Hebrew.  In a nutshell, I adjusted the X-OFFSET values for
> the width of the base-character glyph.  The results are committed as
> trunk revision 109726; as I only tested the modification on a small
> sample of composed texts, please see if you can run more tests with as
> complex compositions as you can find.

As I currently don't have an environment for building Emasc
on Windows, 

> > > If it is correct, then how come the glyphs shown on GNU/Linux also
> > > have non-zero value of xadvance:
> > 
> > >   [0 1 1593 969 8 2 8 4 4 nil]
> > >   [0 1 1618 760 0 -6 -3 8 -11 [-9 2 0]]
> > 
> > Emacs draws the first glyph at its base point and advance
> > the base point 8 pixels to the right (because the WIDTH of
> > the first glyph is 8).  Then Emacs draw the second glyph at
> > 9 pixels left and 2 pixels up from the base point.  So, the
> > second glyph is drawn above the first glyph.

> I see.  This was somewhat counter-intuitive (why move first and then
> correct that by negative offsets, instead of not moving until all the
> glyphs in the cluster are drawn?).

I think it's more intuitive.  It draws glyphs as you write
by hand.  The exact place to draw a dependent vowel depends
on a base consonant.  So, you anyway have to adjust vowel's
base point of drawing.

> > > > For instance, in the above case, we may have to render glyphs in
> > > > this order (diacritical mark first):
> > > > 
> > > >   [0 1 1593 760 0 3 6 12 4 [1 -2 0]]
> > > >   [0 1 1593 969 8 1 8 12 4 nil]
> > 
> > > I tried the naive patch below, but it didn't quite work.  It seems
> > > like those changes somehow prevented character composition.  Perhaps
> > > Handa-san could give me some guidance here.
> > 
> > Did your patch produced the above GSTRING?

> Yes.  But I think swapping the glyphs in the cluster was not the right
> idea, because it violates the assumptions in w32font_draw, the drawing
> routine called by the font back-end.  That routine expects the first
> glyph to be for the base character of the composition.

As far as WIDTH, XOFF, YOFF, WADJUST are correct, the
drawing routines should work even if a combining mark comes
first.  The code that expects the first glyph to be a base
is Ffont_shape_gstring.  If the shaped GSTRING returned from
font->driver->shape has GLYPH sequence "Abc", A's
offset vector [X-OFF Y-OFF WADJUST] is nil, b and c's offset
vectors are not nil, Ffont_shape_gstring assumes that "Abc"
constitutes a grapheme cluster.

Anyway, thank you very much for the patch.  I have not yet
tried it because I currently don't have an environment to
build Emacs on windows.

---
Kenichi Handa
handa@gnu.org





  reply	other threads:[~2012-08-22  9:15 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-04  9:17 bug#11860: 24.1; Arabic - Harakat (diacritics, short vowels) don't appear Steffan
2012-07-04 20:22 ` Eli Zaretskii
2012-07-05 17:53 ` Steffan
2012-08-05  5:27 ` Steffan
2012-08-05 15:49   ` Eli Zaretskii
2012-08-13  0:02     ` Kenichi Handa
2012-08-18  2:45       ` Kenichi Handa
2012-08-18  7:14         ` Eli Zaretskii
2012-08-18  9:19           ` Kenichi Handa
2012-08-18 15:33             ` Eli Zaretskii
2012-08-19  7:32               ` YAMAMOTO Mitsuharu
2012-08-19 12:51                 ` Kenichi Handa
2012-08-19 13:20               ` Kenichi Handa
2012-08-19 18:44                 ` Eli Zaretskii
2012-08-19 18:53                   ` Werner LEMBERG
2012-08-20 17:24                   ` Eli Zaretskii
2012-08-19  3:02             ` Jason Rumney
2012-08-19 13:37               ` Kenichi Handa
2012-08-19 16:16                 ` Jason Rumney
2012-08-19 18:54                   ` Eli Zaretskii
2012-08-20 14:57                     ` Kenichi Handa
2012-08-20 17:16                       ` Eli Zaretskii
2012-08-21  9:20                         ` Kenichi Handa
2012-08-19 18:52                 ` Eli Zaretskii
2012-08-19 17:56               ` Eli Zaretskii
2012-08-19  4:34         ` YAMAMOTO Mitsuharu
2012-09-09  4:06           ` YAMAMOTO Mitsuharu
2012-09-11 14:49             ` Kenichi Handa
2012-09-11 17:48               ` Eli Zaretskii
2012-09-12 13:14                 ` Kenichi Handa
2012-09-12 16:34                   ` Eli Zaretskii
2012-09-13  6:07                     ` Kenichi Handa
2012-09-13 17:00                       ` Eli Zaretskii
2012-09-13 23:26                         ` Kenichi Handa
2012-09-16 12:03               ` Kenichi Handa
2012-09-16 12:41                 ` Eli Zaretskii
2012-09-16 15:43                   ` Stefan Monnier
2012-09-16 15:50                     ` Eli Zaretskii
2012-09-17 14:08                       ` Kenichi Handa
2012-09-17 16:58                         ` Stefan Monnier
2012-08-19 18:22         ` Eli Zaretskii
2012-08-21 13:16           ` Kenichi Handa
2012-08-21 17:32             ` Eli Zaretskii
2012-08-22  9:15               ` Kenichi Handa [this message]
2012-08-22 19:52 ` Steffan
2012-08-23  2:50   ` Eli Zaretskii
2012-08-22 21:40 ` Steffan
2012-08-23  2:49   ` Eli Zaretskii
2012-08-27 21:10 ` Steffan
2012-08-29  8:09   ` Kenichi Handa
2012-09-01 13:59     ` Eli Zaretskii
2012-09-03 13:55       ` Kenichi Handa
2012-09-03 15:53         ` Eli Zaretskii
2012-09-04  9:03           ` Kenichi Handa
2012-08-29  8:57 ` Steffan
2012-09-01 14:06   ` Eli Zaretskii
2012-09-03 15:31 ` Steffan
2012-09-03 16:28   ` Eli Zaretskii
2012-09-04 17:18   ` Eli Zaretskii
2012-09-03 16:24 ` Steffan
2012-09-03 17:49 ` Steffan
2012-09-06  2:09   ` YAMAMOTO Mitsuharu
2012-09-06  8:52 ` Steffan
2012-09-06  9:56   ` YAMAMOTO Mitsuharu
2012-09-06 10:47     ` Eli Zaretskii
2012-09-06 14:52 ` Steffan
2012-09-10 16:13 ` Steffan
2020-08-17 22:45 ` Stefan Kangas
2020-08-18  4:40   ` Eli Zaretskii
2020-08-18  9:47     ` Stefan Kangas
     [not found] <14231341502795@web11e.yandex.ru>
2012-07-05 17:16 ` 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=87txvvguee.fsf@gnu.org \
    --to=handa@gnu.org \
    --cc=11860@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=smias@yandex.ru \
    /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.