This commit is contained in:
Matthew 2025-12-26 17:19:23 +11:00
parent 5b6a36f845
commit 4c84d0ca40

26
fonts.d
View File

@ -108,10 +108,7 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
Logf("%f %f %f", font.height, font.ascender, font.descender);
u32 max_w;
u32 max_h;
u32 current_h;
u32 count;
u32 max_w, max_h, current_h, count;
i32 font_size = Float26(size);
@ -182,10 +179,7 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
u8 p_r = bmp.buffer[offset+2];
u8 p_a = bmp.buffer[offset+3];
abuf.data[offset+0] = DeMultiply(p_r, p_a);
abuf.data[offset+1] = DeMultiply(p_b, p_a);
abuf.data[offset+2] = DeMultiply(p_g, p_a);
abuf.data[offset+3] = p_a;
abuf.data[offset .. offset+4] = [DeMultiply(p_r, p_a), DeMultiply(p_b, p_a), DeMultiply(p_g, p_a), p_a];
}
}
} break;
@ -210,11 +204,7 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
x = max_w + c;
u64 offset = (y*dimension + x) * 4;
abuf.data[offset+0] = 255;
abuf.data[offset+1] = 255;
abuf.data[offset+2] = 255;
abuf.data[offset+3] = (bits & 0x80) ? 255 : 0;
abuf.data[offset .. offset+4] = [255, 255, 255, bits & 0x80 ? 255 : 0];
bits <<= 1;
}
@ -232,10 +222,7 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
x = max_w + c;
u64 offset = (y*dimension + x) * 4;
abuf.data[offset+0] = 255;
abuf.data[offset+1] = 255;
abuf.data[offset+2] = 255;
abuf.data[offset+3] = bmp.buffer[r*bmp.pitch + c];
abuf.data[offset .. offset+4] = [255, 255, 255, bmp.buffer[r*bmp.pitch + c]];
}
}
} break;
@ -273,3 +260,8 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
return abuf;
}
unittest
{
}