Comments (10)
That is because it is not yet supported unfortunately.
from crossterm.
Some research needed to see if this is possible to implement.
from crossterm.
I have found some code, it may be helpful.
struct CONSOLE_FONT
{
DWORD index;
COORD dim;
};
typedef BOOL (WINAPI *PROCSETCONSOLEFONT)(HANDLE, DWORD);
typedef BOOL (WINAPI *PROCGETCONSOLEFONTINFO)(HANDLE,BOOL,DWORD,CONSOLE_FONT*);
typedef COORD (WINAPI *PROCGETCONSOLEFONTSIZE)(HANDLE,DWORD);
typedef DWORD (WINAPI *PROCGETNUMBEROFCONSOLEFONTS)();
typedef BOOL (WINAPI *PROCGETCURRENTCONSOLEFONT)(HANDLE,BOOL,CONSOLE_FONT*);
PROCSETCONSOLEFONT SetConsoleFont;
PROCGETCONSOLEFONTINFO GetConsoleFontInfo;
PROCGETCONSOLEFONTSIZE GConsoleFontSize;
PROCGETNUMBEROFCONSOLEFONTS GetNumberOfConsoleFonts;
PROCGETCURRENTCONSOLEFONT GCurrentConsoleFont;
int _tmain(int argc, _TCHAR* argv[])
{
int nNumFont;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
HMODULE hKernel32 = GetModuleHandle(L"kernel32");
SetConsoleFont = (PROCSETCONSOLEFONT)GetProcAddress(hKernel32,"SetConsoleFont");
GetConsoleFontInfo = (PROCGETCONSOLEFONTINFO)GetProcAddress(hKernel32,"GetConsoleFontInfo");
GConsoleFontSize = (PROCGETCONSOLEFONTSIZE)GetProcAddress(hKernel32,"GetConsoleFontSize");
GetNumberOfConsoleFonts = (PROCGETNUMBEROFCONSOLEFONTS)GetProcAddress(hKernel32,"GetNumberOfConsoleFonts");
GCurrentConsoleFont = (PROCGETCURRENTCONSOLEFONT)GetProcAddress(hKernel32,"GetCurrentConsoleFont");
nNumFont = GetNumberOfConsoleFonts();
CONSOLE_FONT *pFonts = new CONSOLE_FONT[nNumFont];
GetConsoleFontInfo(hConsole, 0, nNumFont, pFonts);
SetConsoleFont(hConsole, pFonts[5].index);
cout << "This is Console C++!" << endl;
return 0;
}
from crossterm.
More detail information can be found in this blog.
from crossterm.
In a Unix environment, we might find some inspiration from the console-setup tool.
from crossterm.
Nice findings!. We only need some code on how to do this in UNIX.
I am not sure if this is going to work out because every terminal supports different fonts and different options for fonts. So we can make some kind of generic support but this crated is meant to support all platforms and to my knowledge I don't see much things in common if it goes about font. If you take color for example very terminal supports that.
Maybe we can provide some kind of tools so the user can manually play with the different font options the terminal has he wants to use.
from crossterm.
The font types supported by different terminals may be different, but they should all support adjusting the font size.
The font size setting should be a generic interface, which will give the terminal more possibilities.
If we can make the font smaller, we can use the terminal to simulate rendering more things, maybe a picture, maybe a video.
from crossterm.
One idea is that we provide an interface to help the user detect which fonts are supported by the current terminal, and then the user can select one of these fonts as needed.
from crossterm.
Yea those are great ideas! Think maybe just as you said it providing tools for the user is probably already good enough.
Currently I am working on some other projects just taking a little brake from this crate since I had been working on it for 8 months :). But I am willing to investigate into these features. See what is possible. And feel free to also look at certain options, and open an PR if you think you have an great idea. Together we certainly can make it work faster.
from crossterm.
Closing in favor of #166
from crossterm.
Related Issues (20)
- Surrogate pairs are ignored on Windows Terminal HOT 1
- Document the feature `use-dev-tty` on `crossterm::event::{poll, read}` HOT 1
- Event::Mouse doesn't capture modifiers in zellij HOT 1
- Support for sending ansi special characters to terminal
- `event::read` incorrectly returns `Esc` key press event while scrolling the mouse wheel HOT 2
- Padding when trying to fill whole terminal. HOT 1
- Terminal settings do not get restored on exit when using bash HOT 1
- Differentiate between keyboard/numpad chars
- Mac doesnt report Shift or Ctrl with enter key HOT 3
- iTerm2 image protocol for vscode
- Support OSC 52 for clipboard interraction HOT 1
- Support win32-input-mode
- `crossterm::event::poll` function fails on macOS with a timeout larger than 100 million seconds
- serde support for Attributes
- add support for win32-input-mode
- Synchronized Update doesn't work on Windows
- Support Pixel Coordinates in Mouse Events HOT 1
- Macros to reduce the syntactic burden of parsing events HOT 4
- Mouse down event isn't registered when it happened shortly after another click (double click)
- Document buffering behavior for events
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crossterm.