Bug 690653 - unexpected font selection
Summary: unexpected font selection
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: General (show other bugs)
Version: master
Hardware: Macintosh Linux
: P4 normal
Assignee: Chris Liddell (chrisl)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-25 11:19 UTC by Henry Stiles
Modified: 2015-03-17 07:13 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
Ghostscript_New_Color_Management.pdf (256.47 KB, application/pdf)
2009-08-28 09:46 UTC, Henry Stiles
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Henry Stiles 2009-07-25 11:19:48 UTC
"/TimesNewRomanPSMT findfont" selects the system font in /usr/share/...  After
Times-Roman is substituted for the TimesNewRomanPSMT the algorithm looks first
at system fonts before %rom%.  %rom% should be preferred, uninstalling the
system font allows the %rom%Resource/Font/NimbusRomNo9L-Regu...
Of course, "/Times-Roman findfont" select the rom urw font as expected.
Comment 1 Alex Cherepanov 2009-08-18 09:11:22 UTC
This problem is caused by the interaction between fontconfig and
Fontmap features. As a work-around, Ghostscript can be configured with
--disable-fontconfig flag. This bug may cause raster differences
between hosts.

The test can be split into 2 parts:
/aaa findfont pop      % calls fontconfig
/Times-Roman findfont  % loads the font from fontconfig location

Initially, Fontmap file maps /Times-Roman to /NumbusRomNo9L-Regu
There's no entry for /NumbusRomNo9L-Regu .

fontconfig maps all font names to the corresponding files in the system
location.

As a result, /NumbusRomNo9L-Regu is mapped to the system location and
/Times-Roman is redirected to the same place.

Comment 2 Ralph Giles 2009-08-18 09:30:54 UTC
Really, I think the problem is that the native font enumeration is overriding
what's in the Fontmap. Can we just change the code to avoid overwriting existing
names?
Comment 3 Henry Stiles 2009-08-28 09:46:42 UTC
Created attachment 5344 [details]
Ghostscript_New_Color_Management.pdf

The attachment (Michael's color management document) is another example of the
fontconfig problem.  I believe fontconfig is below reasonable functionality
standards to be the default configuration.

./gs ~/Downloads/Ghostscript_New_Color_Management.pdf 
GPL Ghostscript 8.70 (2009-07-28)
Copyright (C) 2009 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 21.
Page 1
Substituting font Times-Roman for Times New Roman.
Loading NimbusRomNo9L-Regu font from %rom%Resource/Font/NimbusRomNo9L-Regu...
2376936 1052123 11409548 10103367 3 done.
Substituting font Times-Bold for Times New Roman,Bold.
Loading NimbusRomNo9L-Medi font from %rom%Resource/Font/NimbusRomNo9L-Medi...
2514176 1193585 11446308 10140906 3 done.
>>showpage, press <return> to continue<<

Page 2
Substituting font Times-Roman for Times New Roman.
Substituting font Times-Bold for Times New Roman,Bold.
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Querying operating system for font files...

Error: /rangecheck in /findfont
Operand stack:
   --dict:9/18(L)--   F6   12	FontObject   --dict:9/9(L)--   --dict:9/9(L)-- 
 Arial	 Arial
Execution stack:
   %interp_exit   .runexec2   --nostringval--	--nostringval--  
--nostringval--   2   %stopped_push   --nostringval--	--nostringval--  
--nostringval--   false   1   %stopped_push   1862   1	 3   %oparray_pop  
1861   1   3   %oparray_pop   1845   1	 3   %oparray_pop   --nostringval--  
--nostringval--   3   1   21   --nostringval--	 %for_pos_int_continue	
--nostringval--   --nostringval--   --nostringval--   --nostringval--  
%array_continue   --nostringval--   false   1	%stopped_push	--nostringval--
  %loop_continue   --nostringval--   --nostringval--   --nostringval--	
--nostringval--   --nostringval--   --nostringval--   1820   8	 9  
%oparray_pop
Dictionary stack:
   --dict:1146/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--  
--dict:75/200(L)--   --dict:106/127(ro)(G)--   --dict:285/300(ro)(G)--	
--dict:22/25(L)--   --dict:4/6(L)--   --dict:27/40(L)--
Current allocation mode is local
GPL Ghostscript 8.70: Unrecoverable error, exit code 1
Comment 4 Henry Stiles 2009-09-04 10:17:58 UTC
I'm afraid we do need to turn off fontconfig and cairo (link dependency) until
this is resolved.  There are simply too many broken files.  Assign the problem
back to Alex when it the default is disabled.  We'll try fontconfig again when
(and if) this problem is fixed.
Comment 5 Hin-Tak Leung 2010-08-02 00:32:32 UTC
Re-assigning bugs which still have work to do.
Comment 6 Ray Johnston 2010-09-02 17:03:17 UTC
Assigning to Chris per discussion with Henry. This isn't exactly a font issue,
but he can work with Alex to determine the best way to tackle it.
Comment 7 Chris Liddell (chrisl) 2015-03-17 07:13:55 UTC
Fixed in:
http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=3edd8e8e

We will now first check the explicitly defined fontmap (i.e. the one built from the file Resource/Init/FontMap), *then* we'll check for the font resource file by name (i.e. in Resource/Font), and last we'll check the native fonts.

The problem with the cluster is unsolvable if we keep fontconfig and don't specify the exact font set installed on every cluster machine.

If we do want reinstate the fontconfig option in the cluster builds, we can keep consistent results by disabling it at run-time with the "-dNONATIVEFONTMAP" option.