Giter VIP home page Giter VIP logo

Comments (10)

TimonPost avatar TimonPost commented on July 4, 2024

That is because it is not yet supported unfortunately.

from crossterm.

TimonPost avatar TimonPost commented on July 4, 2024

Some research needed to see if this is possible to implement.

from crossterm.

meteor-lsw avatar meteor-lsw commented on July 4, 2024

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.

meteor-lsw avatar meteor-lsw commented on July 4, 2024

More detail information can be found in this blog.

from crossterm.

meteor-lsw avatar meteor-lsw commented on July 4, 2024

In a Unix environment, we might find some inspiration from the console-setup tool.

from crossterm.

TimonPost avatar TimonPost commented on July 4, 2024

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.

meteor-lsw avatar meteor-lsw commented on July 4, 2024

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.

meteor-lsw avatar meteor-lsw commented on July 4, 2024

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.

TimonPost avatar TimonPost commented on July 4, 2024

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.

TimonPost avatar TimonPost commented on July 4, 2024

Closing in favor of #166

from crossterm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.