From 8cd50a7b778658c70ccbdb2cdf979ff842fef686 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 13 Apr 2026 01:58:06 -0600 Subject: [PATCH] [gpu] Add hb_gpu_draw_get_scale companion getter hb_gpu_draw_set_scale() existed without a paired getter; all other draw/paint contexts have get/set pairs. Fill the gap for symmetry. Assisted-by: Claude Opus 4.6 (1M context) --- docs/harfbuzz-sections.txt | 1 + src/hb-gpu-draw.cc | 20 ++++++++++++++++++++ src/hb-gpu.h | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 010f6e6de..e46cfa5bc 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -1129,6 +1129,7 @@ hb_gpu_draw_set_user_data hb_gpu_draw_get_user_data hb_gpu_draw_get_funcs hb_gpu_draw_set_scale +hb_gpu_draw_get_scale hb_gpu_draw_glyph hb_gpu_draw_encode hb_gpu_draw_clear diff --git a/src/hb-gpu-draw.cc b/src/hb-gpu-draw.cc index 77828bd28..c42ffe289 100644 --- a/src/hb-gpu-draw.cc +++ b/src/hb-gpu-draw.cc @@ -1014,6 +1014,26 @@ hb_gpu_draw_set_scale (hb_gpu_draw_t *draw, draw->y_scale = y_scale; } +/** + * hb_gpu_draw_get_scale: + * @draw: a GPU shape encoder + * @x_scale: (out): horizontal scale + * @y_scale: (out): vertical scale + * + * Gets the font scale previously set via hb_gpu_draw_set_scale() or + * hb_gpu_draw_glyph(). + * + * XSince: REPLACEME + **/ +void +hb_gpu_draw_get_scale (const hb_gpu_draw_t *draw, + int *x_scale, + int *y_scale) +{ + if (x_scale) *x_scale = draw->x_scale; + if (y_scale) *y_scale = draw->y_scale; +} + /** * hb_gpu_draw_glyph: * @draw: a GPU shape encoder diff --git a/src/hb-gpu.h b/src/hb-gpu.h index f34bcf35b..744eed63a 100644 --- a/src/hb-gpu.h +++ b/src/hb-gpu.h @@ -96,6 +96,11 @@ hb_gpu_draw_set_scale (hb_gpu_draw_t *draw, int x_scale, int y_scale); +HB_EXTERN void +hb_gpu_draw_get_scale (const hb_gpu_draw_t *draw, + int *x_scale, + int *y_scale); + /* Draw */ HB_EXTERN hb_draw_funcs_t *