fix fonts
This commit is contained in:
parent
10c7fdcaed
commit
eee6918981
6
fonts.d
6
fonts.d
@ -103,10 +103,12 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension, bool y_origin_
|
|||||||
// TODO: proper packing algorithm
|
// TODO: proper packing algorithm
|
||||||
if(font != null)
|
if(font != null)
|
||||||
{
|
{
|
||||||
|
FT_Set_Pixel_Sizes(font, 0, cast(FT_UInt)((96.0f/72.0f) * size));
|
||||||
|
|
||||||
i64 bbox_ymax = font.bbox.yMax >> 6;
|
i64 bbox_ymax = font.bbox.yMax >> 6;
|
||||||
i64 bbox_ymin = font.bbox.yMin >> 6;
|
i64 bbox_ymin = font.bbox.yMin >> 6;
|
||||||
|
|
||||||
abuf.atlas.line_height = cast(f32)(bbox_ymax - bbox_ymin);
|
abuf.atlas.line_height = size;
|
||||||
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;
|
||||||
@ -119,7 +121,6 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension, bool y_origin_
|
|||||||
|
|
||||||
foreach(FT_ULong char_code; 0 .. 0x7F)
|
foreach(FT_ULong char_code; 0 .. 0x7F)
|
||||||
{
|
{
|
||||||
FT_Set_Char_Size(font, font_size, 0, 0, 0);
|
|
||||||
FT_Error res = FT_Load_Char(font, char_code, cast(FT_Int32)FT_LOAD_RENDER);
|
FT_Error res = FT_Load_Char(font, char_code, cast(FT_Int32)FT_LOAD_RENDER);
|
||||||
if(res != 0)
|
if(res != 0)
|
||||||
{
|
{
|
||||||
@ -150,7 +151,6 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension, bool y_origin_
|
|||||||
|
|
||||||
foreach(FT_ULong char_code; 0 .. 0x7F)
|
foreach(FT_ULong char_code; 0 .. 0x7F)
|
||||||
{
|
{
|
||||||
FT_Set_Char_Size(font, font_size, 0, 0, 0);
|
|
||||||
FT_Error res = FT_Load_Char(font, char_code, cast(FT_Int32)FT_LOAD_RENDER);
|
FT_Error res = FT_Load_Char(font, char_code, cast(FT_Int32)FT_LOAD_RENDER);
|
||||||
if(res != 0)
|
if(res != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user