diff options
Diffstat (limited to 'fitz/res_text.c')
-rw-r--r-- | fitz/res_text.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/fitz/res_text.c b/fitz/res_text.c index cdfaaa98..643b4c9f 100644 --- a/fitz/res_text.c +++ b/fitz/res_text.c @@ -1,4 +1,4 @@ -#include "fitz.h" +#include "fitz-internal.h" fz_text * fz_new_text(fz_context *ctx, fz_font *font, fz_matrix trm, int wmode) @@ -118,23 +118,30 @@ fz_add_text(fz_context *ctx, fz_text *text, int gid, int ucs, float x, float y) text->len++; } -static int isxmlmeta(int c) +static int +isxmlmeta(int c) { return c < 32 || c >= 128 || c == '&' || c == '<' || c == '>' || c == '\'' || c == '"'; } -void fz_debug_text(fz_context *ctx, fz_text *text, int indent) +static void +do_print_text(FILE *out, fz_text *text, int indent) { int i, n; for (i = 0; i < text->len; i++) { for (n = 0; n < indent; n++) - putchar(' '); + fputc(' ', out); if (!isxmlmeta(text->items[i].ucs)) - printf("<g ucs=\"%c\" gid=\"%d\" x=\"%g\" y=\"%g\" />\n", + fprintf(out, "<g ucs=\"%c\" gid=\"%d\" x=\"%g\" y=\"%g\" />\n", text->items[i].ucs, text->items[i].gid, text->items[i].x, text->items[i].y); else - printf("<g ucs=\"U+%04X\" gid=\"%d\" x=\"%g\" y=\"%g\" />\n", + fprintf(out, "<g ucs=\"U+%04X\" gid=\"%d\" x=\"%g\" y=\"%g\" />\n", text->items[i].ucs, text->items[i].gid, text->items[i].x, text->items[i].y); } } + +void fz_print_text(fz_context *ctx, FILE *out, fz_text *text) +{ + do_print_text(out, text, 0); +} |