Hello! First of all, I would like to express my gratitude for this amazing library! I've been using kb_text_shape in my project since v2.25 and it's a complete life-saver!
However, after upgrading from 2.25 to 2.28e my project began to report misaligned loads and to crash on kbts_ShapePopFont calls. Since I was using my custom allocator I thought the problem was with my allocator but using kb_text_shape with default allocator produced the same crash.
When I was integrating kb_text_shape in my project I was using refpad as a kind of documentation, and when these crashes appeared I decided to test kb_text_shape 2.28e with refpad and all of a sudden refpad began crashing too.
My guess is there is that some kind of memory corruption happens in the lifetime / arena management code because the crash is happening in kbts__EndLifetime
My shaping logic looks pretty much correct but let me know if I'm doing something wrong
vl_result_t vl_font_shaper_univesal_process(vl_font_shaper_t *shaper, const char *text, size_t text_length) {
vl_font_shaper_universal_t *s = (vl_font_shaper_universal_t*) shaper;
if (!shaper->font_stack || VL_DA_LENGTH(shaper->font_stack) == 0) {
vl_global_error_pool_append("font stack is either empty or NULL for vl_font_shaper_t %p", shaper);
return VL_ERROR;
}
int fonts_count = 0;
for (int i = 0; i < VL_DA_LENGTH(shaper->font_stack); i++) {
vl_font_shaper_font_ref_universal_t *uf = (vl_font_shaper_font_ref_universal_t*) shaper->font_stack[i];
if (!uf) continue;
for (int j = 0; j < VL_DA_LENGTH(uf->fonts); j++) {
kbts_ShapePushFont(s->context, uf->fonts + j);
fonts_count++;
}
}
kbts_ShapeBegin(s->context, KBTS_DIRECTION_DONT_KNOW, KBTS_LANGUAGE_DONT_KNOW);
kbts_ShapeUtf8(s->context, text, text_length, KBTS_USER_ID_GENERATION_MODE_CODEPOINT_INDEX);
kbts_ShapeEnd(s->context);
for (int i = 0; i < fonts_count; i++) {
kbts_ShapePopFont(s->context);
}
return VL_SUCCESS;
}Activity
0No activity yet.