Summary: | Customer wants to be able to specify path relative to %windir% for system fonts | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Ray Johnston <ray.johnston> |
Component: | Font API | Assignee: | Vasu Raman <vasuraman> |
Status: | NOTIFIED FIXED | ||
Severity: | enhancement | CC: | alex, chris.liddell, joe, vasuraman |
Priority: | P2 | Keywords: | bountiable |
Version: | master | ||
Hardware: | All | ||
OS: | Windows XP | ||
Customer: | 580 | Word Size: | --- |
Description
Ray Johnston
2010-03-17 19:00:02 UTC
What's wrong with the following? (%os%) (windir) getenv concatstrings (/Fonts/) concatstrings cidfmap file is a PostScript program that can use any PostScipt operators and Ghostscript extensions to construct the path dynamically. For instance, ... (windir) getenv (/Fonts/) concatstrings ... A comment that shows how to do this has been added to the cidfmap file by the rev. The syntax recommended by Alex, and committed to the comments section of cidfmap on 2011-07-29 20:37:42 UTC, is failing on Windows 7-64 with GS 9.04 with the example below. FAILS: /Webdings << /CSI [(Identity) 0] /Path (windir)getenv(/fonts/webdings.ttf)concatstrings /SubfontID 0 /FileType /TrueType >> ; WORKS: /Webdings << /CSI [(Identity) 0] /Path (windir) getenv pop (/fonts/webdings.ttf) concatstrings /SubfontID 0 /FileType /TrueType >> ; Command line testing shows that '(windir) getenv' places two items on the stack: <1> true <2> C:\Windows We need to delete the top item with 'pop' before string concatenation. I updated the examples and documentation to reflect that a few weeks ago, but thanks for pointing it out. Actually, ghostscript's "getenv" operator is defined as: <string> getenv <value_string> true <string> getenv false Thus the correct procedure is: /Webdings << /CSI [(Identity) 0] /Path (windir) getenv not { () } if (/fonts/webdings.ttf) concatstrings /SubfontID 0 /FileType /TrueType >> ; Thus if gentenv returns false, an empty string will be concatenated to the font directory. The updated example in the default cidfmap uses the boolean return to decide whether to fall back to a default value. Does this bug really need reopened? No, I looked in the "Use.htm#CIDFontSubstitution" and didn't see it there. I agree that what's in the Resource/Init/cidfmap looks OK (my comment was based on the the assumption that you had taken the "WORKS" from comment 4 (which would fail if the windir environment wasn't found. What documentation did you update ? Hmm, looks like I didn't update the documentation, just the example. I'll add it to the section about cidfmap on Monday. The current example in cidfmap fails: /Ryumin-Medium << /FileType /TrueType /Path (windir) getenv not {c:/windows}if (/Fonts/BATANG.TTC)concatstrings /SubfontID 3 /CSI [(Japan1) 2] >> ; Should be: /Ryumin-Medium << /FileType /TrueType /Path (windir) getenv not {(c:/windows)}if (/Fonts/BATANG.TTC)concatstrings /SubfontID 3 /CSI [(Japan1) 2] >> ; I've fixed the example (thanks Joe!), and added stuff about "getenv" in cidfmap in the appropriate section in Use.htm. |