emacs-devel
[Top][All Lists]
Advanced

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

Re: otf ligature rendering support?


From: YAMAMOTO Mitsuharu
Subject: Re: otf ligature rendering support?
Date: Mon, 17 Aug 2015 10:04:13 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Sun, 04 Jan 2015 00:16:55 +0900, address@hidden (K. Handa) said:

>> I'm not fully aware of how much otf is supported in emacs, but I
>> found a good reason to want ligatures in a monospaced font:

>> http://www.fsd.it/fonts/pragmatapro/PragmataPro_Haskell_liga.png

>> PragmataPro supports ligatures for a good set of common
>> operators. This makes it much less troublesome than
>> "prettify-symbols-mode" since indentation/spacing is not changed.

>> How would I enable the proper GSUB feature in emacs? Are ligatures
>> supported at all?

> Currently, Emacs can not control which OTF features to apply.  Emacs
> leaves it to font drivers on eash platform.

A user of the Mac port sent me a feature request to display ligatures
like above using Fira Code (https://github.com/tonsky/FiraCode).
Actually the mac-ct font backend driver, which is used in the NS port
as well as the Mac port, already supports ligatures.  So I tried to
activate the use of ligatures with the setting at the bottom of this
mail.  It mostly worked, but occasionally caused an error (which
actually triggers an infinite loop) at the following part in
Fcomposition_get_gstring (src/composite.c):

  1742        if (! STRING_MULTIBYTE (string))
  1743          error ("Attempt to shape unibyte text");

This should also be reproducible on other platforms using the
following example:

  (set-char-table-range composition-function-table ?-
                        '(["--" 0 font-shape-gstring]))

  (setq header-line-format "unibyte text containing \"--\"")

What was the idea behind disallowing text shaping for unibyte strings?
Is it possible to relax this restriction?

                                     YAMAMOTO Mitsuharu
                                address@hidden

(let ((alist '((33 . ".\\(?:\\(?:==\\)\\|[!=]\\)")
 (35 . ".\\(?:[(?[_{]\\)")
 (38 . ".\\(?:\\(?:&&\\)\\|&\\)")
 (42 . ".\\(?:\\(?:\\*\\*\\)\\|[*/]\\)")
 (43 . ".\\(?:\\(?:\\+\\+\\)\\|\\+\\)")
 (45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)")
 (46 . ".\\(?:\\(?:\\.[.<]\\)\\|[.=]\\)")
 (47 . ".\\(?:\\(?:\\*\\*\\|//\\|==\\)\\|[*/=>]\\)")
 (58 . ".\\(?:[:=]\\)")
 (59 . ".\\(?:;\\)")
 (60 . 
".\\(?:\\(?:!--\\)\\|\\(?:\\$>\\|\\*>\\|\\+>\\|--\\|<[<=-]\\|=[<=>]\\||>\\)\\|[/<=>|-]\\)")
 (61 . ".\\(?:\\(?:/=\\|:=\\|<<\\|=[=>]\\|>>\\)\\|[<=>~]\\)")
 (62 . ".\\(?:\\(?:=>\\|>[=>-]\\)\\|[=>-]\\)")
 (63 . ".\\(?:[:=?]\\)")
 (92 . ".\\(?:\\(?:\\\\\\\\\\)\\|\\\\\\)")
 (94 . ".\\(?:=\\)")
 (123 . ".\\(?:-\\)")
 (124 . ".\\(?:\\(?:|[=|]\\)\\|[=>|]\\)")
 (126 . ".\\(?:address@hidden)"))
))
  (dolist (char-regexp alist)
    (set-char-table-range composition-function-table (car char-regexp)
                          `([,(cdr char-regexp) 0 font-shape-gstring]))))

(make-frame '((font . "Fira Code")))



reply via email to

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