Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recommendation Required: Format 0/6 or Format 4 cmap subtable for SFT

Status
Not open for further replies.

tal6499

Programmer
Nov 9, 2011
42
0
0
PK
Hi,

I have successfully converted donor ttf to SFT(PCL 5).

Glyf indices are extracted from cmap's Format 6 or 0 sub-table.
I know that either of these tables are found in tff files.
But not sure whether one of them must appear?

I need a recommendation to use a cmap sub-table for conversion if only first 256 characters are required.

If I have to use Format 4, what would be the process to extract the indices. Formula given in Microsoft's Open Type Documentation seems to be confusing.
 
The specification page (in )for the 'cmap' table states:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
All Microsoft Unicode BMP encodings (Platform ID = 3, Encoding ID = 1) must provide at least a Format 4 'cmap' subtable. If the font is meant to support supplementary (non-BMP) Unicode characters, it will additionally need a Format 12 subtable with a platform encoding ID 10. The contents of the Format 12 subtable need to be a superset of the contents of the Format 4 subtable. Microsoft strongly recommends using a BMP Unicode 'cmap' for all fonts.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

and

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Format 0: Byte encoding table
This is the Apple standard character to glyph index mapping table.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


As I read it, if you are using a Windows platform, then the TrueType fonts are very likely to contain a 'format 4' subtable (within the Unicode BMP platform=3, encoding=0 table), but may quite possibly NOT contain_subtables of other platform/encoding/format.
.. and I don't think that the original Apple character set is a strict (8-bit) subset of Unicode.

So you almost certainly need to use 'format 4' (Segment mapping to delta values).

This supposition is reinforced by the specification (in the "PCL6 Soft Font Download Specification" document (see Tek-Tips FAQs this ('PCL') forum for where to get PCL6 documentation) for some of the fields following the GT segment header: Search Range, Entry Selector and Range Shift.

As far as I can tell (from a swift perusal) these are only defined in the 'format 4' cmap subtable.

... and I agree: the 'format 4' subtable is quite complicated, but (even if I could remember exactly how it should be interpreted) explaining how to decode it is possibly beyond what could be provided in a reasonably short response.
 
>> ... if only first 256 characters are required ...

Note that the 'format 0' (Apple) subtable will prove access only to the first 256 GLYPHS - this is NOT necessarily the same as the first 256 CHARACTERS (as identified by their Unicode code-point values).
 
The sample code for generating PCL XL Encapsulated TrueType Outline fonts, provided by HP with their source for 'xlttlib' MAY help you to understand the 'format 4' subtable of the 'cmap' table.

Note that this code ONLY proceeds if there is a 'format 4' subtable - otherwise it reports an error, and exits.

The process should be exactly the same for PCL5, except that the 'encapsulation' is different.

Documentation and code for 'xlttlib' can be obtained, along with other PCL6 documentation, from the HP Developer web site:


Select the "Public Software Development Kits" option.

Then select the "LaserJet and Digital Sender" kit area.

Then select the "Printer Languages | PCL 6 | PCL 6 documents" folder, which gives access to various PCL6 documents (most are in PDF format) and tools.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top