Bug 696823 - Loading the font which has index!=0 in TrueType Collection by .loadfont
Summary: Loading the font which has index!=0 in TrueType Collection by .loadfont
Status: RESOLVED DUPLICATE of bug 695903
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Font API (show other bugs)
Version: 9.19
Hardware: PC Windows 8
: P4 normal
Assignee: Chris Liddell (chrisl)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-06 06:39 UTC by Masamichi Hosoda
Modified: 2016-06-08 04:24 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Masamichi Hosoda 2016-06-06 06:39:25 UTC
I'd like to use "MS-PMincho" font which has index=1 in TrueType Collection msmincho.ttc.
(It's a Japanese Windows font.)

I've tried the following but the font cannot be found.

```
GPL Ghostscript 9.19 (2016-03-23)
Copyright (C) 2016 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GS>(c:/Windows/Fonts/msmincho.ttc) (r) file .loadfont
GS>/MS-PMincho findfont
Querying operating system for font files...
Can't find (or can't open) font file %rom%Resource/Font/MS-PMincho.
Can't find (or can't open) font file MS-PMincho.
Didn't find this font on the system!
Substituting font Courier for MS-PMincho.
Loading NimbusMono-Regular font from %rom%Resource/Font/NimbusMono-Regular... 51
68528 3521168 14527956 13223436 1 done.
GS<1>
```

On the other hand, "MS-Mincho" font which has index=0 in TTC can be used as following.

```
GPL Ghostscript 9.19 (2016-03-23)
Copyright (C) 2016 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GS>(c:/Windows/Fonts/msmincho.ttc) (r) file .loadfont
GS>/MS-Mincho findfont
GS<1>
```

I guess that .loadfont loads the font which has index=0 only.
Can GS load the font which has index!=0 in TrueType Collection?
Comment 1 Ken Sharp 2016-06-06 06:48:33 UTC
If you want to use a TrueType collection (or a member) as a font, you need to add it to your cidfmap and use it as a CIDFont.

Currently you can't really use TrueType Collections as a Font, they must be a CIDFont, I don't think you can usefully use a CJKV font as a PostScript Font anyway, since you'd be limited to 255 characters.

NB Don't try to use undocumented Ghostscript language extensions! Use the documented method for loading fonts :-)

Since you are using Windows you will need to retrieve the support files from the Ghostscript source (either use Git to access our repository or pick one of the source tarballs). You will then need the contents of /ghostpdl/Resource/Init copied locally, and you will need to modify cidfmap and then tell Ghostscript to 'Include' the directory in the search path by using the -I switch.

The format of entries in cidfmap is documented in comments in the file itself.
Comment 2 Masamichi Hosoda 2016-06-07 06:11:22 UTC
Thank you for your advice.
Comment 3 Chris Liddell (chrisl) 2016-06-08 04:24:35 UTC

*** This bug has been marked as a duplicate of bug 695903 ***