From: Jean-Philippe Bruyère Date: Wed, 23 Feb 2022 06:15:25 +0000 (+0100) Subject: add vkvg_create_text_run_with_length to vkvg.h X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=19bc61899bac5837ad0445eab23d0d952e001ef7;p=jp%2Fvkvg.git add vkvg_create_text_run_with_length to vkvg.h --- diff --git a/include/vkvg.h b/include/vkvg.h index e6918de..de3dcd9 100644 --- a/include/vkvg.h +++ b/include/vkvg.h @@ -1533,18 +1533,28 @@ void vkvg_font_extents (VkvgContext ctx, vkvg_font_extents_t* extents); //text run holds harfbuz datas, and prevent recreating them multiple times for the same line of text. /** - * @brief + * @brief Create a new text run. * * @param ctx a valid vkvg @ref context - * @param text + * @param text Null terminated utf8 string. * @return VkvgText */ vkvg_public VkvgText vkvg_text_run_create (VkvgContext ctx, const char* text); /** - * @brief + * @brief Create a new text run for a non null terminated string. * - * @param textRun + * @param ctx a valid vkvg @ref context + * @param text non null terminated utf8 string. + * @param length glyphs count, not to be confused with byte length. + * @return VkvgText + */ +vkvg_public +VkvgText vkvg_text_run_create_with_length (VkvgContext ctx, const char* text, uint32_t length) +/** + * @brief Release ressources holded by the text run. + * + * @param VkvgtextRun A valid VkvgText pointer. */ vkvg_public void vkvg_text_run_destroy (VkvgText textRun); diff --git a/src/vkvg_context.c b/src/vkvg_context.c index f000bf1..868cc6f 100644 --- a/src/vkvg_context.c +++ b/src/vkvg_context.c @@ -1149,7 +1149,7 @@ VkvgText vkvg_text_run_create (VkvgContext ctx, const char* text) { _font_cache_create_text_run(ctx, text, -1, tr); return tr; } -VkvgText vkvg_text_run_create2 (VkvgContext ctx, const char* text, uint32_t length) { +VkvgText vkvg_text_run_create_with_length (VkvgContext ctx, const char* text, uint32_t length) { if (ctx->status) return NULL; VkvgText tr = (vkvg_text_run_t*)calloc(1, sizeof(vkvg_text_run_t));