From 98bfb90e1107749d28e5f9764d15032eab0db742 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Wed, 19 Jan 2022 10:44:15 +0100 Subject: [PATCH] fix ps/pdf printing if started with no X or no graphics --- src/psprint.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/psprint.c b/src/psprint.c index 720b0826..9044238a 100644 --- a/src/psprint.c +++ b/src/psprint.c @@ -345,14 +345,24 @@ static void ps_draw_string(int layer, const char *str, short rot, short flip, in double size, height, ascent, descent; int llength=0, no_of_lines, longest_line; - if(str==NULL || !has_x ) return; + if(str==NULL) return; size = xscale*53.; height = size*xctx->mooz * 1.147; /* was 1.147 */ ascent = size*xctx->mooz * 0.808; /* was 0.908 */ descent = size*xctx->mooz * 0.219; /* was 0.219 */ - text_bbox(str, xscale, yscale, rot, flip, hcenter, vcenter, + #ifdef HAS_CAIRO==1 + if(!has_x) + text_bbox_nocairo(str, xscale, yscale, rot, flip, hcenter, vcenter, x,y, &textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line); + else + text_bbox(str, xscale, yscale, rot, flip, hcenter, vcenter, + x,y, &textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line); + #else + text_bbox(str, xscale, yscale, rot, flip, hcenter, vcenter, + x,y, &textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line); + #endif + if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2, xctx->areay2,textx1,texty1,textx2,texty2)) { return;