float y_advance; /*!< distance to advance in the Y direction after drawing these glyphs. Will typically be zero except for vertical text layout as found in East-Asian languages.*/
} vkvg_text_extents_t;
+/**
+ * @brief glyphs position in a @ref VkvgText
+ *
+ * structure defining glyph position as computed for rendering a text run.
+ * the codepoint field is for internal use only.
+ */
+typedef struct _glyph_info_t {
+ int32_t x_advance;
+ int32_t y_advance;
+ int32_t x_offset;
+ int32_t y_offset;
+ /* private */
+ uint32_t codepoint;//should be named glyphIndex, but for harfbuzz compatibility...
+} vkvg_glyph_info_t;
+
/**
* @brief Opaque pointer on a vkvg text run.
*
vkvg_public
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);
+ vkvg_glyph_info_t* pGlyphInfo);
/** @}*/
/**
}
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) {
+ vkvg_glyph_info_t* pGlyphInfo) {
if (index >= textRun->glyph_count) {
- *x_advance = *y_advance = *x_offset = *y_offset = 0;
+ *pGlyphInfo = (vkvg_glyph_info_t){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;
+#if VKVG_USE_HARFBUZZ
+ memcpy (pGlyphInfo, &textRun->glyphs[index], sizeof(vkvg_glyph_info_t));
+#else
+ *pGlyphInfo = textRun->glyphs[index];
+#endif
}
void vkvg_text_run_destroy (VkvgText textRun) {
_font_cache_destroy_text_run (textRun);
if (dev->threadAware)\
mtx_unlock (&dev->fontCache->mutex);
-#ifndef VKVG_USE_HARFBUZZ
-typedef struct _glyph_info_t {
- int32_t x_advance;
- int32_t y_advance;
- int32_t x_offset;
- int32_t y_offset;
- uint32_t codepoint;//should be named glyphIndex, but for harfbuzz compatibility...
-} vkvg_glyph_info_t;
-#endif
-
// Precompute everything necessary to measure and draw one line of text, usefull to draw the same text multiple times.
typedef struct _vkvg_text_run_t {
_vkvg_font_identity_t* fontId; /* vkvg font structure pointer */