all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kai Ma <justksqsf@gmail.com>
To: Robert Pluim <rpluim@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 55319@debbugs.gnu.org
Subject: bug#55319: 28.1.50; Abugida not rendered correctly (MacOS)
Date: Thu, 12 May 2022 16:26:49 +0800	[thread overview]
Message-ID: <56617540-B9BC-4769-BE87-24935CBAA99C@gmail.com> (raw)
In-Reply-To: <87zgjn41db.fsf@gmail.com>



> On May 12, 2022, at 16:10, Robert Pluim <rpluim@gmail.com> wrote:
> 
>>>>>> On Wed, 11 May 2022 23:43:36 +0800, Kai Ma <justksqsf@gmail.com> said:
> 
>>> On May 9, 2022, at 10:38, Eli Zaretskii <eliz@gnu.org <mailto:eliz@gnu.org>> wrote:
>>> 
>>> Emacs doesn't discover composition rules. The composition rules are
>>> part of the Emacs code, see the various *.el files in lisp/language/
>>> directory. Some of these composition rules are derived automatically
>>> from character properties, see composite.el and characters.el (which
>>> cannot happen without Emacs knowing up-front about the properties).
> 
>    Kai> Thanks for this. I didn’t know Emacs needed to manually compose characters.
> 
>    Kai> Feel free to close this report, since it is due to my misunderstanding, not a real problem nor a real “wishlist”.
> 
>    Kai> BTW,
> 
>    Kai> I did try to follow language/*.el, and come with up the following code:
> 
>    Kai> (let* ((c "[\uED80-\uED9F]\\|\uEDAA\\|\uEDAB”) ; constant
> 
> ie: "[\uED80-\uED9F\uEDAA\uEDAB]”
> 
>    Kai>        (v "[\uEDA0-\uEDA9]”) ; vowel
>    Kai>        (cv (concat v c)))
> 
> You've called this 'cv', but itʼs actually 'vc'.
> 
>    Kai>   (set-char-table-range
>    Kai>    composition-function-table '(#xeda0 . #xeda9)
>    Kai>    (list 
>    Kai>     (vector cv 1 #'zbalermorna-shape-gstring)
>    Kai>     [nil 0 font-shape-gstring])))
> 
> Youʼre looking back from vowels, it might be easier to add entries for
> the consonants and look forward.
> 
>    Kai> (defun zbalermorna-shape-gstring (gstring direction)
>    Kai>   (message "shape %s" gstring) ; debugging
>    Kai>   gstring)
> 
>    Kai> But it doesn’t work as expected. For example, “ka” should be
>    Kai> composed, but the behavior here is “a” itself is composed,
>    Kai> and when the first rule is matched, only the consonant “k” is
>    Kai> sent to font-shape-gstring: only “k” is in the header.
> 
>    Kai> Have you any pointers? Thanks!
> 
> I think if you fix 'cv' this will work.

Thanks. I’ve got it work.

Besides the pattern problem, there were two missing pieces:
(1) canonical-combining-class, and 
(2) `compose-'  to actually compose it into one glyph. `font-shape-gstring' alone does not work.


This is the result:

(defun zbalermorna-setup ()
  "Set up the composition rules for zbalermonrna."
  (interactive)

  (dolist (v (number-sequence #xeda0 #xeda9))
    (put-char-code-property v 'canonical-combining-class (encode-composition-rule '(tc . bc))))

  (let* ((c "\\([\uED80-\uED97]\\|\uEDAA\\|\uEDAB\\)")
         (v "[\uEDA0-\uEDA9]")
         (dot "\uED89")
         (h "\uED8A")
         (pattern1 (concat c v))
         (pattern2 (concat v h v)))
    (set-char-table-range
     composition-function-table '(#xeda0 . #xeda9)
     (list (vector pattern2 2 #'compose-gstring-for-graphic)
           (vector pattern1 1 #'compose-gstring-for-graphic)
           [nil 0 font-shape-gstring]))))






  reply	other threads:[~2022-05-12  8:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-08 11:45 bug#55319: 28.1.50; Abugida not rendered correctly (MacOS) Kai Ma
2022-05-08 16:57 ` Eli Zaretskii
2022-05-09  1:43   ` Kai Ma
2022-05-09  2:38     ` Eli Zaretskii
2022-05-11 15:43       ` Kai Ma
2022-05-11 16:12         ` Eli Zaretskii
2022-05-12  8:10         ` Robert Pluim
2022-05-12  8:26           ` Kai Ma [this message]
2022-05-12  8:36             ` Robert Pluim
2022-05-12  9:37               ` Eli Zaretskii
2022-05-12  9:42                 ` Robert Pluim
2022-05-12  9:54                   ` 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=56617540-B9BC-4769-BE87-24935CBAA99C@gmail.com \
    --to=justksqsf@gmail.com \
    --cc=55319@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=rpluim@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 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.