Finished first draft for VEFontCache font provider hookup for sokol_gfx (untested)
This commit is contained in:
		| @@ -116,13 +116,6 @@ font_key_from_label :: #force_inline proc( label : string ) -> u64 { | ||||
| 	return hash | ||||
| } | ||||
|  | ||||
| // ve_fontcache_configure_snap | ||||
| configure_snap :: proc( ctx : ^Context, snap_width, snap_height : u32 ) { | ||||
| 	assert( ctx != nil ) | ||||
| 	ctx.snap_width  = snap_width | ||||
| 	ctx.snap_height = snap_height | ||||
| } | ||||
|  | ||||
| // For a provided alpha value, | ||||
| // allows the function to calculate the position of a point along the curve at any given fraction of its total length | ||||
| // ve_fontcache_eval_bezier (quadratic) | ||||
| @@ -358,6 +351,13 @@ shutdown :: proc( ctx : ^Context ) | ||||
| 	shaper_shutdown( & shaper_ctx ) | ||||
| } | ||||
|  | ||||
| // ve_fontcache_configure_snap | ||||
| configure_snap :: proc( ctx : ^Context, snap_width, snap_height : u32 ) { | ||||
| 	assert( ctx != nil ) | ||||
| 	ctx.snap_width  = snap_width | ||||
| 	ctx.snap_height = snap_height | ||||
| } | ||||
|  | ||||
| // ve_fontcache_load | ||||
| load_font :: proc( ctx : ^Context, label : string, data : []byte, size_px : f32 ) -> FontID | ||||
| { | ||||
|   | ||||
| @@ -6,7 +6,7 @@ DrawCall :: struct { | ||||
| 	end_index         : u32, | ||||
| 	clear_before_draw : b32, | ||||
| 	region            : AtlasRegionKind, | ||||
| 	colour            : [4]f32, | ||||
| 	colour            : Colour, | ||||
| } | ||||
|  | ||||
| DrawCall_Default :: DrawCall { | ||||
| @@ -25,11 +25,11 @@ DrawList :: struct { | ||||
| } | ||||
|  | ||||
| FrameBufferPass :: enum u32 { | ||||
| 	None             = 0, | ||||
| 	Glyph            = 1, | ||||
| 	Atlas            = 2, | ||||
| 	Target           = 3, | ||||
| 	Target_Unchanged = 4, | ||||
| 	None            = 0, | ||||
| 	Glyph           = 1, | ||||
| 	Atlas           = 2, | ||||
| 	Target          = 3, | ||||
| 	Target_Uncached = 4, | ||||
| } | ||||
|  | ||||
| GlyphDrawBuffer :: struct { | ||||
| @@ -127,7 +127,7 @@ directly_draw_massive_glyph :: proc( ctx : ^Context, entry : ^Entry, glyph : Gly | ||||
| 	call : DrawCall | ||||
| 	{ | ||||
| 		using call | ||||
| 		pass        = .Target_Unchanged | ||||
| 		pass        = .Target_Uncached | ||||
| 		colour      = ctx.colour | ||||
| 		start_index = u32(ctx.draw_list.indices.num) | ||||
| 		blit_quad( & ctx.draw_list, dst, dst + { dst_width, dst_height }, glyph_position, glyph_position + glyph_size ) | ||||
| @@ -200,7 +200,7 @@ draw_cached_glyph :: proc( ctx : ^Context, entry : ^Entry, glyph_index : Glyph, | ||||
| 	call := DrawCall_Default | ||||
| 	{ | ||||
| 		using call | ||||
| 		pass        = .Target_Unchanged | ||||
| 		pass        = .Target_Uncached | ||||
| 		colour      = ctx.colour | ||||
| 		start_index = cast(u32) ctx.draw_list.indices.num | ||||
|  | ||||
|   | ||||
| @@ -88,7 +88,7 @@ shaper_shape_from_text :: proc( ctx : ^ShaperContext, info : ^ShaperInfo, output | ||||
| 		// script = HB_SCRIPT_LATIN | ||||
| 		harfbuzz.buffer_set_script( buffer, script ) | ||||
| 		harfbuzz.buffer_set_direction( buffer, harfbuzz.script_get_horizontal_direction( script )) | ||||
| 		harfbuzz.set_language( buffer, harfbuzz.language_get_default() ) | ||||
| 		harfbuzz.buffer_set_language( buffer, harfbuzz.language_get_default() ) | ||||
|  | ||||
| 		// Perform the actual shaping of this run using HarfBuzz. | ||||
| 		harfbuzz.shape( font, buffer, nil, 0 ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user