GChristensen / enso-portable

Portable Enso Launcher community edition
Other
164 stars 46 forks source link

Is it possible to change Enso's font? #32

Open gilch opened 1 month ago

gilch commented 1 month ago

Some of my custom commands insert Unicode characters that are otherwise hard to type. Sometimes I might want to display a message, write a docstring, or use a BOUND ARG option containing Unicode characters. Not all of them render in Enso's default font.

GChristensen commented 1 month ago

There are two files where font_family is set: enso/quasimode/layout.py enso/messages/primarywindow.py

It is worth to experiment with them.

GChristensen commented 1 month ago

It turns out that the font is hardcoded here. It is possible to specify any font file there. I'll try to do something about this in the future versions.

tnmeesters commented 4 weeks ago

That would be nice to have different fonts. I am also missing a lot of Unicode characters.

GChristensen commented 4 weeks ago

I've added the UI_FONT variable in the recent release. It is possible to specify a font here. In Enso it is only possible to use different fonts for message windows and the main UI window. Currently it is possible to only specify only one font for both. If you mean a feautre that assumes a custom font for a part of a message, it is very hard to do this, because a layout engine of some sort should be created, so most likely it will never be done, because everything is rendered in plain Cairo. It should be investigated how Cairo renders glyphs and are there settings to render unicode properly.

tnmeesters commented 3 weeks ago

Great, thank you. It would be interesting to try out some new fonts.

I have a script that uses Unicode. Some characters show up and others don't. Do not know anything about Cairo but it would be a cool feature. symbol.zip

gilch commented 3 weeks ago

If you mean a feautre that assumes a custom font for a part of a message,

Not sure what was meant, but in fact, no font I know of covers all Unicode glyphs. One can get pretty far with GNU Unifont, which at least covers the basic multilingual plane, but it's a kinda ugly pixel font and even then doesn't handle combining characters properly in many cases. Full Unicode display support requires inline rendering of fallback fonts.

so most likely it will never be done, because everything is rendered in plain Cairo.

This Cairo? They specifically call out and recommend Pango at that FAQ link as being able to handle multiple fonts. No need to reinvent the wheel, but I can't tell if that's easy to apply to Enso because I still don't understand Enso's internals.

gilch commented 3 weeks ago

A quick search of the repository does contain hits for "pango", so maybe it's already being used.

tnmeesters commented 2 weeks ago

I've added the UI_FONT variable in the recent release. It is possible to specify a font here. In Enso it is only possible to use different fonts for message windows and the main UI window. Currently it is possible to only specify only one font for both. If you mean a feautre that assumes a custom font for a part of a message, it is very hard to do this, because a layout engine of some sort should be created, so most likely it will never be done, because everything is rendered in plain Cairo. It should be investigated how Cairo renders glyphs and are there settings to render unicode properly.

So I 've downloaded the new version but I do not know how to change to font. Where do I do this?

GChristensen commented 2 weeks ago

There is a text input in the main settings window. It is necessary to specify font there:

UI_FONT="Segoe UI"

and restart Enso.

tnmeesters commented 2 weeks ago

Alright, I got the message windows of enso working with another font but not the part where you type after launching enso. Is this possible?

GChristensen commented 2 weeks ago

It is set here. You may check if it is so in your installation (probably it is). It sets the font of the string that you type and the automatic completion. The help string above this may be in the standard font.

tnmeesters commented 2 weeks ago

Thanks, I have got it working. This is so cool.