fix fonts (properly this time)
This commit is contained in:
parent
c00c404006
commit
74f992ade1
9
fonts.d
9
fonts.d
@ -87,7 +87,7 @@ DeMultiply(u8 color, u8 alpha)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FontAtlasBuf
|
FontAtlasBuf
|
||||||
CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
|
CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension, bool y_origin_top = true)
|
||||||
{
|
{
|
||||||
assert(dimension >= 128, "Dimension must be at least 128");
|
assert(dimension >= 128, "Dimension must be at least 128");
|
||||||
|
|
||||||
@ -240,14 +240,16 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
|
|||||||
|
|
||||||
f32 height = glyph.metrics.height >> 6;
|
f32 height = glyph.metrics.height >> 6;
|
||||||
f32 width = glyph.metrics.width >> 6;
|
f32 width = glyph.metrics.width >> 6;
|
||||||
f32 top = -font.glyph.bitmap_top;
|
f32 top = font.glyph.bitmap_top;
|
||||||
f32 left = font.glyph.bitmap_left;
|
f32 left = font.glyph.bitmap_left;
|
||||||
|
|
||||||
|
static assert(y_origin_top, "only y_origin_top is currently supported");
|
||||||
|
|
||||||
g.ch = cast(dchar)char_code;
|
g.ch = cast(dchar)char_code;
|
||||||
g.advance = cast(f32)(glyph.advance.x >> 6);
|
g.advance = cast(f32)(glyph.advance.x >> 6);
|
||||||
g.plane_left = left;
|
g.plane_left = left;
|
||||||
g.plane_right = g.plane_left + width;
|
g.plane_right = g.plane_left + width;
|
||||||
g.plane_top = top;
|
g.plane_top = cast(f32)(bbox_ymax) - top;
|
||||||
g.plane_bottom = g.plane_top + height;
|
g.plane_bottom = g.plane_top + height;
|
||||||
|
|
||||||
g.atlas_top = max_h;
|
g.atlas_top = max_h;
|
||||||
@ -265,3 +267,4 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
|
|||||||
return abuf;
|
return abuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user