Skip to documentation
SLOP

tiny.filigree.glyphAtlasAlloc

Reference tiny.filigree glyphAtlasAlloc

Defined in font.raster.

Called byCallstest sourcelib.filigree.src.font.rastertest: atlas packs fixture glyph bitma...private sourcelib.filigree.src.font.rasterblankGlyphprivate sourcelib.filigree.src.font.rasterfontScalefont.rasterglyphBitmapAllocprivate sourcelib.filigree.src.font.rasterpackAtlasAllocprivate sourcelib.filigree.src.font.rasterscaleMetricfont.rasterloadAtlasAlloc
Static calls · unresolved targets: 0 · external targets: 9.

Source

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

zig
pub fn loadAtlasAlloc(    output_allocator: std.mem.Allocator,    scratch_allocator: std.mem.Allocator,    font_bytes: []const u8,    font_size: i32,    glyph_ids: []const i32,    codepoints: []const i32,    padding: i32,) Error!Atlas {    if (font_size <= 0) return error.InvalidPixelSize;    if (padding < 0 or glyph_ids.len == 0 or glyph_ids.len != codepoints.len) return error.InvalidAtlas;    const face = face_table.Face.init(font_bytes) catch return error.InvalidFont;    if ((face.tableSlice("glyf") == null or face.tableSlice("loca") == null) and face.tableSlice("CFF ") == null) return error.UnsupportedOutline;    const bitmaps = try scratch_allocator.alloc(GlyphBitmap, glyph_ids.len);    var bitmap_count: usize = 0;    errdefer {        for (bitmaps[0..bitmap_count]) |bitmap| bitmap.deinit(scratch_allocator);        scratch_allocator.free(bitmaps);    }    var glyph_scratch = std.heap.ArenaAllocator.init(scratch_allocator);    defer glyph_scratch.deinit();    for (glyph_ids, codepoints) |raw_glyph_id, codepoint| {        const glyph_id = std.math.cast(u32, raw_glyph_id) orelse return error.GlyphIdTooLarge;        var bitmap = glyphBitmapAlloc(scratch_allocator, glyph_scratch.allocator(), face, glyph_id, font_size) catch |err| switch (err) {            error.UnsupportedOutline => blankGlyph(glyph_id, scaleMetric(face.advanceWidth(glyph_id), fontScale(face, font_size))),            else => return err,        };        bitmap.codepoint = codepoint;        bitmaps[bitmap_count] = bitmap;        bitmap_count += 1;        _ = glyph_scratch.reset(.retain_capacity);    }    const atlas = try packAtlasAlloc(output_allocator, bitmaps, font_size, padding);    for (bitmaps) |bitmap| bitmap.deinit(scratch_allocator);    scratch_allocator.free(bitmaps);    return atlas;}

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

zig
pub const glyphAtlasAlloc = font.glyphAtlasAlloc;

Also reachable as

font.glyphAtlasAlloc.

Audit

Definitions1
Public names3
Members0
Version26.7.0
Revisiondaab053ee433