tiny.filigree.glyphAtlasAlloc
Defined in font.raster.
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
Audit
| Definitions | 1 |
|---|---|
| Public names | 3 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |