From: Jean-Philippe Bruyère Date: Wed, 23 Feb 2022 15:49:33 +0000 (+0100) Subject: implement vkvg_text_run_get_glyph_positions X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=c2925b2c779bf748256b85c61966a722becf2985;p=jp%2Fvkvg.git implement vkvg_text_run_get_glyph_positions --- diff --git a/include/vkvg.h b/include/vkvg.h index a068976..2c57513 100644 --- a/include/vkvg.h +++ b/include/vkvg.h @@ -316,6 +316,13 @@ typedef struct _vkvg_device_t* VkvgDevice; * configurable parameters such as the wrap mode, the filtering, etc... */ typedef struct _vkvg_pattern_t* VkvgPattern; +/** + * @brief Opaque pointer on a Vkvg glyph info structure. + * @ingroup context + * + * glyph info contains glyph positions in a text run. + */ +typedef struct vkvg_glyph_info_t* VkvgGlyphInfo; #if VKVG_DBG_STATS /** @@ -1584,6 +1591,15 @@ void vkvg_show_text_run (VkvgContext ctx, VkvgText textRun); */ vkvg_public void vkvg_text_run_get_extents (VkvgText textRun, vkvg_text_extents_t* extents); +/** + * @brief retrieve glyph positions. + * + * @param textRun + * @param pGlyphPositions + * @param pGlyphCount + */ +vkvg_public +void vkvg_text_run_get_glyph_positions (VkvgText textRun, VkvgGlyphInfo* pGlyphPositions, uint32_t* pGlyphCount); /** @}*/ /** diff --git a/src/vkvg_context.c b/src/vkvg_context.c index a1e5f08..eef9be8 100644 --- a/src/vkvg_context.c +++ b/src/vkvg_context.c @@ -1167,6 +1167,10 @@ VkvgText vkvg_text_run_create_with_length (VkvgContext ctx, const char* text, ui _font_cache_create_text_run(ctx, text, length, tr); return tr; } +void vkvg_text_run_get_glyph_positions (VkvgText textRun, VkvgGlyphInfo *pGlyphPositions, uint32_t* pGlyphCount) { + *pGlyphPositions = (VkvgGlyphInfo)textRun->glyphs; + *pGlyphCount = textRun->glyph_count; +} void vkvg_text_run_destroy (VkvgText textRun) { _font_cache_destroy_text_run (textRun); free (textRun);