update fonts
This commit is contained in:
parent
c637de10ff
commit
c00c404006
6
fonts.d
6
fonts.d
@ -13,6 +13,7 @@ struct FontAtlas
|
|||||||
f32 descent;
|
f32 descent;
|
||||||
f32 line_gap;
|
f32 line_gap;
|
||||||
f32 max_advance;
|
f32 max_advance;
|
||||||
|
f32 line_height;
|
||||||
u32 width;
|
u32 width;
|
||||||
u32 height;
|
u32 height;
|
||||||
Glyph[128] glyphs;
|
Glyph[128] glyphs;
|
||||||
@ -102,6 +103,10 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
|
|||||||
// TODO: proper packing algorithm
|
// TODO: proper packing algorithm
|
||||||
if(font != null)
|
if(font != null)
|
||||||
{
|
{
|
||||||
|
i64 bbox_ymax = font.bbox.yMax >> 6;
|
||||||
|
i64 bbox_ymin = font.bbox.yMin >> 6;
|
||||||
|
|
||||||
|
abuf.atlas.line_height = cast(f32)(bbox_ymax - bbox_ymin);
|
||||||
abuf.atlas.units_per_em = cast(f32)font.units_per_EM;
|
abuf.atlas.units_per_em = cast(f32)font.units_per_EM;
|
||||||
abuf.atlas.ascent = cast(f32)font.ascender;
|
abuf.atlas.ascent = cast(f32)font.ascender;
|
||||||
abuf.atlas.descent = cast(f32)font.descender;
|
abuf.atlas.descent = cast(f32)font.descender;
|
||||||
@ -259,3 +264,4 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
|
|||||||
|
|
||||||
return abuf;
|
return abuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user