unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: handa@gnu.org (K. Handa)
Cc: Yuri D'Elia <wavexx@thregr.org>, emacs-devel@gnu.org
Subject: Re: otf ligature rendering support?
Date: Mon, 17 Aug 2015 10:04:13 +0900	[thread overview]
Message-ID: <wloai6n2sy.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <87egrb3ndk.fsf@gnu.org>

>>>>> On Sun, 04 Jan 2015 00:16:55 +0900, handa@gnu.org (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
				mituharu@math.s.chiba-u.ac.jp

(let ((alist '((33 . ".\\(?:\\(?:==\\)\\|[!=]\\)")
 (35 . ".\\(?:[(?[_{]\\)")
 (38 . ".\\(?:\\(?:&&\\)\\|&\\)")
 (42 . ".\\(?:\\(?:\\*\\*\\)\\|[*/]\\)")
 (43 . ".\\(?:\\(?:\\+\\+\\)\\|\\+\\)")
 (45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)")
 (46 . ".\\(?:\\(?:\\.[.<]\\)\\|[.=]\\)")
 (47 . ".\\(?:\\(?:\\*\\*\\|//\\|==\\)\\|[*/=>]\\)")
 (58 . ".\\(?:[:=]\\)")
 (59 . ".\\(?:;\\)")
 (60 . ".\\(?:\\(?:!--\\)\\|\\(?:\\$>\\|\\*>\\|\\+>\\|--\\|<[<=-]\\|=[<=>]\\||>\\)\\|[/<=>|-]\\)")
 (61 . ".\\(?:\\(?:/=\\|:=\\|<<\\|=[=>]\\|>>\\)\\|[<=>~]\\)")
 (62 . ".\\(?:\\(?:=>\\|>[=>-]\\)\\|[=>-]\\)")
 (63 . ".\\(?:[:=?]\\)")
 (92 . ".\\(?:\\(?:\\\\\\\\\\)\\|\\\\\\)")
 (94 . ".\\(?:=\\)")
 (123 . ".\\(?:-\\)")
 (124 . ".\\(?:\\(?:|[=|]\\)\\|[=>|]\\)")
 (126 . ".\\(?:[=@~-]\\)"))
))
  (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")))



  parent reply	other threads:[~2015-08-17  1:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-02 15:25 otf ligature rendering support? Yuri D'Elia
2015-01-03 15:16 ` K. Handa
2015-01-03 16:38   ` Yuri D'Elia
2015-08-17  1:04   ` YAMAMOTO Mitsuharu [this message]
2015-08-17  4:17     ` Stefan Monnier

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=wloai6n2sy.wl%mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    --cc=emacs-devel@gnu.org \
    --cc=handa@gnu.org \
    --cc=wavexx@thregr.org \
    /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).