Jan 6, 2018 at 9:24pm UTC
Hello everyone,
Is there any way to change the font size to small during runtime by code?
Last edited on Jan 6, 2018 at 9:24pm UTC
Jan 6, 2018 at 10:24pm UTC
@SamuelAdams yes in console.
Jan 7, 2018 at 1:39am UTC
The windows console has 1 font and 1 color at a time unless your program can over-ride that. There are libraries to do that, but nothing standard.
I found a huge batch file that didn't work for winX online. Maybe someone can fix it or you can get it working (?)..
@echo off
setlocal enabledelayedexpansion enableextensions
set "cmd.con=HKCU\Console\%%SystemRoot%%_system32_cmd.exe /v"
set "ram=!tmp!\WRAM.tmp"
del "%tmp%\_$xy.bat">nul 2>&1
if [%1]==[ok] goto:init
Reg export HKCU\Console Backup.reg>nul
Reg delete HKCU\Console\%%SystemRoot%%_system32_cmd.exe /f>nul
for %%a in (
"FaceName /t REG_SZ /d "Terminal" /f"
"FontFamily /t REG_DWORD /d 48 /f"
"FontSize /t REG_DWORD /d 1024294 /f"
"FontWeight /t REG_DWORD /d 700 /f"
"ScreenBufferSize /t REG_DWORD /d 13107280 /f"
"CursorSize /t REG_DWORD /d 0 /f"
) do (
set "param=%%a"
set "param=!param:~1!"
set "param=%cmd.con% !param:~0,-1!"
Reg Add !param! >nul
)
start /high cmd /q /k "%~0" ok
for %%a in (
"FaceName /f"
"FontFamily /f"
"FontSize /f"
"FontWeight /f"
"CursorSize /f"
) do (
set "param=%%a"
set "param=!param:~1!"
set "param=%cmd.con% !param:~0,-1!"
Reg Delete !param! >nul
)
Jan 7, 2018 at 7:29am UTC
OMG that's huge! and out of knowledge..
Jan 8, 2018 at 3:14pm UTC
that was neat, I didnt know that worked on consoles.
Jan 8, 2018 at 4:36pm UTC
It is a relatively recent addition to the Windows Console API. Make sure that _WIN32_WINNT is defined to a value of 0x0500 or greater before you #include <windows.h> .