howl-editor / howl

The Howl Editor
http://howl.io
Other
712 stars 68 forks source link

Separate font for main editor's default unstyled text #426

Closed aver-d closed 6 years ago

aver-d commented 6 years ago

Looking at the themes and source, I see I can choose fonts by referring to a style created by a lexer or set manually (this works great, thanks).

I'd also like to use a specific font for the default unstyled text in the main editing window, and this font would be distinct from a default font used for popups, command line or any other type of activity.

A default unstyled text can be controlled either through a style default or howl.config.font. But I don't notice a way to restrict the meaning of this default font to take into account its containing window.

Are there any other undocumented css rules I could use in css_template in theme.moon to differentiate the editor? Alternatively, could you recommend another suitable point in the codebase to identify the editor and adjust the font of its unstyled text?

nilnor commented 6 years ago

Unfortunately this is not possible. There is currently a one to one mapping of styles and how they're displayed graphically, i.e. a style is displayed the same way regardless of what parent view happens to hold the editing component. In order for it to be different one would have to introduce a contextual awareness that would have to be propagated down to the styles management module and update themes to be able to supply contextual styles.

That would be doable, but would add some complexity. It is not something that I see as high up on the priority list, nor is it something that I personally would find a use for. Before even considering a PR for this there would have to be a clear demand from multiple people (and someone else would have to come up with a well-written PR). That being the case I'll close this for now, and we'll see if those things happen in the future.

aver-d commented 6 years ago

Sure, no problem. From browsing the source I thought this might not be straightforward. I'd noticed the same issue applies to other styling concepts such as padding and restricting any change to the main editor only.

I've been exploring using Howl for general writing (I'll continue programming in the terminal). For me, a proportional font in the main editor is preferable for writing, though I imagine the same would be true of many users normally using Howl for programming in a monospace font but also occasionally working with markdown/asciidoc et al.

I took another look at this default text issue and (vaguely) solved the matter by going the long route: making every other style not equal to the default, and changing a few styles where index offsets are used for table column alignment.

I think you've done a great job developing these text-based ui components and the underlying libraries. So, one day, making the surrounding user interface more configurable, fonts or otherwise, might not be a bad idea. It seems to me that you've already done the hard work.

nilnor commented 6 years ago

Thanks for providing the context of the request - I can see the desire for a variable width font only in the editor when writing text while keeping the rest of the UI in mono width. While I won't be working on it myself in the foreseeable future, I'll note that I think one could get the font width addressed by making the font configuration variable not global , i.e. have it be configurable per mode and per buffer. That would only allow for configuring different fonts (and won't help if any theme would do specific font things), but would allow for say variable width fonts only for markdown, etc.