forFont static method
The preset whose font size is closest to font (sm, md or lg).
Implementation
static TSize forFont(double font) {
const presets = [sm, md, lg];
return presets.reduce((a, b) => (a.font - font).abs() <= (b.font - font).abs() ? a : b);
}