[gs-commits] ghostpdl branch, pdfi, updated. jbig2dec-0.14-2325-gd0bf928

[email protected] (Ken Sharp) Thu, 3 Oct 2019 15:49:23 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, pdfi has been updated
       via  d0bf928a84a194f5bb83a3959ada38be667d2a5c (commit)
      from  b91eda99180bcd0c745ab8d4f6b15eec57cef0f3 (commit)

----------------------------------------------------------------------
commit d0bf928a84a194f5bb83a3959ada38be667d2a5c
Author: Ken Sharp <[email protected]>
Date:   Thu Oct 3 16:49:15 2019 +0100

    Another interim commit
    
    This, I believe, now handles text rendering modes involving clipping
    correctly. There are a number of progressions, mainly due to not trying
    to clip text when we don't actually handle the font yet, but there are
    some genuine progressions.
    
    The code needs tidying up but with a staff meeting coming up I likely
    won't get the time to do that for a while, and I don;t want to lose
    this work.

diff --git a/pdf/pdf_text.c b/pdf/pdf_text.c
index fb2c4be..ff6e43d 100644
--- a/pdf/pdf_text.c
+++ b/pdf/pdf_text.c
@@ -61,6 +61,8 @@ int pdfi_ET(pdf_context *ctx)
     }
 
     ctx->TextBlockDepth--;
+    if (gs_currenttextrenderingmode(ctx->pgs) >= 4)
+        gs_clip(ctx->pgs);
     return code;
 }
 
@@ -377,9 +379,11 @@ static int pdfi_show(pdf_context *ctx, pdf_string *s)
     } else {
         if (Trmode != 0 && Trmode != 3 && !ctx->preserve_tr_mode) {
             text.operation |= TEXT_DO_FALSE_CHARPATH;
-            pdfi_gsave(ctx);
-            gs_newpath(ctx->pgs);
-            gs_moveto(ctx->pgs, 0, 0);
+            if (Trmode < 4) {
+                pdfi_gsave(ctx);
+                gs_newpath(ctx->pgs);
+                gs_moveto(ctx->pgs, 0, 0);
+            }
         } else {
             if (Trmode == 3)
                 text.operation = TEXT_DO_NONE | TEXT_RENDER_MODE_3;
@@ -398,6 +402,19 @@ static int pdfi_show(pdf_context *ctx, pdf_string *s)
             ctx->current_text_enum = NULL;
         }
 
+        if (Trmode >= 4) {
+            pdfi_gsave(ctx);
+            gs_newpath(ctx->pgs);
+            gs_moveto(ctx->pgs, 0, 0);
+            code = gs_text_begin(ctx->pgs, &text, ctx->memory, &penum);
+            if (code >= 0) {
+                ctx->current_text_enum = penum;
+                code = gs_text_process(penum);
+                gs_text_release(penum, "pdfi_Tj");
+                ctx->current_text_enum = NULL;
+            }
+        }
+
         switch(Trmode) {
             case 0:
                 /* Text has been drawn, put the colours back again */
@@ -431,14 +448,14 @@ static int pdfi_show(pdf_context *ctx, pdf_string *s)
                 pdfi_grestore(ctx);
                 gs_swapcolors(ctx->pgs);
                 pdfi_grestore(ctx);
-                gs_clip(ctx->pgs);
+//                gs_clip(ctx->pgs);
                 break;
             case 5:
                 pdfi_gsave(ctx);
                 gs_stroke(ctx->pgs);
                 pdfi_grestore(ctx);
                 pdfi_grestore(ctx);
-                gs_clip(ctx->pgs);
+//                gs_clip(ctx->pgs);
                 break;
             case 6:
                 gs_swapcolors(ctx->pgs);
@@ -450,11 +467,11 @@ static int pdfi_show(pdf_context *ctx, pdf_string *s)
                 gs_stroke(ctx->pgs);
                 pdfi_grestore(ctx);
                 pdfi_grestore(ctx);
-                gs_clip(ctx->pgs);
+//                gs_clip(ctx->pgs);
                 break;
             case 7:
                 pdfi_grestore(ctx);
-                gs_clip(ctx->pgs);
+//                gs_clip(ctx->pgs);
                 break;
             default:
                 pdfi_grestore(ctx);


Summary of changes:
 pdf/pdf_text.c | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)