use super::GlyphOutlineCommand as Command;
pub(super) fn commands(text: &str, fs: f64, dpi: f64, baseline: f64) -> Option<Vec<Command>> {
let (left, bottom, right, top) = match text {
"∙" => (386.0, 174.0, 638.0, 427.0),
"⋅" => (424.0, 218.0, 598.0, 381.0),
_ => return None,
};
let scale = fs / 1024.0;
let cx = (left + right) * scale / 2.0;
let cy = baseline
- super::negation_geometry::math_origin_shift(fs, dpi)
- (bottom + top) * scale / 2.0;
let rx = (right - left) * scale / 2.0;
let ry = (top - bottom) * scale / 2.0;
let kappa = 4.0 * (2.0_f64.sqrt() - 1.0) / 3.0;
let kx = rx * kappa;
let ky = ry * kappa;
Some(vec![
Command::Move((cx + rx, cy)),
Command::Cubic([(cx + rx, cy + ky), (cx + kx, cy + ry), (cx, cy + ry)]),
Command::Cubic([(cx - kx, cy + ry), (cx - rx, cy + ky), (cx - rx, cy)]),
Command::Cubic([(cx - rx, cy - ky), (cx - kx, cy - ry), (cx, cy - ry)]),
Command::Cubic([(cx + kx, cy - ry), (cx + rx, cy - ky), (cx + rx, cy)]),
Command::Close,
])
}