размер шрифта



Автор Ёергей Панченко задал вопрос в разделе Другие языки и технологии

Размер шрифта в консоли С++. Как сделать меньше размер шрифта в консоли консольного прилоэжения С++?? и получил лучший ответ

Ответ от Николай Веселуха[гуру]
Это, действительно, плохая затея. Размер шрифта меняет размер консоли.

#include <windows.h>
#include <iostream>
#include <windows.h>
#include <tchar.h>
using namespace std;
BOOL WINAPI SetConsoleFont(HANDLE hOutput, DWORD fontIndex);
DWORD WINAPI GetNumberOfConsoleFonts();
BOOL WINAPI GetConsoleFontInfo(HANDLE hOutput, BOOL bMaximize, DWORD numFonts, CONSOLE_FONT_INFO * info);
int main() {
HANDLE hCons = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD fontNum = GetNumberOfConsoleFonts();
CONSOLE_FONT_INFO * fonts = (CONSOLE_FONT_INFO *)malloc(sizeof(CONSOLE_FONT_INFO) * fontNum);
GetConsoleFontInfo(hCons, FALSE, fontNum, (CONSOLE_FONT_INFO *)fonts);
locale::global(locale(""));
for (unsigned index = 0; index < fontNum; index++) {
fonts[index].dwFontSize = GetConsoleFontSize(hCons, fonts[index].nFont);
printf("Режим: %d
", index + 1);
SetConsoleFont(hCons, fonts[index].nFont);
Sleep(3000);
}
free(fonts);
cin.get();
return 0;
}
BOOL WINAPI SetConsoleFont(HANDLE hOutput, DWORD fontIndex) {
typedef BOOL (WINAPI * PSetConsoleFont)(HANDLE, DWORD);
static PSetConsoleFont pSetConsoleFont = NULL;
if(pSetConsoleFont == NULL) pSetConsoleFont = (PSetConsoleFont)::GetProcAddress(::GetModuleHandle(_T("kernel32")), "SetConsoleFont");
if(pSetConsoleFont == NULL) return FALSE;
return pSetConsoleFont(hOutput, fontIndex);
}
DWORD WINAPI GetNumberOfConsoleFonts() {
typedef DWORD (WINAPI * PGetNumberOfConsoleFonts)();
static PGetNumberOfConsoleFonts pGetNumberOfConsoleFonts = NULL;
if(pGetNumberOfConsoleFonts == NULL) pGetNumberOfConsoleFonts = (PGetNumberOfConsoleFonts)::GetProcAddress(::GetModuleHandle(_T("kernel32")), "GetNumberOfConsoleFonts");
if(pGetNumberOfConsoleFonts == NULL) return 0;
return pGetNumberOfConsoleFonts();
}
BOOL WINAPI GetConsoleFontInfo(HANDLE hOutput, BOOL bMaximize, DWORD fontIndex, CONSOLE_FONT_INFO * info) {
typedef BOOL (WINAPI * PGetConsoleFontInfo)(HANDLE, BOOL, DWORD, CONSOLE_FONT_INFO *);
static PGetConsoleFontInfo pGetConsoleFontInfo = NULL;
if(pGetConsoleFontInfo == NULL) pGetConsoleFontInfo = (PGetConsoleFontInfo)::GetProcAddress(::GetModuleHandle(_T("kernel32")), "GetConsoleFontInfo");
if(pGetConsoleFontInfo == NULL) return FALSE;
return pGetConsoleFontInfo(hOutput, bMaximize, fontIndex, info);
}

Ответ от Капитан Гугл[гуру]
Если бы в консоли можно было нормально рисовать и менять шрифты, то не были бы нужны окошки.. . Это в системных настройках надо менять.

Ответ от Stdin || stdout[новичек]
Простите, что? Консоль не место для свистелок и рюшечек, нет там такого.

Ответ от Денис Евдоченко[гуру]
BOOL WINAPI SetCurrentConsoleFontEx(
__in HANDLE hConsoleOutput,
__in BOOL bMaximumWindow,
__in PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx
);

Ответ от 3 ответа[гуру]
Привет! Вот подборка тем с похожими вопросами и ответами на Ваш вопрос: Размер шрифта в консоли С++. Как сделать меньше размер шрифта в консоли консольного прилоэжения С++??
Шрифт на Википедии
Посмотрите статью на википедии про Шрифт
 

Ответить на вопрос:

Имя*

E-mail:*

Текст ответа:*
Проверочный код(введите 22):*