From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: otf ligature rendering support? Date: Mon, 17 Aug 2015 10:04:13 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <87egrb3ndk.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1439773489 6078 80.91.229.3 (17 Aug 2015 01:04:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Aug 2015 01:04:49 +0000 (UTC) Cc: Yuri D'Elia , emacs-devel@gnu.org To: handa@gnu.org (K. Handa) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 17 03:04:39 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZR8qs-0002MQ-Nx for ged-emacs-devel@m.gmane.org; Mon, 17 Aug 2015 03:04:38 +0200 Original-Received: from localhost ([::1]:53819 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZR8qr-0004WU-KW for ged-emacs-devel@m.gmane.org; Sun, 16 Aug 2015 21:04:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZR8qg-0004WD-Cu for emacs-devel@gnu.org; Sun, 16 Aug 2015 21:04:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZR8qc-0001lf-El for emacs-devel@gnu.org; Sun, 16 Aug 2015 21:04:26 -0400 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:50296) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZR8qb-0001kZ-Tg; Sun, 16 Aug 2015 21:04:22 -0400 Original-Received: from fermat1.math.s.chiba-u.ac.jp (fermat [192.168.32.10]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 848DFC055D; Mon, 17 Aug 2015 10:04:13 +0900 (JST) In-Reply-To: <87egrb3ndk.fsf@gnu.org> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 133.82.132.2 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:188825 Archived-At: >>>>> 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")))