1) If the default fonts haven't changed (by win version/edition/system ...; i am using win xp home 32 bit), then you may choose them with CmdFont.exe.
You may compile it (.NET is needed to be installed) by executing this "CmdFont.cs.bat" (use this name to avoid errors):
Code: Select all
// // >nul 2> nul & @goto :main
/*
* Author: Ulf Schneider aka penpen
* Free for non profit use only.
* For profit use contact me at www.dostips.com via private message (PM).
* CmdFont.cs.bat
*/
/*
:main
@echo off
setlocal
cls
set "csc="
pushd "%SystemRoot%\Microsoft.NET\Framework"
for /f "tokens=* delims=" %%i in ('dir /b /o:n "v*"') do (
dir /a-d /b "%%~fi\csc.exe" >nul 2>&1 && set "csc="%%~fi\csc.exe""
)
popd
if defined csc (
echo most recent C#.NET compiler located in:
echo %csc%.
) else (
echo C#.NET compiler not found.
goto :eof
)
for %%a in ("%~dpn0") do for %%b in ("%%~dpna") do (
rem %csc% /?
%csc% /nologo /optimize /warnaserror /nowin32manifest /unsafe /debug- /target:exe /out:"%%~b.exe" "%~f0"
)
exit /B
*/
using System;
using System.Runtime.InteropServices;
using DWORD = System.Int32;
using HANDLE = System.IntPtr;
public class CmdFont {
public const DWORD STD_OUTPUT_HANDLE = (DWORD) (-11);
[StructLayout (LayoutKind.Sequential)]
internal struct COORD {
internal short X;
internal short Y;
}
[StructLayout (LayoutKind.Sequential)]
internal unsafe struct CONSOLE_FONT_INFO {
internal DWORD nFont;
internal COORD dwFontSize;
}
[DllImport ("kernel32.dll", CharSet=CharSet.Auto, ExactSpelling=true, SetLastError=true)]
private static extern int SetConsoleFont (HANDLE hOut, DWORD nFont);
[DllImport ("kernel32.dll", CharSet=CharSet.Auto, ExactSpelling=true, SetLastError=true)]
private static extern HANDLE GetStdHandle (DWORD nStdHandle);
[DllImport ("kernel32.dll", CharSet=CharSet.Auto, ExactSpelling=true, SetLastError=true)]
private static extern bool GetCurrentConsoleFont (
HANDLE consoleOutput,
bool maximumWindow,
ref CONSOLE_FONT_INFO lpConsoleCurrentFont
);
[DllImport ("kernel32.dll", CharSet=CharSet.Auto, ExactSpelling=true, SetLastError=true)]
private static extern bool GetConsoleFontInfo (
bool bMaximumWindow,
DWORD nFontCount,
ref CONSOLE_FONT_INFO lpConsoleFontInfo
);
[DllImport ("kernel32.dll", CharSet=CharSet.Auto, ExactSpelling=true, SetLastError=true)]
private static extern COORD GetConsoleFontSize (
HANDLE hConsoleOutput,
DWORD nFont
);
[DllImport ("kernel32.dll", CharSet=CharSet.Auto, ExactSpelling=true, SetLastError=true)]
private static extern DWORD GetNumberOfConsoleFonts ();
public const int HELP = 0;
public const int GET = 1;
public const int SET = 2;
public static unsafe void Main (string[] args) {
int option = HELP;
int nFont = 0;
switch (args.Length) {
case 0:
option = GET;
break;
case 1:
option = (String.Compare ("GET", args [0], true) == 0) ? GET : HELP;
break;
case 2:
try {
nFont = int.Parse (args [1]);
option = (String.Compare ("SET", args [0], true) == 0) ? SET : HELP;
} catch {
}
break;
default:
option = HELP;
break;
}
switch (option) {
case SET:
SetConsoleFont (GetStdHandle (STD_OUTPUT_HANDLE), nFont);
break;
case GET:
CONSOLE_FONT_INFO info = new CONSOLE_FONT_INFO ();
GetCurrentConsoleFont (GetStdHandle (STD_OUTPUT_HANDLE), false, ref info);
COORD fontSize = GetConsoleFontSize (GetStdHandle (STD_OUTPUT_HANDLE), info.nFont);
Console.WriteLine ("Font number: {0}/{1} ({2}, {3})", info.nFont, GetNumberOfConsoleFonts (), fontSize.X, fontSize.Y);
Console.WriteLine ("Screen size: {0}, {1}", info.dwFontSize.X, info.dwFontSize.Y);
Console.Out.Flush ();
break;
default:
Console.WriteLine ("Usage: CmdFont[.exe] [GET|SET nFont]");
Console.WriteLine (" [GET] Displays a message with:");
Console.WriteLine (" - the actual font number,");
Console.WriteLine (" - the actual font size, and");
Console.WriteLine (" - the actual console size.");
Console.WriteLine (" SET nFont Sets the actual font number (nFont)");
Console.Out.Flush ();
break;
}
}
}
After you have compiled the executable you may set the default fonts (sample: default font number 6):
You may also like to see some few infos using:
In windows xp these modes are possible:
Code: Select all
Default fonts by number:
0 Raster Font width: 4, height: 6
1 Raster Font width: 6, height: 8
2 Raster Font width: 8, height: 8
3 Raster Font width: 16, height: 8
4 Raster Font width: 5, height: 12
5 Raster Font width: 7, height: 12
6 Lucida Console width: 7, height: 12
7 Raster Font width: 8, height: 12
8 Raster Font width: 8, height: 12
9 Raster Font width: 16, height: 12
10 Raster Font width: 12, height: 16
11 Raster Font width: 10, height: 18
(Sad to say there is only one Lucida consle font available.)
2) The first task could be done by using:
The second task could be done using c# again, just use this function in the main method:
Code: Select all
using System;
public class CmdScreen {
public static void Main (string[] args) {
try {
int screen_x = int.Parse (args [0]);
int screen_y = int.Parse (args [1]);
Console.SetWindowSize (screen_x, screen_y);
} catch {
}
}
}
3) I have no idea, how to enable QuickEdit and InsertMode without using the registry, sorry.
penpen