Renders to glyph and I think the atlas targets (but not the screen)

This commit is contained in:
Edward R. Gonzalez 2024-06-13 20:44:10 -04:00
parent 7ec00edfbd
commit bcb684e140
3 changed files with 8 additions and 4 deletions

View File

@ -123,7 +123,7 @@ font_key_from_label :: #force_inline proc( label : string ) -> u64 {
eval_point_on_bezier3 :: proc( p0, p1, p2 : Vec2, alpha : f32 ) -> Vec2
{
starting_point := p0 * (1 - alpha) * (1 - alpha)
control_point := p1 * 2.0 * (1 - alpha)
control_point := p1 * 2.0 * (1 - alpha) * alpha
end_point := p2 * alpha * alpha
point := starting_point + control_point + end_point
@ -237,6 +237,9 @@ init :: proc( ctx : ^Context, parser_kind : ParserKind,
ctx.backing = allocator
context.allocator = ctx.backing
if curve_quality == 0 {
curve_quality = 6
}
ctx.curve_quality = curve_quality
error : AllocatorError
@ -469,7 +472,7 @@ cache_glyph :: proc( ctx : ^Context, font : FontID, glyph_index : Glyph, scale,
f32(bounds_0.x) - 21,
f32(bounds_0.y) - 33,
}
// Note(Original Author): Figure out scaling so it fits within our box.
draw := DrawCall_Default
draw.pass = FrameBufferPass.Glyph

View File

@ -235,7 +235,8 @@ draw_filled_path :: proc( draw_list : ^DrawList, outside_point : Vec2, path : []
{
log("outline_path:")
for point in path {
logf(" point: %v", point * scale + translate )
vec := point * scale + translate
logf(" %0.2f %0.2f", vec.x, vec.y )
}
}

View File

@ -457,7 +457,7 @@ font_load :: proc(path_file : string,
logf("Loading font: %v", path_file)
provider_data := & get_state().font_provider_data; using provider_data
font_data, read_succeded : = os.read_entire_file( path_file )
font_data, read_succeded : = os.read_entire_file( path_file, persistent_allocator() )
verify( b32(read_succeded), str_fmt("Failed to read font file for: %v", path_file) )
font_data_size := cast(i32) len(font_data)