Add an ability to reset and zoom in/out with ANSI #22599

Closed
opened 2026-01-31 08:18:05 +00:00 by claunia · 9 comments
Owner

Originally created by @ClaireCJS on GitHub (Nov 27, 2024).

Description of the new feature

Kind of a duplicate of #2578, but with ANSI codes.

Weren't there already OSC(?) ANSI codes in the VT200(?) or other standard for increasing/decreasing terminal font size? Or am I mis-remembering?

Proposed technical implementation details

Ansi code to increase font by 1 unit of size.
Ansi code to decrease font by 1 unit of size.
Ansi code to reset font to default/original size.

Preferably at a rate of >15fps, if possible

Originally created by @ClaireCJS on GitHub (Nov 27, 2024). ### Description of the new feature Kind of a duplicate of #2578, but with ANSI codes. Weren't there already OSC(?) ANSI codes in the VT200(?) or other standard for increasing/decreasing terminal font size? Or am I mis-remembering? ### Proposed technical implementation details Ansi code to increase font by 1 unit of size. Ansi code to decrease font by 1 unit of size. Ansi code to reset font to default/original size. Preferably at a rate of >15fps, if possible
claunia added the Needs-TriageIssue-TaskNeeds-Tag-FixNeeds-Attention labels 2026-01-31 08:18:06 +00:00
Author
Owner

@j4james commented on GitHub (Nov 27, 2024):

Weren't there already OSC(?) ANSI codes in the VT200(?) or other standard for increasing/decreasing terminal font size?

Everything from the VT100 onwards had the ability to change the font width with the DECCOLM mode, but you only had two choices: 80 columns per row, or 132 columns per row. The VT420 and later terminals also had the option of setting the font height with the DECSNLS sequence. For that you typically only had three choices, although the sequence itself could theoretically support any number.

DEC also had some software terminal emulators that let you control the font more directly with an OSC sequence (OSC 2F), and that had parameters specifying the point size, pitch, and font family. All of those parameters were optional, so for example you could just change the size and pitch without altering the font family.

There are probably also a boat load of proprietary sequences supported by various modern terminals that have their own ways of setting the font, and I'm assuming that includes changing the size, but I really don't know much about any of those.

@j4james commented on GitHub (Nov 27, 2024): > Weren't there already OSC(?) ANSI codes in the VT200(?) or other standard for increasing/decreasing terminal font size? Everything from the VT100 onwards had the ability to change the font _width_ with the [`DECCOLM`](https://vt100.net/docs/vt510-rm/DECCOLM.html) mode, but you only had two choices: 80 columns per row, or 132 columns per row. The VT420 and later terminals also had the option of setting the font _height_ with the [`DECSNLS`](https://vt100.net/docs/vt510-rm/DECSNLS.html) sequence. For that you typically only had three choices, although the sequence itself could theoretically support any number. DEC also had some software terminal emulators that let you control the font more directly with an `OSC` sequence (`OSC 2F`), and that had parameters specifying the point size, pitch, and font family. All of those parameters were optional, so for example you could just change the size and pitch without altering the font family. There are probably also a boat load of proprietary sequences supported by various modern terminals that have their own ways of setting the font, and I'm assuming that includes changing the size, but I really don't know much about any of those.
Author
Owner

@ClaireCJS commented on GitHub (Nov 27, 2024):

Amazing, that's what I thought.

I must have somehow not stumbled on that one in the VT100 or VT220 manuals when I read them. Or maybe overlooked them.

So let's say your example of OSC 2F is "zoom up".

It would be pretty amazing if that had the same effect as ctrl-scrollwheel-up one tick. (i.e. zoom up)

@ClaireCJS commented on GitHub (Nov 27, 2024): Amazing, that's what I thought. I must have somehow not stumbled on that one in the VT100 or VT220 manuals when I read them. Or maybe overlooked them. So let's say your example of ```OSC 2F``` is "zoom up". It would be pretty amazing if that had the same effect as ctrl-scrollwheel-up one tick. (i.e. zoom up)
Author
Owner

@zadjii-msft commented on GitHub (Nov 27, 2024):

If I had to guess, mintty usually has "proprietary" codes for stuff like this. I'd check there first for prior art.

@zadjii-msft commented on GitHub (Nov 27, 2024): If I had to guess, mintty usually has "proprietary" codes for stuff like this. I'd check there first for prior art.
Author
Owner

@j4james commented on GitHub (Nov 27, 2024):

So let's say your example of OSC 2F is "zoom up".

It wouldn't be as easy as that though. You need to know the current size to begin with, and then set both the height and width of the font to something larger. It's not ideal for your use case.

If I had to guess, mintty usually has "proprietary" codes for stuff like this. I'd check there first for prior art.

Yeah, I'm not sure of the details, but I do know Mintty has an OSC 7770 that is supposed to be able to set (and I think also query) the font size.

@j4james commented on GitHub (Nov 27, 2024): > So let's say your example of OSC 2F is "zoom up". It wouldn't be as easy as that though. You need to know the current size to begin with, and then set both the height and width of the font to something larger. It's not ideal for your use case. > If I had to guess, mintty usually has "proprietary" codes for stuff like this. I'd check there first for prior art. Yeah, I'm not sure of the details, but I do know Mintty has an `OSC 7770` that is supposed to be able to set (and I think also query) the font size.
Author
Owner

@ClaireCJS commented on GitHub (Nov 28, 2024):

I mean.... It already does something with the mouse wheel. So just do that thing? 😅

@ClaireCJS commented on GitHub (Nov 28, 2024): I mean.... It already does something with the mouse wheel. So just do that thing? 😅
Author
Owner

@DHowett commented on GitHub (Dec 11, 2024):

Thanks for requesting this, and thanks James for the prior art!

Could you explain your use case a bit more? I'm not really seeing it...

@DHowett commented on GitHub (Dec 11, 2024): Thanks for requesting this, and thanks James for the prior art! Could you explain your _use case_ a bit more? I'm not really seeing it...
Author
Owner

@ClaireCJS commented on GitHub (Dec 12, 2024):

Well, mode doesn’t work in WT so one could use it to gradually increase/decrease font size and then, say you had output that you knew was 80x25, you could zoom to the next-size-up that allows you to display 80x25.

Or, you know. Spooky effects.

@ClaireCJS commented on GitHub (Dec 12, 2024): Well, mode doesn’t work in WT so one could use it to gradually increase/decrease font size and then, say you had output that you knew was 80x25, you could zoom to the next-size-up that allows you to display 80x25. Or, you know. Spooky effects.
Author
Owner

@DHowett commented on GitHub (Jan 13, 2025):

Thanks for the use case!

That is an incredibly roundabout way to force the window size to 80x25.

I'd rather just fix the issue preventing you from manipulating the window size than allow VT applications to cause spooky effects at a distance.

@DHowett commented on GitHub (Jan 13, 2025): Thanks for the use case! That is an incredibly roundabout way to force the window size to 80x25. I'd rather just fix the issue preventing you from manipulating the window size than allow VT applications to cause spooky effects at a distance.
Author
Owner

@ClaireCJS commented on GitHub (Jan 13, 2025):

Oh i thought of another! How about your Quest headset is trained on you and knows your distance from the PC, and as you get further away, the text is enlarged so you can still read it. :)

@ClaireCJS commented on GitHub (Jan 13, 2025): Oh i thought of another! How about your Quest headset is trained on you and knows your distance from the PC, and as you get further away, the text is enlarged so you can still read it. :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22599