* otf ligature rendering support? @ 2015-01-02 15:25 Yuri D'Elia 2015-01-03 15:16 ` K. Handa 0 siblings, 1 reply; 11+ messages in thread From: Yuri D'Elia @ 2015-01-02 15:25 UTC (permalink / raw) To: emacs-devel Hi everyone, 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? I can specify otf parameters in `font-spec', but the following: (set-fontset-font nil 'latin (font-spec :family "PragmataPro" :otf '(latn nil (liga)))) Doesn't really show any ligatures (or any other otf feature). Am I doing something wrong? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: otf ligature rendering support? 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 0 siblings, 2 replies; 11+ messages in thread From: K. Handa @ 2015-01-03 15:16 UTC (permalink / raw) To: Yuri D'Elia; +Cc: emacs-devel [-- Attachment #1: Type: text/plain, Size: 1584 bytes --] In article <m86d9m$1ii$1@ger.gmane.org>, Yuri D'Elia <wavexx@thregr.org> writes: > 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. I actually tried to give Emacs such facility, and src/font.c contains not-yet-finished code within "#if 0" and "#endif". I want to finish the code, but I'm not sure I can work on it soon. > I can specify otf parameters in `font-spec', but the following: > (set-fontset-font nil 'latin > (font-spec :family "PragmataPro" > :otf '(latn nil (liga)))) > Doesn't really show any ligatures (or any other otf feature). The above just tells Emacs to select such an OTF font that has `liga' GPOS feature for `latn' script. By the way, if you are running Emacs on X with libm17n-flt and libotf libraries, you can override the default behavior of those libraries by putting the attached two files under ~/.m17n.d/. It assumes that the family name of PragmataPro font is "PragmataPro". If that is not the case, please replace "PragmataPro" in generic.fst with a proper family name. --- K. Handa handa@gnu.org [-- Attachment #2: generic.fst --] [-- Type: application/octet-stream, Size: 3825 bytes --] ;; generic.fst -- Fontset mainly using generic font specs. ;; Copyright (C) 2005, 2006, 2007, 2010 AIST (H15PRO112) ;; See the end for copying conditions. ;;; <li> generic.fst ;;; ;;; Fontset mainly using generic font specifications. See the ;;; documentation of the fontset "default" for the information about ;;; each font. (latin (vi ((nil PragmataPro unicode-bmp) combining) ((nil nil unicode-bmp :lang=vi))) (nil ((nil PragmataPro unicode-bmp) combining) ((nil nil unicode-bmp :script=latin)))) (hebrew (nil ((nil nil unicode-bmp :otf=hebr) hebr-otf) ((nil nil unicode-bmp :script=hebrew)))) (arabic (nil ((nil nil unicode-bmp :otf=arab=init,medi,fina,liga+mark) arab-otf) ((nil nil unicode-bmp :otf=arab=init,medi,fina,liga+~mark) arab-otf-no-gpos) ((nil nil unicode-bmp :script=arabic) arab))) (syriac (nil ((nil nil unicode-bmp :otf=syrc) syrc-otf))) (thaana (nil ((nil nil unicode-bmp :otf=thaa) thaa-otf) ((nil nil unicode-bmp :script=thaana)))) (devanagari (nil ((nil nil unicode-bmp :otf=dev2) dev2-otf) ((nil nil unicode-bmp :otf=deva) deva-otf))) (bengali (nil ((nil nil unicode-bmp :otf=bng2) bng2-otf) ((nil nil unicode-bmp :otf=beng) beng-otf))) (gurmukhi (nil ((nil nil unicode-bmp :otf=gur2) gur2-otf) ((nil nil unicode-bmp :otf=guru) guru-otf))) (gujarati (nil ((nil nil unicode-bmp :otf=gjr2) gjr2-otf) ((nil nil unicode-bmp :otf=gujr) gujr-otf))) (oriya (nil ((nil nil unicode-bmp :otf=ory2) ory2-otf) ((nil nil unicode-bmp :otf=orya) orya-otf))) (tamil (nil ((nil nil unicode-bmp :otf=tml2) tml2-otf) ((nil nil unicode-bmp :otf=taml) taml-otf))) (telugu (nil ((nil nil unicode-bmp :otf=tel2) tel2-otf) ((nil nil unicode-bmp :otf=telu) telu-otf))) (kannada (nil ((nil nil unicode-bmp :otf=knd2) knd2-otf) ((nil nil unicode-bmp :otf=knda) knda-otf))) (malayalam (nil ((nil nil unicode-bmp :otf=mlm2) mlm2-otf) ((nil nil unicode-bmp :otf=mlym) mlym-otf))) (sinhala (nil ((nil nil unicode-bmp :otf=sinh) sinh-otf))) (tibetan (nil ((nil nil unicode-bmp :otf=tibt) tibt-otf))) (thai (nil ((nil nil unicode-bmp :otf=thai) thai-otf) ((nil nil unicode-bmp :script=thai) thai-generic))) (lao (nil ((nil nil unicode-bmp :otf=laoo) laoo-otf) ((nil nil unicode-bmp :script=lao) laoo-generic))) (myanmar (nil ((nil padauk unicode-bmp) mymr-sil))) (khmer (nil ((nil nil unicode-bmp :otf=khmr) khmr-otf))) (han (zh ((nil nil unicode-bmp :lang=zh))) (ja ((nil nil unicode-bmp :lang=ja))) (ko ((nil nil unicode-bmp :lang=ko)))) (hiragana (nil ((nil nil unicode-bmp :lang=ja)))) (katakana (nil ((nil nil unicode-bmp :lang=ja)))) (hangul (nil ((nil nil unicode-bmp :lang=ko)))) (cham (nil ((nil nil unicode-bmp :script=cham) cham-generic))) (nil ((nil nil unicode-bmp))) ;; Copyright (C) 2003, 2004, 2007, 2010 ;; National Institute of Advanced Industrial Science and Technology (AIST) ;; Registration Number H15PRO112 ;; This file is part of the m17n database; a sub-part of the m17n ;; library. ;; The m17n library is free software; you can redistribute it and/or ;; modify it under the terms of the GNU Lesser General Public License ;; as published by the Free Software Foundation; either version 2.1 of ;; the License, or (at your option) any later version. ;; The m17n library is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; Lesser General Public License for more details. ;; You should have received a copy of the GNU Lesser General Public ;; License along with the m17n library; if not, write to the Free ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;; Local Variables: ;; mode: lisp ;; End: [-- Attachment #3: COMBINING.flt --] [-- Type: application/octet-stream, Size: 2131 bytes --] ;; COMBINING.flt -- Font Layout Table for combining diacritical marks ;; Copyright (C) 2007 AIST (H15PRO112) ;; See the end for copying conditions. (font layouter combining nil) ;;; <li> COMBINING.flt ;;; ;;; For combining diacritical marsk (U+0300..U+036F). (category ;; The contents is build up by the m17n-lib. ) (generator (0 (cond ("(u)([a-t]+)" (cond ((font-facility :otf=DFLT=liga) < :otf=DFLT=liga >) ((font-facility :otf=DFLT+mark) < :otf=DFLT+mark,mkmk >) (".*" < = ; combining class (cond ("a" Bc.Bc =) ; < 200 ("b" bl.tc =) ; 200 ("c" bc.tc =) ; 202 ("d" br.tc =) ; 204 ("e" Bl.Br =) ; 208 ("f" Br.Bl =) ; 210 ("g" tl.bc =) ; 212 ("h" tc.bc =) ; 214 ("i" tr.bc =) ; 216 ("j" bl.tc =) ; 218 ("k" bc-tc =) ; 220 ("l" br-tc =) ; 222 ("m" Bl.Br =) ; 224 ("n" Br.Bl =) ; 226 ("o" tl+bc =) ; 228 ("p" tc+bc =) ; 230 ("q" tr+bc =) ; 232 ("r" br-tr =) ; 233 ("s" tr+br =) ; 234 ("t" bc-tc =)) ; 240 * >))) ("[a-t]" [ = ]) ("." =)) *)) ;; Copyright (C) 2007 ;; National Institute of Advanced Industrial Science and Technology (AIST) ;; Registration Number H15PRO112 ;; This file is part of the m17n database; a sub-part of the m17n ;; library. ;; The m17n library is free software; you can redistribute it and/or ;; modify it under the terms of the GNU Lesser General Public License ;; as published by the Free Software Foundation; either version 2.1 of ;; the License, or (at your option) any later version. ;; The m17n library is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; Lesser General Public License for more details. ;; You should have received a copy of the GNU Lesser General Public ;; License along with the m17n library; if not, write to the Free ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;; Local Variables: ;; mode: emacs-lisp ;; End: ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: otf ligature rendering support? 2015-01-03 15:16 ` K. Handa @ 2015-01-03 16:38 ` Yuri D'Elia 2015-08-17 1:04 ` YAMAMOTO Mitsuharu 1 sibling, 0 replies; 11+ messages in thread From: Yuri D'Elia @ 2015-01-03 16:38 UTC (permalink / raw) To: emacs-devel On 01/03/2015 04:16 PM, K. Handa wrote: > Currently, Emacs can not control which OTF features to apply. Emacs > leaves it to font drivers on eash platform. I actually tried to give > Emacs such facility, and src/font.c contains not-yet-finished code > within "#if 0" and "#endif". > > I want to finish the code, but I'm not sure I can work on it soon. So this means that OTF features are supported, but not directly user controllable yet? > By the way, if you are running Emacs on X with libm17n-flt and libotf > libraries, you can override the default behavior of those libraries > by putting the attached two files under ~/.m17n.d/. It assumes that > the family name of PragmataPro font is "PragmataPro". If that is not > the case, please replace "PragmataPro" in generic.fst with a proper > family name. I'm using debian unstable with 24.4.1, m17n is enabled and m17n-db. It doesn't look like ~/.m17n.d/ is ever read (I tried to run emacs through strace). It's stat(2)-ed a couple of times, and that's it. I tried to use m17n-edit, and it tries to read a couple of unexisting files in ~/.m17n.d/, but not generic.fst/COMBINING.flt ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: otf ligature rendering support? 2015-01-03 15:16 ` K. Handa 2015-01-03 16:38 ` Yuri D'Elia @ 2015-08-17 1:04 ` YAMAMOTO Mitsuharu 2015-08-17 4:17 ` Stefan Monnier 1 sibling, 1 reply; 11+ messages in thread From: YAMAMOTO Mitsuharu @ 2015-08-17 1:04 UTC (permalink / raw) To: K. Handa; +Cc: Yuri D'Elia, emacs-devel >>>>> 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"))) ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: otf ligature rendering support? 2015-08-17 1:04 ` YAMAMOTO Mitsuharu @ 2015-08-17 4:17 ` Stefan Monnier 0 siblings, 0 replies; 11+ messages in thread From: Stefan Monnier @ 2015-08-17 4:17 UTC (permalink / raw) To: YAMAMOTO Mitsuharu; +Cc: Yuri D'Elia, K. Handa, emacs-devel > What was the idea behind disallowing text shaping for unibyte strings? Probably a simple kind of sanity check, based on he assumption that this code is only used for those scripts that need shaping. Stefan ^ permalink raw reply [flat|nested] 11+ messages in thread
* otf ligature rendering support? @ 2015-01-02 15:32 Yuri D'Elia 2015-01-02 15:45 ` Eli Zaretskii 0 siblings, 1 reply; 11+ messages in thread From: Yuri D'Elia @ 2015-01-02 15:32 UTC (permalink / raw) To: help-gnu-emacs Hi everyone, 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? I can specify otf parameters in `font-spec', but the following: (set-fontset-font nil 'latin (font-spec :family "PragmataPro" :otf '(latn nil (liga)))) Doesn't really show any ligatures (or any other otf feature). Am I doing something wrong? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: otf ligature rendering support? 2015-01-02 15:32 Yuri D'Elia @ 2015-01-02 15:45 ` Eli Zaretskii 2015-01-02 16:00 ` Yuri D'Elia 0 siblings, 1 reply; 11+ messages in thread From: Eli Zaretskii @ 2015-01-02 15:45 UTC (permalink / raw) To: help-gnu-emacs > From: Yuri D'Elia <wavexx@thregr.org> > Date: Fri, 02 Jan 2015 16:32:31 +0100 > > 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? > > I can specify otf parameters in `font-spec', but the following: > > (set-fontset-font nil 'latin > (font-spec :family "PragmataPro" > :otf '(latn nil (liga)))) > > Doesn't really show any ligatures (or any other otf feature). > Am I doing something wrong? I think you need to define rules for composing characters into ligatures, in order to have what you want. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: otf ligature rendering support? 2015-01-02 15:45 ` Eli Zaretskii @ 2015-01-02 16:00 ` Yuri D'Elia 2015-01-02 16:07 ` Eli Zaretskii 0 siblings, 1 reply; 11+ messages in thread From: Yuri D'Elia @ 2015-01-02 16:00 UTC (permalink / raw) To: help-gnu-emacs On 01/02/2015 04:45 PM, Eli Zaretskii wrote: >> 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? >> >> I can specify otf parameters in `font-spec', but the following: >> >> (set-fontset-font nil 'latin >> (font-spec :family "PragmataPro" >> :otf '(latn nil (liga)))) >> >> Doesn't really show any ligatures (or any other otf feature). >> Am I doing something wrong? > > I think you need to define rules for composing characters into > ligatures, in order to have what you want. This is different than composition of unicode ligatures. OTF ligatures are an inherent property of the font along with kerning tables. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: otf ligature rendering support? 2015-01-02 16:00 ` Yuri D'Elia @ 2015-01-02 16:07 ` Eli Zaretskii 2015-01-03 10:44 ` Yuri D'Elia 0 siblings, 1 reply; 11+ messages in thread From: Eli Zaretskii @ 2015-01-02 16:07 UTC (permalink / raw) To: help-gnu-emacs > From: Yuri D'Elia <wavexx@thregr.org> > Date: Fri, 02 Jan 2015 17:00:31 +0100 > > > I think you need to define rules for composing characters into > > ligatures, in order to have what you want. > > This is different than composition of unicode ligatures. > OTF ligatures are an inherent property of the font along with kerning > tables. I'm probably missing something, and I'm certainly not an expert on OTF fonts, in Emacs or elsewhere. But if what you want is display several characters as a single glyph, the way to do that in Emacs is define composition rules. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: otf ligature rendering support? 2015-01-02 16:07 ` Eli Zaretskii @ 2015-01-03 10:44 ` Yuri D'Elia 2015-01-03 11:22 ` Eli Zaretskii 0 siblings, 1 reply; 11+ messages in thread From: Yuri D'Elia @ 2015-01-03 10:44 UTC (permalink / raw) To: help-gnu-emacs On 01/02/2015 05:07 PM, Eli Zaretskii wrote: >> From: Yuri D'Elia <wavexx@thregr.org> >> Date: Fri, 02 Jan 2015 17:00:31 +0100 >> >>> I think you need to define rules for composing characters into >>> ligatures, in order to have what you want. >> >> This is different than composition of unicode ligatures. >> OTF ligatures are an inherent property of the font along with kerning >> tables. > > I'm probably missing something, and I'm certainly not an expert on OTF > fonts, in Emacs or elsewhere. But if what you want is display several > characters as a single glyph, the way to do that in Emacs is define > composition rules. Composition generates at most a sequence of precomposed utf code points, such as æ. This is done at the client level and is font-agnostic. OTF ligatures instead are glypt replacement tables which are provided for a sequence of characters in the font itself. This is mostly needed to improve the rendering for languages such as arabic. The issue is that it needs special support in the client, since previously drawn glypts might change as a result of typing. I was under the impression that ligatures were supported by looking at `fontset.el'. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: otf ligature rendering support? 2015-01-03 10:44 ` Yuri D'Elia @ 2015-01-03 11:22 ` Eli Zaretskii 0 siblings, 0 replies; 11+ messages in thread From: Eli Zaretskii @ 2015-01-03 11:22 UTC (permalink / raw) To: help-gnu-emacs > From: Yuri D'Elia <wavexx@thregr.org> > Date: Sat, 03 Jan 2015 11:44:25 +0100 > > OTF ligatures instead are glypt replacement tables which are provided > for a sequence of characters in the font itself. This is mostly needed > to improve the rendering for languages such as arabic. But then the OTF font driver should tell Emacs about this situation. Is your Emacs compiled with libotf and libm17n-flt? That's how Emacs supports Arabic and other complex scripts. Do you see Arabic ligature shaping when Emacs displays Arabic text? ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-08-17 4:17 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2015-08-17 4:17 ` Stefan Monnier -- strict thread matches above, loose matches on Subject: below -- 2015-01-02 15:32 Yuri D'Elia 2015-01-02 15:45 ` Eli Zaretskii 2015-01-02 16:00 ` Yuri D'Elia 2015-01-02 16:07 ` Eli Zaretskii 2015-01-03 10:44 ` Yuri D'Elia 2015-01-03 11:22 ` Eli Zaretskii
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.