Bug 700556 - Mystery behavior for .origdefinefont, .origundefinefont, .origfindfont
Summary: Mystery behavior for .origdefinefont, .origundefinefont, .origfindfont
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Resource (show other bugs)
Version: master
Hardware: All All
: P4 normal
Assignee: Chris Liddell (chrisl)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-31 16:03 UTC by Nancy Durgin
Modified: 2022-02-28 16:23 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nancy Durgin 2019-01-31 16:03:04 UTC
This isn't necessarily a bug, but is behavior that we don't understand.

In gs_res.ps there is this code:

% Make sure the old definitions are still in systemdict so that                                           
% they will get bound properly.                                                                                   
 systemdict begin
  /.origdefinefont /definefont load def
  /.origundefinefont /undefinefont load def
  /.origfindfont /findfont load def
end

.origdefinefont, .origundefinefont and .origfindfont are not referenced anywhere else, but this code cannot be deleted without causing problems.

It works okay to undef these 3 procedures in gs_init.ps, after all the initialization is complete, but never defining them at all doesn't work for some reason.


Some of the problems occur in these samples:

this will segfault:
debugbin/gs -IResource/Init -Z: -sDEFAULTPAPERSIZE=letter -dBATCH -dClusterJob -dJOBSERVER -sDEVICE=ppmraw -dMaxBitmap=4000m -r300 -o out.bin /home/nad/work/samples/tests_private/comparefiles/Bug692361.pdf
Loading NimbusSans-Regular font from Resource/Font/NimbusSans-Regular... Can't find font with non-string name: false.
Can't find (or can't open) font file Resource/Font/false.
Can't find font with non-string name: false.
Querying operating system for font files...
Can't find (or can't open) font file Resource/Font/false.
Can't find font with non-string name: false.
Didn't find this font on the system!
Substituting font Courier for false.
Loading NimbusMonoPS-Regular font from Resource/Font/NimbusMonoPS-Regular... Can't find font with non-string name: false.
Can't find (or can't open) font file Resource/Font/false.
Can't find font with non-string name: false.
Didn't find this font on the system!
Unable to substitute for font.
Error: /invalidfont in /findfont
Operand stack:
   Helvetica   Helvetica   Helvetica
Execution stack:
   %interp_exit   .runexec2   --nostringval--   .findfontop   --nostringval--   2   %stopped_push   --nostringval--   .findfontop   .findfontop   false   1   %stopped_push   1960   1   3   %oparray_pop   1959   1   3   %oparray_pop   1958   1   3   %oparray_pop   .findfontop   1947   1   3   %oparray_pop   1803   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   .findfontop   --nostringval--   2   %stopped_push   --nostringval--   .findfontop   1896   3   4   %oparray_pop
Dictionary stack:
   --dict:826/1123(ro)(G)--   --dict:0/20(G)--   --dict:88/200(L)--   --dict:2/53(L)--
(SEGFAULT)

Other samples with issues:
tests/Ghent_V5.0/GWG091_FontSupport-OpenType_X4.pdf
tests/eps/executable-fontbbox.eps
Comment 1 Chris Liddell (chrisl) 2019-01-31 16:06:42 UTC
Just a note that adding a bind to the definition of /definefont in gs_fonts.ps allows the:

/.origdefinefont /definefont load def

line to be removed. I assume that doing the same for /undefinefont and /findfont would work similarly.

This *may* be the solution, but we'd all like to understand a bit better what's going on before accepting that.
Comment 2 Ray Johnston 2020-05-15 13:17:24 UTC
Bumping over to Chris for handling -- seems like he's already had a look into
it, and fonts are in his area of expertise. Of course, closing as WONTFIX
seems reasonable since other than a point of confusion it doesn't seem to
cause any harm (or expose any dangerous operators).
Comment 3 Chris Liddell (chrisl) 2022-02-28 16:23:21 UTC
Fixed in:
https://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=a9e0b6839b44