* 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
/**
/**
* @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);
+void vkvg_text_run_get_glyph_position (VkvgText textRun,
+ uint32_t index,
+ int32_t* const x_advance,
+ int32_t* const y_advance,
+ int32_t* const x_offset,
+ int32_t* const y_offset);
/** @}*/
/**
_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_get_glyph_position (VkvgText textRun,
+ uint32_t index,
+ int32_t* const x_advance,
+ int32_t* const y_advance,
+ int32_t* const x_offset,
+ int32_t* const y_offset) {
+ if (index >= textRun->glyph_count) {
+ *x_advance = *y_advance = *x_offset = *y_offset = 0;
+ return;
+ }
+ *x_advance = textRun->glyphs[index].x_advance;
+ *y_advance = textRun->glyphs[index].y_advance;
+ *x_offset = textRun->glyphs[index].x_offset;
+ *y_offset = textRun->glyphs[index].y_offset;
}
void vkvg_text_run_destroy (VkvgText textRun) {
_font_cache_destroy_text_run (textRun);