terminal/terminal_dimensions library

Classes

DeviceMetrics
A device's screen boxes in both orientations, used to suggest fitting dimensions regardless of how the device is currently held.
OrientationBox
One orientation's usable screen box in CSS pixels.

Enums

DimensionPreset
How the PTY dimensions for a new session are chosen.
TerminalTextSize
The terminal text-size preference. auto derives the font from the chosen columns so they fit the container width; the others adjust that baseline.

Constants

kCellHeightRatio → const double
Approximate monospace line-box height as a fraction of the font size.
kCellWidthRatio → const double
Approximate monospace cell width as a fraction of the font size.
kHorizontalChrome → const double
Horizontal chrome (terminal card padding + borders) subtracted from a box.
kMaxCols → const int
kMaxFontPx → const int
kMaxRows → const int
kMinCols → const int
Smallest/largest selectable column counts.
kMinFontPx → const int
Bounds for the rendered terminal font (px) when scaling a fixed grid to fit its container. Wide enough that a fixed grid can both shrink onto a phone and grow to fill a desktop window, so the terminal tracks the window size.
kMinRows → const int
Smallest/largest selectable row counts.
kRefFontPx → const int
The reference font size (px) the device presets are computed at. The live terminal font then rescales to make those columns fit the real container, which is why presets don't depend on the eventual font (no circularity).
kVerticalChrome → const double
Vertical chrome (header, toolbar, key bar, gaps) subtracted from a box.

Functions

computeFitDims(OrientationBox box, {int fontPx = kRefFontPx}) → ({int cols, int rows})
Computes the columns/rows that fit box at fontPx, after reserving the terminal chrome, clamped to the selectable range.