Kernel32GetConsoleFontSize Method

Retrieves the size of the font used by the specified console screen buffer.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("kernel32.dll", SetLastError = true)]
public static ConsoleCoordinate GetConsoleFontSize(
	IntPtr consoleOutput,
	int fontIndex
)

Parameters

consoleOutput  IntPtr
A handle to the console screen buffer. The handle must have the GENERIC_READ access right.
fontIndex  Int32
The index of the font whose size is to be retrieved.

This index is obtained by calling the GetCurrentConsoleFont(IntPtr, Boolean, ConsoleFontInfo) function.

Return Value

ConsoleCoordinate
If the function succeeds, the return value is a ConsoleCoordinate structure that contains the width and height of each character in the font, in logical units.

The X member contains the width, while the Y member contains the height.

If the function fails, the X and Y members are zero.

To get extended error information, call GetLastWin32Error.

Remarks

See Also