]> O.S.I.I.S - jp/vkvg.git/commitdiff
implement vkvg_text_run_get_glyph_positions
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 23 Feb 2022 15:49:33 +0000 (16:49 +0100)
committerj-p <jp_bruyere@hotmail.com>
Sat, 26 Feb 2022 10:05:24 +0000 (11:05 +0100)
include/vkvg.h
src/vkvg_context.c

index a06897666967d9be65036ec200497efa0b47e90f..2c57513b5a6f120255c6b811d07fca797da59127 100644 (file)
@@ -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);
 /** @}*/
 
 /**
index a1e5f0839c6c113db2e1137574d8cbea1cbb5864..eef9be8d573f219d0e33d6b787ae8940e9263b9d 100644 (file)
@@ -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);