avahe-kellenberger / nimdow

A window manager written in Nim (In Development)
GNU General Public License v2.0
319 stars 19 forks source link

Allow SGR font selection #166

Closed PMunch closed 3 years ago

PMunch commented 3 years ago

Implement font selection by using the SGR escape code for fonts. Setting font 10 or resetting the style will select the first font that has that character defined, setting font 11-19 will select the specific font by index with 11 being the first font in the defined list.

PMunch commented 3 years ago

Based on the suggestion by @dakyskye in https://github.com/avahe-kellenberger/nimdow/issues/120#issuecomment-841786435

avahe-kellenberger commented 3 years ago

Self-note, link from PMunch: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters

PMunch commented 3 years ago

Yeah similar to how you would set colours you can now select font, so a simple \e[11m would select the first font, \e[12m would select the second font and so on up until \e[19m. To reset you can use \e[10m to get the default font behaviour or \e[0m to reset everything including colours. You can of course also use the normal colour commands along with this, so \e[32;41;12m would set green foreground colour, red background colour, and font 2.