Skip to main content

fmt_shortest

Function fmt_shortest 

Source
fn fmt_shortest(raw: i64, fract_bits: u32, f: &mut Formatter<'_>) -> Result
Expand description

Format a fixed-point value as the shortest decimal that parses back to it.

The value is exactly raw / 2^fract_bits. We pick the fewest fractional digits whose nearest decimal is strictly within half a step of it, as fontTools’ fixedToStr does, and omit the decimal point for integral values. Width, fill, alignment and sign flags behave as they do for floats.