Expand description
Small Windows-only helper to estimate console pixel sizes.
§Why this exists
GetCurrentConsoleFontEx and other font-metric APIs are unreliable
on many Windows terminal hosts and emulators (they may return unusable
values or not reflect user DPI/zoom). This crate provides a “good
enough” estimation by using conservative defaults and the current
DPI to compute per-character pixel sizes, then converting console
character dimensions into pixels.
Short summary
get_size_of_the_font()returns an estimated font cell size in pixels.get_size_of_the_terminal()returns a pixel-size estimate for the console by multiplying the estimated font size by console character dimensions.
Limitations: values are approximations and may be incorrect for custom fonts, per-window zoom, or terminal emulators that do not expose accurate metrics.
Structs§
- Font
Size - Struct to hold font size information in terms of width and height.
- Terminal
Size - Struct to hold terminal size information in terms of width and height.
Enums§
- Terminal
Error - Enum to represent possible errors that can occur while getting terminal or font size.
Functions§
- get_
size_ of_ the_ font - Estimate the console font cell size in pixels.
- get_
size_ of_ the_ terminal - Estimate the terminal window size in pixels.