emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting compositions to strings


From: Eli Zaretskii
Subject: Re: Converting compositions to strings
Date: Mon, 30 Jan 2017 18:52:00 +0200

> Cc: address@hidden
> From: Clément Pit-Claudel <address@hidden>
> Date: Mon, 30 Jan 2017 11:39:09 -0500
> 
> On 2017-01-30 10:18, Eli Zaretskii wrote:
> > The information about this can be found in the doc strong of 
> > compose-region, under COMPONENTS.
> 
> Thanks.  This covers only "relative" compositions, right? Is there more 
> information on non-relative compositions somewhere?

No, AFAIK this documents both relative and rule-based compositions.

> > The ones that seem to be relevant to what you are looking for (I'm 
> > guessing) are a small class, and I don't think you can discern them 
> > from the others unless you look at the "rules" parts of a 
> > composition.
> 
> Looking at the rules sounds fine; thanks! I think these compositions form a 
> small class in terms of what Emacs supports, but that class seems to most if 
> not all uses of composition that I see in my daily use of Emacs (where are 
> other compositions used, beyond character spacing in what-cursor-position?).
> 
> Based on your pointers, the following seems to work OK for me (I guess it 
> could be extended to cover the (Bl . Br) case, but I haven't seen that pop up 
> yet in practice).
> 
> (defun esh--parse-composition (components)
>   "Translate composition COMPONENTS into a string."
>   (let ((chars (list (aref components 0)))
>         (nrules (/ (length components) 2)))
>     (dotimes (nrule nrules)
>       (let* ((rule (aref components (+ 1 (* 2 nrule))))
>              (char (aref components (+ 2 (* 2 nrule)))))
>         (pcase rule
>           (`(Br . Bl) (push char chars))
>           (_ (error "Unsupported composition COMPONENTS")))))
>     (concat chars)))

I think if we want to be able to produce text with all the text
properties and overlays expressed explicitly as text, we need to write
a back-end for xdisp.c that "displays" to a buffer.  It shouldn't be
hard, the number of interface routines a back-end needs to support is
not large; see 'struct redisplay_interface' in dispextern.h.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]