Browse Source

added kerning support

Iver 4 months ago
parent
commit
21586d384f

BIN
build/librasteriver.so


BIN
build/libsourparse.so


BIN
build/main.bin


BIN
compiled_libs/librasteriver.so


BIN
compiled_libs/libsourparse.so


+ 3 - 1
src/launch_program/main.c

@@ -77,7 +77,7 @@ int main(){
 
     scene->antialiasing_subsample_resolution = 8;
     scene->flags = RI_SCENE_DONT_USE_AA;
-    
+
     RI_clear_texture(text_plane_material->texture_reference);
 
     RI_render_text(comic_sans, text_plane_material->texture_reference, (RI_vector_2f){0, 0}, 0xFFFFFFFF, 2, 80, "WOWWWW!!!11!!");
@@ -120,6 +120,8 @@ int main(){
         fps = 1.0 / delta_time;
     }
 
+    free(fps_string);
+
     RI_stop(0);
 
     SP_free_font(comic_sans);

+ 9 - 4
src/library/rasteriver.c

@@ -162,12 +162,16 @@ void written_RI_free(void *__ptr, const char *caller, int line){
 }
 
 RI_texture* RI_request_empty_texture(RI_vector_2 resolution){
-    RI_texture *new_texture = RI_malloc(sizeof(RI_texture));
+    int previous_loaded_texture_count = ri.loaded_texture_count;
+
+    ri.loaded_texture_count++;
+
+    ri.loaded_textures = RI_realloc(ri.loaded_textures, sizeof(RI_texture) * ri.loaded_texture_count);
 
-    new_texture->image_buffer = RI_malloc(sizeof(uint32_t) * resolution.x * resolution.y);
-    new_texture->resolution = resolution;
+    ri.loaded_textures[previous_loaded_texture_count].image_buffer = RI_malloc(sizeof(uint32_t) * resolution.x * resolution.y);
+    ri.loaded_textures[previous_loaded_texture_count].resolution = resolution;
 
-    return new_texture;
+    return &ri.loaded_textures[previous_loaded_texture_count];
 }
 
 void RI_clear_texture(RI_texture *target_texture){
@@ -300,6 +304,7 @@ void render_glyph(RI_texture *target_texture, RI_vector_2f position, double size
         }
     }
 
+    RI_free(lines);
     RI_free(new_points);
     RI_free(contour_ends);
 }