Skip to documentation
SLOP

tiny.filigree.glyphBitmapAlloc

Reference tiny.filigree glyphBitmapAlloc

Defined in font.raster.

Rasterizes one glyph.

Called byCallsprivate sourcelib.filigree.src.font.rasterexpectGlyphCoverageMatchesReferencefont.rasterloadAtlasAlloctest sourcelib.filigree.src.font.rastertest: raster renders CFF fixture outl...test sourcelib.filigree.src.font.rastertest: raster renders composite fixtur...test sourcelib.filigree.src.font.rastertest: raster renders configured CFF f...test sourcelib.filigree.src.font.rastertest: raster renders fixture outline ...private sourcelib.filigree.src.font.coveragerasterizeAllocfont.outlineglyphAllocprivate sourcelib.filigree.src.font.rasterblankGlyphprivate sourcelib.filigree.src.font.rasterflattenGlyphprivate sourcelib.filigree.src.font.rasterfontScale+3 morefont.rasterglyphBitmapAlloc
Static calls · unresolved targets: 0 · external targets: 8.

Source

Source: lib/filigree/src/font/raster.zig:97

zig
/// Rasterizes one glyph. Scratch allocations end before return; `alpha` belongs to/// `output_allocator` and must be released with `GlyphBitmap.deinit` and the same allocator.pub fn glyphBitmapAlloc(    output_allocator: std.mem.Allocator,    scratch_allocator: std.mem.Allocator,    face: face_table.Face,    glyph_id: u32,    pixel_size: i32,) Error!GlyphBitmap {    if (pixel_size <= 0) return error.InvalidPixelSize;    const scale = fontScale(face, pixel_size);    const advance_x = scaleMetric(face.advanceWidth(glyph_id), scale);    var glyph = try outline.glyphAlloc(scratch_allocator, face, glyph_id);    defer glyph.deinit(scratch_allocator);    if (glyph.points.len == 0 or glyph.bounds.x_max <= glyph.bounds.x_min or glyph.bounds.y_max <= glyph.bounds.y_min) {        return blankGlyph(glyph_id, advance_x);    }    const pixel_bounds = glyphPixelBounds(glyph.bounds, face.ascender, scale);    const width = pixel_bounds.width();    const height = pixel_bounds.height();    if (width <= 0 or height <= 0) return blankGlyph(glyph_id, advance_x);    var points = std.ArrayListUnmanaged(FloatPoint).empty;    defer points.deinit(scratch_allocator);    var contours = std.ArrayListUnmanaged(ContourRange).empty;    defer contours.deinit(scratch_allocator);    try flattenGlyph(scratch_allocator, glyph, face.ascender, pixel_bounds, scale, &points, &contours);    const alpha = try output_allocator.alloc(u8, try pixelCount(width, height));    errdefer output_allocator.free(alpha);    @memset(alpha, 0);    if (points.items.len > 0) {        try coverage.rasterizeAlloc(scratch_allocator, alpha, width, height, points.items, contours.items);    }    return .{        .glyph_id = glyph_id,        .width = width,        .height = height,        .offset_x = pixel_bounds.left,        .offset_y = pixel_bounds.top,        .advance_x = advance_x,        .alpha = alpha,    };}

Source: lib/filigree/src/root.zig:106

zig
pub const glyphBitmapAlloc = font.glyphBitmapAlloc;

Also reachable as

font.glyphBitmapAlloc.

Complete call list

8 direct calls.

Audit

Definitions1
Public names3
Members0
Version26.7.0
Revisiondaab053ee433