Setting custom font on Windows 10 crashes ledit
main 75c88f8
Set custom font, sample config.json used for testing:
PS C:\Users\tux> cat .\.ledit\config.json
{
"window_transparency": true,
"font_face": "C:\Windows\Fonts\CascadiaMono.ttf"
}
If forward slashes are used in path, font_face seems to have no effect but ledit won't crash.
Windows error log:
TimeCreated : 2/24/2022 11:22:13 AM
ProviderName : Application Error
Id : 1000
Message : Faulting application name: ledit.exe, version: 0.0.0.0, time stamp: 0x6217d676
Faulting module name: ucrtbase.dll, version: 10.0.19041.789, time stamp: 0x2bd748bf
Exception code: 0xc0000409
Fault offset: 0x000000000007286e
Faulting process id: 0xc5c
Faulting application start time: 0x01d829b3d37d37f1
Faulting application path: C:\Tools\ledit.exe
Faulting module path: C:\Windows\System32\ucrtbase.dll
Report Id: bab2b1d6-0553-4f8b-b799-eaa5bc547b34
Faulting package full name:
Faulting package-relative application ID:
Also window_transparency is not working on Windows 10.
Seams to work for me

make sure to use double `\\` in the json file

{
"colors": {
"background_color": [
46,
52,
64,
255
],
"comment_color": [
67,
76,
94,
255
],
"default_color": [
229,
233,
240,
240
],
"highlight_color": [
59,
66,
82,
200
],
"keyword_color": [
143,
188,
187,
255
],
"line_number_color": [
204,
204,
204,
204
],
"minibuffer_color": [
255,
255,
255,
255
],
"number_color": [
180,
142,
173,
255
],
"selection_color": [
229,
233,
240,
153
],
"special_color": [
129,
161,
193,
255
],
"status_color": [
204,
204,
255,
229
],
"string_color": [
163,
190,
140,
255
]
},
"font_face": "C:\\Windows\\Fonts\\CascadiaMono.ttf",
"window_transparency": false
}
here the full confiig
So yes as i thought, the config isnt providing valid json as the \ need to be escaped. blame windows bs path separator here.

I'd find it better if ledit didn't just crash in case the font face could not be loaded, regardless - maybe give the user a friendly warning?
the readme states that but yes there could be a exists check :^)
@elsaco could you maybe get where exactly this crashes? theres a path check already: https://github.com/liz3/ledit/blob/master/src/providers.h#L163-L164