diff options
Diffstat (limited to 'source/fitz/text.c')
-rw-r--r-- | source/fitz/text.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/source/fitz/text.c b/source/fitz/text.c index 87aa2e79..735b3a5b 100644 --- a/source/fitz/text.c +++ b/source/fitz/text.c @@ -80,7 +80,7 @@ fz_grow_text_span(fz_context *ctx, fz_text_span *span, int n) } void -fz_show_glyph(fz_context *ctx, fz_text *text, fz_font *font, int wmode, const fz_matrix *trm, int gid, int ucs) +fz_show_glyph(fz_context *ctx, fz_text *text, fz_font *font, const fz_matrix *trm, int gid, int ucs, int wmode) { fz_text_span *span; @@ -98,6 +98,26 @@ fz_show_glyph(fz_context *ctx, fz_text *text, fz_font *font, int wmode, const fz span->len++; } +void +fz_show_string(fz_context *ctx, fz_text *text, fz_font *user_font, fz_matrix *trm, const char *s, int wmode) +{ + fz_font *font; + int gid, ucs; + float adv; + + while (*s) + { + s += fz_chartorune(&ucs, s); + gid = fz_encode_character_with_fallback(ctx, user_font, ucs, 0, &font); + fz_show_glyph(ctx, text, font, trm, gid, ucs, wmode); + adv = fz_advance_glyph(ctx, font, gid, wmode); + if (wmode == 0) + fz_pre_translate(trm, adv, 0); + else + fz_pre_translate(trm, 0, -adv); + } +} + fz_rect * fz_bound_text(fz_context *ctx, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *bbox) { |