summaryrefslogtreecommitdiff
path: root/pdf/pdf_font.c
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2021-11-03 08:59:28 +0000
committerChris Liddell <chris.liddell@artifex.com>2021-11-04 08:32:45 +0000
commitc1e51c99bbbc1c92b24019c5720ed15c1955dfb2 (patch)
treeb13af7259fec8f109e869698177a3f5faca33800 /pdf/pdf_font.c
parentee7fc706dbdf4a0f66757674b5fb88db3e3ab58e (diff)
downloadghostpdl-c1e51c99bbbc1c92b24019c5720ed15c1955dfb2.tar.gz
Bug 704680: Fix font loading info message file descriptor
The code writing font loading information to the back channel originally only did so for debug builds, in (partially) converting it work on non-debug builds, I'd accidentally had some of it writing to stderr - ending up with some message parts going to stdout and some to stderr. Fix that so it's consistent, and works with non-debug builds.
Diffstat (limited to 'pdf/pdf_font.c')
-rw-r--r--pdf/pdf_font.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c
index 7fa8a4272..79522c112 100644
--- a/pdf/pdf_font.c
+++ b/pdf/pdf_font.c
@@ -316,12 +316,18 @@ static const char *pdfi_font_substitute_by_flags(unsigned int flags)
return "Helvetica"; /* Really shouldn't ever happen */
}
-static void pdfi_emprint_font_name(pdf_context *ctx, pdf_name *n)
+/* Print a name object to stdout */
+static void pdfi_print_font_name(pdf_context *ctx, pdf_name *n)
{
- int i;
- for (i = 0; i < n->length; i++) {
- dmprintf1(ctx->memory, "%c", n->data[i]);
- }
+ if (ctx->args.QUIET != true)
+ (void)outwrite(ctx->memory, (const char *)n->data, n->length);
+}
+
+/* Print a null terminated string to stdout */
+static void pdfi_print_string(pdf_context *ctx, const char *str)
+{
+ if (ctx->args.QUIET != true)
+ (void)outwrite(ctx->memory, str, strlen(str));
}
static int
@@ -389,19 +395,20 @@ pdfi_open_font_substitute_file(pdf_context *ctx, pdf_dict *font_dict, pdf_dict *
if (code >= 0) {
gs_const_string fname;
if (basefont) {
- dmprintf(ctx->memory, "Loading font ");
- pdfi_emprint_font_name(ctx, (pdf_name *)basefont);
- dmprintf(ctx->memory, " (or substitute) from ");
+ pdfi_print_string(ctx, "Loading font ");
+ pdfi_print_font_name(ctx, (pdf_name *)basefont);
+ pdfi_print_string(ctx, " (or substitute) from ");
}
else {
- dmprintf(ctx->memory, "Loading nameless font from ");
+ pdfi_print_string(ctx, "Loading nameless font from ");
}
sfilename(s, &fname);
if (fname.size < gp_file_name_sizeof) {
memcpy(fontfname, fname.data, fname.size);
fontfname[fname.size] = '\0';
}
- dmprintf1(ctx->memory, "%s.\n", fontfname);
+ pdfi_print_string(ctx, fontfname);
+ pdfi_print_string(ctx, "\n");
sfseek(s, 0, SEEK_END);
*buflen = sftell(s);