mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-27 14:01:48 -07:00
eliminate font fudge factors; fix size units in freetype backend; fix directory iteration lack-of-robustness-to-failed-dir-open
This commit is contained in:
@@ -525,14 +525,13 @@ fp_raster(Arena *arena, FP_Handle font_handle, F32 size, FP_RasterFlags flags, S
|
||||
}
|
||||
|
||||
//- rjf: draw glyph run
|
||||
Vec2F32 draw_p = {0, (F32)atlas_dim.y - 1};
|
||||
Vec2F32 draw_p = {0, (F32)atlas_dim.y};
|
||||
if(font.face != 0)
|
||||
{
|
||||
F32 descent = round_f32((96.f/72.f)*size * font_metrics.descent / design_units_per_em);
|
||||
F32 line_gap = round_f32((96.f/72.f)*size * font_metrics.lineGap / design_units_per_em);
|
||||
draw_p.y -= descent;
|
||||
draw_p.y -= line_gap;
|
||||
draw_p.y += 1;
|
||||
}
|
||||
DWRITE_GLYPH_RUN glyph_run = {0};
|
||||
if(font.face != 0)
|
||||
|
||||
@@ -68,11 +68,11 @@ fp_metrics_from_font(FP_Handle handle)
|
||||
FP_Metrics result = {0};
|
||||
if(font.face != 0)
|
||||
{
|
||||
result.design_units_per_em = (F32)font.face->units_per_EM;
|
||||
result.design_units_per_em = (F32)(font.face->units_per_EM * 72.f/96.f);
|
||||
result.ascent = (F32)font.face->ascender;
|
||||
result.descent = (F32)font.face->descender;
|
||||
result.line_gap = (F32)(font.face->height - font.face->ascender + font.face->descender);
|
||||
result.capital_height = (F32)(font.face->ascender + font.face->descender);
|
||||
result.capital_height = (F32)(font.face->ascender);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ fp_raster(Arena *arena, FP_Handle handle, F32 size, FP_RasterFlags flags, String
|
||||
|
||||
//- rjf: unpack font
|
||||
FT_Face face = font.face;
|
||||
FT_Set_Pixel_Sizes(face, 0, (FT_UInt)size);
|
||||
FT_Set_Pixel_Sizes(face, 0, (FT_UInt)((96.f/72.f) * size));
|
||||
S64 ascent = face->size->metrics.ascender >> 6;
|
||||
S64 descent = abs_s64(face->size->metrics.descender >> 6);
|
||||
S64 height = face->size->metrics.height >> 6;
|
||||
|
||||
@@ -569,7 +569,7 @@ os_file_iter_next(Arena *arena, OS_FileIter *iter, OS_FileInfo *info_out)
|
||||
{
|
||||
B32 good = 0;
|
||||
OS_LNX_FileIter *lnx_iter = (OS_LNX_FileIter *)iter->memory;
|
||||
for(;;)
|
||||
for(;lnx_iter->dir != 0;)
|
||||
{
|
||||
// rjf: get next entry
|
||||
lnx_iter->dp = readdir(lnx_iter->dir);
|
||||
|
||||
+1
-1
@@ -2767,7 +2767,7 @@ ui_box_text_position(UI_Box *box)
|
||||
FNT_Tag font = box->font;
|
||||
F32 font_size = box->font_size;
|
||||
FNT_Metrics font_metrics = fnt_metrics_from_tag_size(font, font_size);
|
||||
result.y = floor_f32((box->rect.p0.y + box->rect.p1.y)/2.f) + font_metrics.capital_height/2.f - 1.f;
|
||||
result.y = floor_f32((box->rect.p0.y + box->rect.p1.y)/2.f) + font_metrics.ascent/2.f - 2.f;
|
||||
if(!fnt_tag_match(font, ui_icon_font()))
|
||||
{
|
||||
result.y += font_metrics.descent/2;
|
||||
|
||||
Reference in New Issue
Block a user