INNER CODE UNIT · Rust

px

free-explorers/veshell · src/embedder/backend/render/mod.rs:561

    let px = (RECORDING_CHIP_HEIGHT * 0.72 * integer_scale) as f32;
    let (reference, _) = font.rasterize('0', px);
    let box_height = reference.height as i32;

    let mut placed = Vec::new();
    let mut pen_x = 0i32;
    for glyph in text.chars() {
        let (metrics, bitmap) = font.rasterize(glyph, px);
        let x = pen_x + metrics.xmin;
        let y = ((canvas_height - box_height) / 2) + (box_height - metrics.height as i32) / 2;
        placed.push((x, y, metrics.width as i32, metrics.height as i32, bitmap));
        pen_x += metrics.advance_width.round() as i32;
    }

    // Right-align the drawn text at the chip's right edge inset.
    const TEXT_RIGHT_INSET: f64 = 6.0;
    let text_width = pen_x;
    let text_start_x =

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…