summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Johnston <ray.johnston@artifex.com>2021-03-19 11:51:11 -0700
committerRay Johnston <ray.johnston@artifex.com>2021-03-22 10:07:03 -0700
commitfd919a2ed8b39b91e43ee6202207de6fe9929002 (patch)
tree221f833b8f65056f21fcab104650fc80291afec3
parent0583cf70c06e8041af1a639e7e3ee6e41ecb2b76 (diff)
downloadghostpdl-fd919a2ed8b39b91e43ee6202207de6fe9929002.tar.gz
Bug 703246: Improve the efficiency of CMap processing
Thanks to Peter Cherepanov for this patch, This improves the performance of the file mentioned in Comment #8 of bug 702381. complaints (that I can recall) about the performance, b
-rw-r--r--Resource/Init/gs_cmap.ps51
1 files changed, 34 insertions, 17 deletions
diff --git a/Resource/Init/gs_cmap.ps b/Resource/Init/gs_cmap.ps
index 0c2e14215..111043867 100644
--- a/Resource/Init/gs_cmap.ps
+++ b/Resource/Init/gs_cmap.ps
@@ -224,11 +224,19 @@
/beginbfchar { % <count> beginbfchar -
pop mark
} bind def
-/endbfchar { % <code> <to_code|charname> ... endbfchar
- counttomark 2 idiv {
- counttomark -2 roll % process in correct order
- .addbfchar
- } repeat 1 .appendmap
+/endbfchar { % [ <code> <to_code|charname> ... endbfchar
+ ] [ //true % [<da><ta>] [ true
+ 3 -1 roll % [ true [<da><ta>]
+ {
+ exch {
+ //false % [ <da> false
+ } { % [ <da> <ta>
+ .addbfchar % [ prefix params key value font_index
+ //true
+ } ifelse
+ } forall
+ pop
+ 1 .appendmap
} bind def
/beginbfrange { % <count> beginbfrange -
@@ -236,26 +244,35 @@
} bind def
/endbfrange { % <code_lo> <code_hi> <to_code|(charname*)> ...
% endbfrange -
- counttomark 3 idiv {
- counttomark -3 roll % process in correct order
- dup type dup /arraytype eq exch /packedarraytype eq or {
+ ] [ 0 % [<da><ta><set>] [ 0
+ 3 -1 roll % [ 0 [<da><ta><set>]
+ {
+ exch % [ <da> 0
+ { 1 2
+ {
+ dup type dup /arraytype eq exch /packedarraytype eq or {
% Array value, split up.
- exch pop {
+ exch pop {
% Stack: code to_code|charname
- 1 index exch .addbfchar
+ 1 index exch .addbfchar
% Increment the code. As noted above, we require
% that only the last byte vary, but we still must
% mask it after incrementing, in case the last
% value was 0xff.
% Stack: code prefix params key value fontindex
- 6 -1 roll dup length string copy
- dup dup length 1 sub 2 copy get 1 add 255 and put
- } forall pop
- } {
+ 6 -1 roll dup length string copy
+ dup dup length 1 sub 2 copy get 1 add 255 and put
+ } forall pop
+ } {
% Single value, handle directly.
- .addbfrange
- } ifelse
- } repeat 1 .appendmap
+ .addbfrange
+ } ifelse
+ 0
+ }
+ } exch get exec
+ } forall
+ pop
+ 1 .appendmap
} bind def
/.addbfchar { % <code> <to_code|charname> .addbfchar