[Windows] Enable ligatures feature with TTC format font cause crash.
Explorare opened this issue ยท 11 comments
[Environment]
Windows 10 22H2 x64
extraterm v0.68.0
[Issue]
This program could not handle OpenType Font Collection (.TTC) fonts correctly.
Introduction to OpenType Font Collection
An OpenType Font Collection (formerly known as TrueType Collection) is a means of delivering multiple OpenType font resources in a single file structure. The format for font collections allows font tables that are identical between two or more fonts to be shared. Font collections containing outline glyph data (TrueType, CFF, CFF2 or SVG) are most useful when the fonts to be delivered together share many glyphs in common. By allowing multiple fonts to share glyph sets and other common font tables, font collections can result in a significant saving of file space.
OpenType font files should use the extension .OTF, .TTF, .OTC or .TTC. (The extension may be upper or lower case.) The extensions .OTC and .TTC should only be used for font collection files.
Source: OpenType font file (OpenType 1.9) - Typography | Microsoft Learn
The program will crash after setting the font of terminal to a .TTC
font. I have tested be5invis/Sarasa-Gothic and adobe-fonts/source-han-sans, both of them will cause the same issue. While launching the program again after the crash, no GUI was created, three processes were created, which are extraterm
, Vmmem
and Qode.js JS Runtime for Qt
. The Qode.js
process will exit seconds after it been launched, and then the main process, and vmmem
may also stop after minutes of inavtive.
In the document for Qt 6.4, it says TTC is supported.
Currently only TrueType fonts, TrueType font collections, and OpenType fonts are supported.
Source: QFontDatabase Class | Qt GUI 6.4.1
And Calibre 6, which is also built with Qt6, support TTC fonts correctly. So I think this may be an implementation issue, not the Qt6 framework.
#304 may be related.
[Steps to reproduce]
- Set the default font to a .TTC font, the program will crash.
- Start the program again, the main process will be created, but the GUI would not show up. And the process will exit minutes after.
- Set the font to a
.TTF
or.OTF
font will make it work again.
[Config]
Click me
{
"commandLineActions": [],
"sessions": [
{
"uuid": "6f270b82-00c3-442f-9c9f-e002a5a26ed8",
"name": "PowerShell Core",
"type": "windows-console",
"exe": "pwsh.exe",
"args": "",
"initialDirectory": null
},
{
"uuid": "bc53e522-f99f-4da6-bfaa-b83efcdca2a0",
"name": "WSL Default",
"type": "wsl",
"useDefaultShell": true,
"shell": "",
"args": "",
"distribution": "",
"initialDirectory": "",
"extensions": {}
},
{
"uuid": "4886fb8e-6ceb-4416-b135-48ca6ec86d21",
"name": "WSL Debian",
"type": "wsl",
"useDefaultShell": true,
"shell": "",
"args": "",
"distribution": "Debian",
"initialDirectory": null
},
{
"uuid": "d0e63509-3abc-4f5d-bef3-ba02e718422c",
"name": "CMD",
"type": "windows-console",
"exe": "cmd.exe",
"args": "",
"initialDirectory": "",
"extensions": {}
},
{
"uuid": "77c248c5-d802-4732-8d02-607148ac4505",
"name": "PowerShell",
"type": "windows-console",
"exe": "powershell.exe",
"args": "",
"initialDirectory": null
}
],
"autoCopySelectionToClipboard": true,
"blinkingCursor": false,
"cursorStyle": "block",
"frameRule": "frame_if_lines",
"frameRuleLines": 10,
"keybindingsName": "pc-style",
"minimizeToTray": false,
"showTrayIcon": false,
"scrollbackMaxFrames": 100,
"scrollbackMaxLines": 10000,
"terminalFont": "Sarasa Term J",
"terminalFontSize": 13,
"terminalDisplayLigatures": true,
"terminalMarginStyle": "normal",
"tipCounter": 0,
"tipTimestamp": 0,
"titleBarStyle": "native",
"uiScalePercent": 100,
"windowBackgroundMode": "opaque",
"windowBackgroundTransparencyPercent": 50,
"closeWindowWhenEmpty": true,
"middleMouseButtonAction": "paste",
"middleMouseButtonShiftAction": "paste",
"middleMouseButtonControlAction": "paste",
"rightMouseButtonAction": "context_menu",
"rightMouseButtonShiftAction": "context_menu",
"rightMouseButtonControlAction": "context_menu",
"activeExtensions": {},
"themeTerminal": "itermcolors-terminal-theme-provider:Two Dark.itermcolors",
"windowConfiguration": {
"0": {
"isMaximized": true,
"x": 0,
"y": 23,
"width": 1500,
"height": 938
}
}
}
[Log]
Click me
2022-12-15 12:13:48.050 INFO [main #0] Recording logs to C:\Users\explo\AppData\Roaming\extratermqt\Config\extraterm.log
2022-12-15 12:13:58.178 INFO [main #0] User extension directory is: C:\Users\explo\AppData\Roaming\extratermqt\Config\extensions
2022-12-15 12:13:58.179 INFO [ExtensionManager #0] Scanning 'C:\Program Files\extratermqt\extensions' for extensions.
2022-12-15 12:13:58.184 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\About'.
2022-12-15 12:13:58.188 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\Autocomplete'.
2022-12-15 12:13:58.191 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\Autolink'.
2022-12-15 12:13:58.192 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\CommunityTerminalThemes'.
2022-12-15 12:13:58.195 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\CopyBlock'.
2022-12-15 12:13:58.197 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\CopyLink'.
2022-12-15 12:13:58.198 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\DefaultKeybindings'.
2022-12-15 12:13:58.199 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\DefaultTerminalTheme'.
2022-12-15 12:13:58.201 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\DirectoryCommands'.
2022-12-15 12:13:58.203 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\DownloadBlock'.
2022-12-15 12:13:58.206 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\Find'.
2022-12-15 12:13:58.209 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\ImageBlock'.
2022-12-15 12:13:58.212 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\InjectShellIntegration'.
2022-12-15 12:13:58.214 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\InsertEmoji'.
2022-12-15 12:13:58.222 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\InternalCommands'.
2022-12-15 12:13:58.224 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\ITermColorsTerminalThemeProvider'.
2022-12-15 12:13:58.227 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\OpenLink'.
2022-12-15 12:13:58.229 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\ProxySessionBackend'.
2022-12-15 12:13:58.231 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\ProxySessionEditor'.
2022-12-15 12:13:58.233 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\StyleGuide'.
2022-12-15 12:13:58.237 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\TerminalTitle'.
2022-12-15 12:13:58.239 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\TLDRPages'.
2022-12-15 12:13:58.242 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\WindowsConsoleSessionBackend'.
2022-12-15 12:13:58.244 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\WindowsConsoleSessionEditor'.
2022-12-15 12:13:58.245 INFO [ExtensionManager #0] Starting extension 'about'
2022-12-15 12:13:58.266 INFO [ExtensionManager #0] Starting extension 'autocomplete'
2022-12-15 12:13:58.272 INFO [ExtensionManager #0] Starting extension 'autolink'
2022-12-15 12:13:58.278 INFO [ExtensionManager #0] Starting extension 'community-terminal-themes'
2022-12-15 12:13:58.278 INFO [ExtensionManager #0] Starting extension 'copy-block'
2022-12-15 12:13:58.281 INFO [ExtensionManager #0] Starting extension 'copy-link'
2022-12-15 12:13:58.285 INFO [ExtensionManager #0] Starting extension 'default-keybindings'
2022-12-15 12:13:58.285 INFO [ExtensionManager #0] Starting extension 'default-terminal-theme'
2022-12-15 12:13:58.285 INFO [ExtensionManager #0] Starting extension 'directory-commands'
2022-12-15 12:13:58.288 INFO [ExtensionManager #0] Starting extension 'download-block'
2022-12-15 12:13:58.315 INFO [ExtensionManager #0] Starting extension 'find'
2022-12-15 12:13:58.324 INFO [ExtensionManager #0] Starting extension 'image-block'
2022-12-15 12:13:58.331 INFO [ExtensionManager #0] Starting extension 'inject-shell-integration'
2022-12-15 12:13:58.331 INFO [ExtensionManager #0] Starting extension 'insert-emoji'
2022-12-15 12:13:58.344 INFO [ExtensionManager #0] Starting extension 'internal-commands'
2022-12-15 12:13:58.345 INFO [ExtensionManager #0] Starting extension 'itermcolors-terminal-theme-provider'
2022-12-15 12:13:58.383 DEBUG [itermcolors-terminal-theme-provider] ITermColorTerminalThemeProvider activating
2022-12-15 12:13:58.383 INFO [ExtensionManager #0] Starting extension 'open-link'
2022-12-15 12:13:58.387 INFO [ExtensionManager #0] Starting extension 'proxy-session-backend'
2022-12-15 12:13:58.481 INFO [ExtensionManager #0] Starting extension 'proxy-session-editor'
2022-12-15 12:13:58.486 INFO [proxy-session-editor] ProxySessionEditorExtension activate
2022-12-15 12:13:58.500 INFO [ExtensionManager #0] Starting extension 'styleguide'
2022-12-15 12:13:58.503 WARN [ExtensionManager #0] Unable to load C:\Program Files\extratermqt\extensions\StyleGuide\dist\StyleGuideExtension.cjs. Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Program Files\extratermqt\extensions\StyleGuide\dist\StyleGuideExtension.cjs' imported from C:\Program Files\extratermqt\main\dist\main.cjs
2022-12-15 12:13:58.503 INFO [ExtensionManager #0] Starting extension 'terminal-title'
2022-12-15 12:13:58.529 INFO [ExtensionManager #0] Starting extension 'tldr-pages'
2022-12-15 12:13:58.534 INFO [ExtensionManager #0] Starting extension 'windows-console-session-backend'
2022-12-15 12:13:58.569 INFO [ExtensionManager #0] Starting extension 'windows-console-session-editor'
2022-12-15 12:13:58.598 WARN [ConfigDatabase #0] Unable to find config for key system
2022-12-15 12:13:58.754 INFO [LocalHttpServer #0] Local HTTP IPC server running on http://127.0.0.1:6302/50b7c553c562fac235b294f1103f0b8b
It is currently using Qt5. I plan to update NodeGui from Qt5 to Qt6 in the coming months.
@Explorare Can you test this problem again using the latest Extraterm release. It is on Qt6 these days.
Just tested on v0.71.0 and still got the same issue.
[Log]
Click me
2023-03-19 00:32:28.455 INFO [main #0] Recording logs to C:\Users\explo\AppData\Roaming\extratermqt\Config\extraterm.log
2023-03-19 00:32:40.442 INFO [main #0] User extension directory is: C:\Users\explo\AppData\Roaming\extratermqt\Config\extensions
2023-03-19 00:32:40.443 INFO [ExtensionManager #0] Scanning 'C:\Program Files\extratermqt\extensions' for extensions.
2023-03-19 00:32:40.447 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\About'.
2023-03-19 00:32:40.451 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\Autocomplete'.
2023-03-19 00:32:40.452 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\Autolink'.
2023-03-19 00:32:40.454 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\Colorizer'.
2023-03-19 00:32:40.455 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\CommunityTerminalThemes'.
2023-03-19 00:32:40.458 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\CopyBlock'.
2023-03-19 00:32:40.460 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\CopyLink'.
2023-03-19 00:32:40.461 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\DefaultKeybindings'.
2023-03-19 00:32:40.462 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\DefaultTerminalTheme'.
2023-03-19 00:32:40.463 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\DirectoryCommands'.
2023-03-19 00:32:40.465 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\DownloadBlock'.
2023-03-19 00:32:40.467 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\Find'.
2023-03-19 00:32:40.469 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\ImageBlock'.
2023-03-19 00:32:40.471 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\InjectShellIntegration'.
2023-03-19 00:32:40.473 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\InsertEmoji'.
2023-03-19 00:32:40.477 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\InternalCommands'.
2023-03-19 00:32:40.479 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\ITermColorsTerminalThemeProvider'.
2023-03-19 00:32:40.480 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\OpenLink'.
2023-03-19 00:32:40.482 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\ProxySessionBackend'.
2023-03-19 00:32:40.483 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\ProxySessionEditor'.
2023-03-19 00:32:40.484 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\StyleGuide'.
2023-03-19 00:32:40.487 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\TerminalTitle'.
2023-03-19 00:32:40.488 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\Tips'.
2023-03-19 00:32:40.489 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\TLDRPages'.
2023-03-19 00:32:40.490 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\UpdateChecker'.
2023-03-19 00:32:40.492 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\WindowsConsoleSessionBackend'.
2023-03-19 00:32:40.493 INFO [ExtensionManager #0] Read extension metadata from 'C:\Program Files\extratermqt\extensions\WindowsConsoleSessionEditor'.
2023-03-19 00:32:40.494 INFO [ExtensionManager #0] Starting extension 'about'
2023-03-19 00:32:40.523 INFO [ExtensionManager #0] Starting extension 'autocomplete'
2023-03-19 00:32:40.527 INFO [ExtensionManager #0] Starting extension 'autolink'
2023-03-19 00:32:40.530 INFO [ExtensionManager #0] Starting extension 'colorizer'
2023-03-19 00:32:40.541 INFO [ExtensionManager #0] Starting extension 'community-terminal-themes'
2023-03-19 00:32:40.541 INFO [ExtensionManager #0] Starting extension 'copy-block'
2023-03-19 00:32:40.545 INFO [ExtensionManager #0] Starting extension 'copy-link'
2023-03-19 00:32:40.548 INFO [ExtensionManager #0] Starting extension 'default-keybindings'
2023-03-19 00:32:40.549 INFO [ExtensionManager #0] Starting extension 'default-terminal-theme'
2023-03-19 00:32:40.549 INFO [ExtensionManager #0] Starting extension 'directory-commands'
2023-03-19 00:32:40.552 INFO [ExtensionManager #0] Starting extension 'download-block'
2023-03-19 00:32:40.568 INFO [ExtensionManager #0] Starting extension 'find'
2023-03-19 00:32:40.576 INFO [ExtensionManager #0] Starting extension 'image-block'
2023-03-19 00:32:40.582 INFO [ExtensionManager #0] Starting extension 'inject-shell-integration'
2023-03-19 00:32:40.582 INFO [ExtensionManager #0] Starting extension 'insert-emoji'
2023-03-19 00:32:40.592 INFO [ExtensionManager #0] Starting extension 'internal-commands'
2023-03-19 00:32:40.593 INFO [ExtensionManager #0] Starting extension 'itermcolors-terminal-theme-provider'
2023-03-19 00:32:40.607 DEBUG [itermcolors-terminal-theme-provider] ITermColorTerminalThemeProvider activating
2023-03-19 00:32:40.608 INFO [ExtensionManager #0] Starting extension 'open-link'
2023-03-19 00:32:40.611 INFO [ExtensionManager #0] Starting extension 'proxy-session-backend'
2023-03-19 00:32:40.832 INFO [ExtensionManager #0] Starting extension 'proxy-session-editor'
2023-03-19 00:32:40.836 INFO [proxy-session-editor] ProxySessionEditorExtension activate
2023-03-19 00:32:40.845 INFO [ExtensionManager #0] Starting extension 'styleguide'
2023-03-19 00:32:40.847 WARN [ExtensionManager #0] Unable to load C:\Program Files\extratermqt\extensions\StyleGuide\dist\StyleGuideExtension.cjs. Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Program Files\extratermqt\extensions\StyleGuide\dist\StyleGuideExtension.cjs' imported from C:\Program Files\extratermqt\main\dist\main.cjs
2023-03-19 00:32:40.847 INFO [ExtensionManager #0] Starting extension 'terminal-title'
2023-03-19 00:32:40.865 INFO [ExtensionManager #0] Starting extension 'tips'
2023-03-19 00:32:40.871 INFO [ExtensionManager #0] Starting extension 'tldr-pages'
2023-03-19 00:32:40.876 INFO [ExtensionManager #0] Starting extension 'update-checker'
2023-03-19 00:32:40.888 INFO [ExtensionManager #0] Starting extension 'windows-console-session-backend'
2023-03-19 00:32:40.916 INFO [ExtensionManager #0] Starting extension 'windows-console-session-editor'
2023-03-19 00:32:40.952 WARN [ConfigDatabase #0] Unable to find config for key system
2023-03-19 00:32:41.192 INFO [LocalHttpServer #0] Local HTTP IPC server running on http://127.0.0.1:42973/a5ae44b8da6433502375637fb9e19d92
I figured out that he root cause of this issue may be the malfunction of the ligatures support.
I came across this issue #420 and find an interesting error log:
On line 2 it blamed an error about the calt
OpenType feature, here is the description for it from Adobe:
This feature, in specified situations, replaces default glyphs with alternate forms which provide better joining behavior. Like ligatures (though not strictly a ligature feature), contextual alternates are commonly used to harmonize the shapes of glyphs with the surrounding context.
The setting for this feature in the config file is terminalDisplayLigatures
and the default value is true
. And the setting in the GUI is Enable Ligatures
below the font settings.
I mistakenly thought that it's a compatibility issue with TTC fonts, but those fonts are built to support modern OpenType features, including calt
.
It still could be the issue with GSUB support in TTC format which cause the software failed to load the calt
table.
Here are some test results. (Tested with v0.71.0)
Fonts | Format | calt support |
calt ON |
---|---|---|---|
cascadia-code | TTF | yes | works as intend |
cascadia-code | OTF static | yes | works as intend |
FiraCode | TTF | yes | crashed |
Iosevka | TTF | yes | work as intend |
Consolas | TTF | yes(?) | no difference |
Ink Free | TTF | NO | crashed |
source-code-pro | OTF | NO | no difference |
Sarasa Term J | TTC | yes | crashed |
Sarasa Term J | TTF | yes | works as intend |
You can find programming fonts with ligatures support here Programming Fonts - Test Drive
You can see if one font supports ligatures or not using FontDrop!.
So there are actually 2 separate issues need to be fixed:
- Error handling when the program failed to load
calt
table from a font. - Compatibility issue with
some fonts onGSUB support in TTC format.calt
support.
Thank you for looking into this. From the stack trace you put here it looks like the gsub
table is missing. I guess it is possible that the calt
table is also missing. Either way it will have to carefully check for the existence of both before it blindly goes crash.
But for Sarasa Term J, it supports calt
and works as intend in Windows Terminal. But extraterm seems having issue to load the calt
table. I'm wondering what's the difference that makes cascadia-code works but Sarasa Term J not.
I'm pretty fine with ligatures disabled to use Sarasa Term J for CJKV support. A quick patch to stop the program from crashing while calt
is not loaded successfully is enough. Maybe a complete fix for calt
tablet support in the future will be awesome. Thank you for this great project.
Since per @Explorare Iosevka itself is working, maybe it is related to the TTC format?
I've tried the TTF version of Sarasa Term J and it works as intend. So the broken support for GSUB in TTC format is the root cause?
I've been digging into this and have found a test case where it hangs, spinning CPU. There can always be another bug.
SourceHanSans is working fine now in Extraterm. I'll do a release in the next few days. Thanks for everyone's help here.
Released in 0.71.1.