From 19bc61899bac5837ad0445eab23d0d952e001ef7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Wed, 23 Feb 2022 07:15:25 +0100 Subject: [PATCH] add vkvg_create_text_run_with_length to vkvg.h --- include/vkvg.h | 18 ++++++++++++++---- src/vkvg_context.c | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) 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)); -- 2.47.3