This commit is contained in:
2026-09-12 10:23:04 -05:00
parent 217e270ad1
commit 311cf7534e

17
glue.c
View File

@@ -46,7 +46,7 @@ ALLEGRO_FONT *al_load_ttf_font_f(ALLEGRO_FILE *file,
}
void *filebuf = malloc(filesize);
SFT sft = { .flags = SFT_DOWNWARD_Y };
SFT sft = { .flags = 0 };
ALLEGRO_FONT *f = NULL;
ALLEGRO_BITMAP *gtex = NULL;
int result = 0;
@@ -102,18 +102,25 @@ ALLEGRO_FONT *al_load_ttf_font_f(ALLEGRO_FILE *file,
//}
block =
al_lock_bitmap_region(gtex, woff, hoff, geom.minWidth, geom.minHeight,
ALLEGRO_PIXEL_FORMAT_ABGR_8888, ALLEGRO_LOCK_WRITEONLY);
ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8, ALLEGRO_LOCK_READWRITE);
ALLEGRO_INFO("got lock\n");
img.width = geom.minWidth;
img.height = geom.minHeight;
img.pixels = block->data;
//if (0 > sft_render(&sft, glyph, img)) goto glyph_lookup_fail; // FIXME UB
img.pixels = malloc(img.width * img.height);
if (!img.pixels) goto glyph_lookup_oom;
if (0 > sft_render(&sft, glyph, img)) goto glyph_lookup_fail;
ALLEGRO_INFO("got raster\n");
free(fuck);
// todo copy bytes to texture
al_unlock_bitmap(gtex);
ALLEGRO_INFO("unlock\n");
ALLEGRO_INFO("blit raster to vram\n");
i++; continue;
glyph_lookup_oom:
ALLEGRO_ERROR("No buffer to generate glyph %c in %s\n", cache_text_str[i], filename);
FAIL;
glyph_lookup_fail:
ALLEGRO_ERROR("Failure generating glyph %c in %s!\n", cache_text_str[i], filename);
FAIL;