ligature.el
ligature.el copied to clipboard
Only the right side of wide PragmataPro ligatures are displaying
On the left is buffer visiting my init file and right is buffer visiting a Python file.
Settings are
(ligature-set-ligatures 'prog-mode '("[ERROR]" "[DEBUG]" "[INFO]" "[WARN]" "[WARNING]" "[ERR]" "[FATAL]" "[TRACE]" "[FIXME]" "[TODO]" "[BUG]" "[NOTE]" "[HACK]" "[MARK]" "# ERROR" "# DEBUG" "# INFO" "# WARN" "# WARNING" "# ERR" "# FATAL" "# TRACE" "# FIXME" "# TODO" "# BUG" "# NOTE" "# HACK" "# MARK" "// ERROR" "// DEBUG" "// INFO" "// WARN" "// WARNING" "// ERR" "// FATAL" "// TRACE" "// FIXME" "// TODO" "// BUG" "// NOTE" "// HACK" "// MARK" "!!" "!=" "!==" "!!!" "!≡" "!≡≡" "!>" "!=<" "#(" "#_" "#{" "#?" "#>" "##" "#_(" "%=" "%>" "%>%" "%<%" "&%" "&&" "&*" "&+" "&-" "&/" "&=" "&&&" "&>" "$>" "***" "*=" "*/" "*>" "++" "+++" "+=" "+>" "++=" "--" "-<" "-<<" "-=" "->" "->>" "---" "-->" "-+-" "-\\/" "-|>" "-<|" ".." "..." "..<" ".>" ".~" ".=" "/*" "//" "/>" "/=" "/==" "///" "/**" ":::" "::" ":=" ":≡" ":>" ":=>" ":(" ":-(" ":)" ":-)" ":/" ":\\" ":3" ":D" ":P" ":>:" ":<:" "<$>" "<*" "<*>" "<+>" "<-" "<<" "<<<" "<<=" "<=" "<=>" "<>" "<|>" "<<-" "<|" "<=<" "<~" "<~~" "<<~" "<$" "<+" "<!>" "<@>" "<#>" "<%>" "<^>" "<&>" "<?>" "<.>" "</>" "<\\>" "<\">" "<:>" "<~>" "<**>" "<<^" "<!" "<@" "<#" "<%" "<^" "<&" "<?" "<." "</" "<\\" "<\"" "<:" "<->" "<!--" "<--" "<~<" "<==>" "<|-" "<<|" "<-<" "<-->" "<<==" "<==" "=<<" "==" "===" "==>" "=>" "=~" "=>>" "=/=" "=~=" "==>>" "≡≡" "≡≡≡" "≡:≡" ">-" ">=" ">>" ">>-" ">>=" ">>>" ">=>" ">>^" ">>|" ">!=" ">->" "??" "?~" "?=" "?>" "???" "?." "^=" "^." "^?" "^.." "^<<" "^>>" "^>" "\\\\" "\\>" "\\/-" "@>" "|=" "||" "|>" "|||" "|+|" "|->" "|-->" "|=>" "|==>" "|>-" "|<<" "||>" "|>>" "|-" "||-" "~=" "~>" "~~>" "~>>" "[[" "]]" "\">" "_|_"))
Some word ligatures are not displaying at all. Some are clipped.
A similar issue occurs when I enable PragmataPro ligatures via a different package, but while that enables all ligatures to display, it results in all of them being clipped to the last few columns. Your package allows the first few words to display properly.
Spacemacs v.0.3 with GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4) of 2021-10-09
ligature.el just communicates with the underlying composition table mechanism in Emacs so it's possible the issue is in Emacs.
Does the ligature display correctly if you only configure your ligature settings with the broken one?
@mickeynp Thank you for your response. Digging around it may be a problem with enabling Cairo support so I did submit an Emacs bug report with the steps:
- run command "emacs -Q"
- M-:
- (set-frame-font "PragmataPro Mono Liga" nil t)
- C-uC-u<SPC>
- M-x
- insert-char #Xe2c0
- Repeat 4-6 substituting #Xe2c0 for any of the following: #Xe2b0, #Xe2b1, #Xe2b2, #Xe2b3, #Xe2b4, #Xe2b5, #Xe2b6, #Xe2c0, #Xe2c1, #Xe2c2, #Xe2c3, #Xe2c4, #Xe2c5, #Xe2c6, #Xe2c7, #Xe2c8, #Xe2c9, #Xe2ca, #Xe2cb, #Xe2cc, #Xe2cd, #Xe2ce, #Xe2e0, #Xe2e1, #Xe2e2, #Xe2e3, #Xe2e4, #Xe2e5, #Xe2e6, #Xe2e7, #Xe2e8, #Xe2e9, #Xe2ea, #Xe2eb, #Xe2ec, #Xe2ed, #Xe2e #Xe2f0, #Xe2f1, #Xe2f2, #Xe2f3, #Xe2f4, #Xe2f5, #Xe2f6, #Xe2f7, #Xe2f8, #Xe2f9, #Xe2fa, #Xe2fb, #Xe2fc, #Xe2fd, #Xe2fe
Although since your package allows the first few words to display properly, I wondered if you could provide any workaround.
I attempted your experiment of configuring only with the broken ligatures:
(ligature-set-ligatures 'prog-mode
'(;; "[ERROR]" "[DEBUG]" "[INFO]" "[WARN]" "[WARNING]"
;; "[ERR]" "[FATAL]" "[TRACE]"
"[FIXME]" "[TODO]"
;; "[BUG]"
"[NOTE]" "[HACK]"
))
The result is the same.
If it's broken with even a single ligature then it's unlikely the package can do anything. ligature.el
is really just "sugar" around facilities already present in Emacs. I don't know enough about the problem at hand to say whether it's the font, cairo, Emacs or some unfortunate combination of all three. Issue #32 may or may not be related; it concerns some ligatures not working on Cygwin Windows. Though it must be said that Cascadia Code works well on my generic version of Ubuntu with a recent build of Emacs from master
.
You could try compiling Emacs with/without Cairo to see if it makes a difference? It does sound like a strange issue though. Alternatively you can have a look at ligature-generate-ligatures
and in particular set-char-table-range
.
I'm using Fedora 34 and I face this issue. Only the widest ligatures in PragmataPro seem to be affected. When I build without Cairo they all display correctly. With Cairo:
Without Cairo:
Could you show the output of C-u C-x = at the beginning of the "[FIXME]" ligature (not shown by PUA char, but with ligature.el) for each configuration? Also, what happens if you remove the step 4: C-u C-u SPC in the reproducible steps?
I'm seeing the same thing, where the right half of the long PragmataPro ligatures are getting clipped, but show up properly when building without Cairo.
C-u C-x = with Cairo:
position: 6823 of 7817 (87%), column: 51
character: [ (displayed as [) (codepoint 91, #o133, #x5b)
charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x5B
script: latin
syntax: (] which means: open, matches ]
category: .:Base, <:not at eol a:ascii l:latin r:roman to input: type ret or left square bracket buffer code: file by coding system utf-8-unix display: composed form below>Composed with the following character(s) "FIXME]" using this font:
ftcrhb:-FSD -PragmataPro Liga-regular-normal-normal--20----*-0-iso10646-1
by these glyphs:
[0 6 91 7120 10 0 0 0 0 nil]
[0 6 70 7120 10 0 0 0 0 nil]
[0 6 73 7120 10 0 0 0 0 nil]
[0 6 88 7120 10 0 0 0 0 nil]
[0 6 77 7120 10 0 0 0 0 nil]
[0 6 69 7120 10 0 0 0 0 nil]
[0 6 93 9239 10 -59 9 17 1 [0 0 6]]
with these character(s):
F (#x46) LATIN CAPITAL LETTER F
I (#x49) LATIN CAPITAL LETTER I
X (#x58) LATIN CAPITAL LETTER X
M (#x4d) LATIN CAPITAL LETTER M
E (#x45) LATIN CAPITAL LETTER E
] (#x5d) RIGHT SQUARE BRACKET
Character code properties: customize what to show
name: LEFT SQUARE BRACKET
old-name: OPENING SQUARE BRACKET
general-category: Ps (Punctuation, Open)
decomposition: (91) ('[')
There is an overlay here:
From 6823 to 6824
face show-paren-match
priority 1000
There are text properties here:
face font-lock-string-face
fontified t
[back]
C-u C-x = without Cairo:
position: 6823 of 7817 (87%), column: 51
character: [ (displayed as [) (codepoint 91, #o133, #x5b)
charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x5B
script: latin
syntax: (] which means: open, matches ]
category: .:Base, a:ASCII, l:Latin, r:Roman
to input: type "C-x 8 RET 5b" or "C-x 8 RET LEFT SQUARE BRACKET"
buffer code: #x5B
file code: #x5B (encoded by coding system utf-8-unix)
display: composed to form "[FIXME]" (see below)
Composed with the following character(s) "FIXME]" using this font:
xfthb:-FSD -PragmataPro Liga-regular-normal-normal--20----*-0-iso10646-1
by these glyphs:
[0 6 91 7120 10 0 1 1 0 nil]
[0 6 70 7120 10 0 1 1 0 nil]
[0 6 73 7120 10 0 1 1 0 nil]
[0 6 88 7120 10 0 1 1 0 nil]
[0 6 77 7120 10 0 1 1 0 nil]
[0 6 69 7120 10 0 1 1 0 nil]
[0 6 93 9239 10 -59 9 17 1 nil]
with these character(s):
F (#x46) LATIN CAPITAL LETTER F
I (#x49) LATIN CAPITAL LETTER I
X (#x58) LATIN CAPITAL LETTER X
M (#x4d) LATIN CAPITAL LETTER M
E (#x45) LATIN CAPITAL LETTER E
] (#x5d) RIGHT SQUARE BRACKET
Character code properties: customize what to show
name: LEFT SQUARE BRACKET
old-name: OPENING SQUARE BRACKET
general-category: Ps (Punctuation, Open)
decomposition: (91) ('[')
There are 2 overlays here:
From 6823 to 6823
face region
priority (nil . 100)
window #<window 3 on cogent-pragmata.el>
From 6823 to 6824
face show-paren-match
priority 1000
There are text properties here:
face font-lock-string-face
fontified t
[back]
I recommend you M-x report-emacs-bug
with the smallest possible example you can generate that reproduces the issue. It's likely this compositing bug affects more than just ligatures.
Sorry for the late reply. At least there is some problem with metrics calculation for the shaped glyphs. Could someone check if the following change to the emacs-28 branch makes some difference when linked with HarfBuzz 5.1.0? https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-28&id=ae348b719e8f1c29c3ee6ed5d723326b3bc54883