aa
This commit is contained in:
parent
3f4280ae37
commit
063b46cec4
@ -95,8 +95,8 @@ pub const Font = struct {
|
||||
|
||||
try rects.append(allocator, .{
|
||||
.id = @intCast(index),//@intCast(face.glyph().glyphIndex()),
|
||||
.w = @intCast(bmp.width()),
|
||||
.h = @intCast(bmp.rows()),
|
||||
.w = @max(1, @as(c_int, @intCast(bmp.width()))),
|
||||
.h = @max(1, @as(c_int, @intCast(bmp.rows()))),
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.was_packed = 0,
|
||||
@ -111,7 +111,6 @@ pub const Font = struct {
|
||||
try face.loadGlyph(index, .{ .render = true });
|
||||
|
||||
const bmp = face.glyph().bitmap();
|
||||
const buf = bmp.buffer() orelse continue;
|
||||
|
||||
const pitch: usize = @intCast(bmp.pitch());
|
||||
const w: usize = @intCast(bmp.width());
|
||||
@ -120,6 +119,7 @@ pub const Font = struct {
|
||||
const dst_x: usize = @intCast(rect.x);
|
||||
const dst_y: usize = @intCast(rect.y);
|
||||
|
||||
if (bmp.buffer()) |buf| {
|
||||
for (0..h) |y| {
|
||||
const src = buf[y * pitch .. y * pitch + w];
|
||||
|
||||
@ -128,6 +128,7 @@ pub const Font = struct {
|
||||
|
||||
@memcpy(dst, src);
|
||||
}
|
||||
}
|
||||
|
||||
// std.log.info("{}", .{bmp.width()});
|
||||
const width : i32 = @intCast(bmp.width());
|
||||
@ -374,7 +375,8 @@ pub const Font = struct {
|
||||
// rl.gl.rlTexCoord2f(st1.x, st1.y); rl.gl.rlVertex2f(p1.x, p1.y);
|
||||
// rl.gl.rlTexCoord2f(st1.x, st0.y); rl.gl.rlVertex2f(p1.x, p0.y);
|
||||
} else {
|
||||
std.log.warn("kb_text_shape found the glyph, but we didn't load it from the font.", .{});
|
||||
std.log.warn("kb_text_shape found the glyph, but we didn't load it from the font. index {}", .{RunGlyph.Id});
|
||||
std.log.warn("advance_x {}", .{advance_x});
|
||||
x_offset += dpi_advance_x;
|
||||
y_offset += dpi_advance_y;
|
||||
continue;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user