×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

TrueType soft font descriptor fields
3

TrueType soft font descriptor fields

TrueType soft font descriptor fields

(OP)
I'm trying to establish where various items, in the descriptor of a downloaded Type 15 (TrueType Scalable) or Type 16 (Universal) PCL5 soft font, are obtained from within the donor TrueType font file, especially if the TTF file does not include a PCLT table (which, according to the OpenType specification, is strongly discouraged anyway).

In particular:

Style (MSB & LSB):
 PCLT  = PCLT.Style
 other = ?

Cell Width:
 PCLT  = -
 other = head.xMax - head.xMin ?

Cell Height:
 PCLT  = -
 other = head.yMax - head.yMin ?

Pitch:
 PCLT  = PCLT.Pitch
 other = ?

x-Height:
 PCLT  = PCLT.xHeight
 other = OS/2.sxHeight ?

Width Type:
 PCLT  = PCLT.WidthType
 other = OS/2.usWidthClass (not 1:1) ?

Stroke Weight:
 PCLT  = PCLT.StrokeWeight
 other = OS/2.usWeightClass (not 1:1) ?

Typeface (MSB & LSB):
 PCLT  = PCLT.TypeFamily
 other = ?

Serif Style:
 PCLT  = PCLT.SerifStyle
 other = ?

Quality:
 PCLT  = -
 other = always assume 2 (=LQ) ?

Text Height:
 PCLT  = -
 other = ?

Text Width:
 PCLT  = -
 other = ?

First Code:
 PCLT  = -
 other = always 0x0020 for Font Type 2 ?

Last Code:
 PCLT  = -
 other = always 0x00ff for Font Type 2 ?

Cap Height:
 PCLT  = PCLT.CapHeight
 other = OS/2.sCapHeight ?

Font Number:
 PCLT  = PCLT.FontNumber
 other = set to zero ?

Font Name:
 PCLT  = PCLT.Typeface
 other = name.I1+ID2 (language-specific)

Master Underline Position:
 PCLT  = -
 other = ?

Master Underline Thickness:
 PCLT  = -
 other = ?


The official PCL5 Technical Reference manual (Chapter 11) is extremely vague about the source , or expected values, of these items for a TrueType format font.

Does anyone have any more useful documentation, information, etc.?

RE: TrueType soft font descriptor fields

Do you not have the TrueType font specification?

I assume you do.

Jim Asman

RE: TrueType soft font descriptor fields

(OP)
Jim

I do have the Microsoft OpenType specification, which goes into reasonable detail about the different tables (and there are lots of 'em) in a TrueType or OpenType font file.

I've also got the PCL5 Technical Reference manual, but this does not go into a great deal of detail about where the descriptor items in question may be obtained, or derived.

Nevertheless, I've managed to produce working PCLETTO (Type 15 format) fonts from .TTF font files - but some of the values in the descriptor (as indicated above) I'm not sure about, and have put in hard-coded substitutes for now, which is obviously not entirely satisfactory.

I'm not sure how relevant some of these items are (putting in fixed hard-coded values does not seem to affect the eventual font usage, other than the stored font selection characteristics); for example:

I think that the cell height value can be derived from the difference between the yMax and yMin values in the head table. But how is the text height item derived?
 

RE: TrueType soft font descriptor fields

I tried to do what you are doing a few years ago, but I wasn't motivated enough to pursue it, and gave up. I usually need something more than academic curiosity with things as complex as this.

Have you tried printing the font through a PCL driver and then comparing the results with the output you generated.

I will have a hunt around for my stuff and see what I find.

You are writing your program in 'C' I presume?

UNIX? DOS?

Jim Asman

RE: TrueType soft font descriptor fields

(OP)
Jim

Written in C++ (using Borland Builder IDE on Windows XP - I only want to code the bits relevant to the application, not all the fancy GUI bits; it's also (up to now) our company standard).

I'd already written the code to create PCLXLETTO (PCL XL Encapsulated TrueType Outline) font files from .TTF files (as none of the font foundries appear to provide this format).

So the PCLETTO output is just rounding off the application (given that 80% of the coding is the same); but PCLXL fonts don't require the same level of detail in the equivalent of the PCL5 font header descriptor.

RE: TrueType soft font descriptor fields

(OP)
... and yes: I have tried printing the font through a PCL driver (for HPLJ4200)and then comparing the results with the output I generate.

For the sample fonts I've 'converted' so far, my output (for the whole font) is the same as that generated by the WinXP LJ4200 driver, apart from:

(a) The character codes used; the Windows drivers only create a subset of the font, for the actual characters used in the document; the character codes generated are unique to that document, and usually start at 0x01 (or perhaps 0x00 - I can't remember), with the data characters being adjusted to suit (so 'Help me' might be encoded as 0x01020304050602).
But I generate characters with codes ranging from 0x20 to 0xff (mapping glyphs for symbol set 19U) so that the font is useable elsewhere.

(b) Some of the values in the font header descriptor; I still can't work out how some of these are derived from values in the .TTF tables (they certainly don't appear to be direct values).

RE: TrueType soft font descriptor fields

DansDad,

Do you have the program 'ttfdump'?

It will display all the parameters in a TTF file.

You should be able to find it on Swiftview's website. I think it was under "technical support". C souurce.


Jim Asman

RE: TrueType soft font descriptor fields

(OP)
Jim

I do have (a version of ) ttfdump; as far as I can recollect, it was actually provided by Microsoft.

It is a useful tool (so have a star for bringing it to everyone's attention).

But I'm still having difficulty in reconciling the values found in the headers of soft fonts dynamically generated by Windows drivers from various TrueType fonts, especially (but not only) if the donor font does not contain a PCLT table.

e.g.:
Elsewhere I've seen statements that imply that 'CellWidth' is derived from the difference between the 'xMax' and 'xMin' values from the 'head' table; this seems to be the case with the fonts I've looked at.

But, for several fonts, the equyivalent 'CellHeight' value does not seem to match the value supposedly derived from the difference between the 'yMax' and 'yMin' values from the same 'head' table.

Perhaps the driver is incorrect (and how important is it anyway? - I don't know how much these values actually influence the printed output)?

I'll spend a bit more (background) time on this over the next month or so, and I'll then post any conclusions I come to in this thread (for the record, or for others to argue over).

RE: TrueType soft font descriptor fields

(OP)
Jim

I've resolved the CellHeight / CellWidth issue (I put them the wrong way round in my earlier post: it was CellWidth I couldn't reconcile).

The reason for the perceived discrepancy was that:
  • the 'ttfdump' output I was using (for the Arial regular font) was created some time last year;
  • the sample driver output was created more recently;
  • the Arial Regular and Arial Bold font variants were replaced in the last Windows XP service pack;
  • the xMax value for Arial Regular has changed (presumably because the new font contains more characters, and (at least) one of these is wider than any characters in the previous set.

RE: TrueType soft font descriptor fields

(OP)
As promised, the conclusions I've come to (for the record, or for others to argue over):

Derivation of items in the descriptor of a downloaded PCL5 Type 15 (TrueType Scalable) or Type 16 (Universal) soft font.

The donor TrueType font file may include an optional PCLT table (although this is strongly discouraged, according to the OpenType specification (see http://www.microsoft.com/typography/otspec/default.htm for details)).

Where TrueType table items are referenced below, these references are shown in the form TableId.ItemName (e.g. head.yMax).

Some item values are fixed; some depend on which characters will be included in the PCL font being constructed; some are obtained from the PCLT table (if present) or an alternative table item, or a default; others are obtained from mandatory tables.

I think that the following list of item values is reasonably accurate, but I can’t claim that it is definitive.

----------------------------------------------
byte(s) 00-01 : Descriptor size
= 72 (fixed value)

----------------------------------------------
byte(s) 02    : Descriptor format
= 15 (TrueType) or
= 16 (Universal)
Font descriptors are the same in both cases (except this field); most modern devices support the preferred format 16, although a few don’t.

----------------------------------------------
byte(s) 03    : Symbol Set Type
= 2 (Bound 8-bit) usually
= other value as required

----------------------------------------------
byte(s) 04    : Style (MSB)
= PCLT.Style (MSB) if PCLT table present
= 0 as default(?) otherwise

----------------------------------------------
byte(s) 05    : Reserved
= 0 (fixed value)

----------------------------------------------
byte(s) 06-07 : Baseline Position
= 0 (fixed value)

----------------------------------------------
byte(s) 08-09 : Cell Width
= head.xMax - head.xMin

----------------------------------------------
byte(s) 10-11 : Cell Height
= head.yMax - head.yMin

----------------------------------------------
byte(s) 12    : Orientation
= 0 (fixed value)

----------------------------------------------
byte(s) 13    : Spacing
= 0 (Fixed-Pitch) if the appropriate Monospaced flag is set in the OS/2.panose classification fields
= 1 (Proportionally-Spaced) otherwise
The position and value of the Monospaced flag varies according to the Panose Family Kind (the value of the first Panose digit); see http://www.monotypeimaging.com/printer/pan1.asp for details.

----------------------------------------------
byte(s) 14-15 : Symbol Set
= Kind1 equivalent of required Symbol Set ID

----------------------------------------------
byte(s) 16-17 : Pitch
= PCLT.Pitch if PCLT table present;
= advance width for space character (usually glyph 4) otherwise.

----------------------------------------------
byte(s) 18-19 : Height
= 0 (fixed value)

----------------------------------------------
byte(s) 20-21 : x-Height
= PCLT.xHeight if PCLT table present
= OS/2.sxHeight otherwise

----------------------------------------------
byte(s) 22    : Width Type
= PCLT.WidthType if PCLT table present
= OS/2.usWidthClass otherwise (modified as there is not a 1:1 mapping)

----------------------------------------------
byte(s) 23    : Style (LSB)
= PCLT.Style (LSB) if PCLT table present
= 0 as default(?) otherwise

----------------------------------------------
byte(s) 24    : Stroke Weight
= PCLT.StrokeWeight if PCLT table present
= OS/2.usWeightClass otherwise (modified as there is not  a 1:1 mapping)

----------------------------------------------
byte(s) 25    : Typeface (LSB)
= PCLT.TypeFamily (LSB) if PCLT table present
= 0 as default(?) otherwise

----------------------------------------------
byte(s) 26    : Typeface (MSB)
= PCLT.TypeFamily (MSB) if PCLT table present
= 0 as default(?) otherwise

----------------------------------------------
byte(s) 27    : Serif Style
= PCLT.SerifStyle if PCLT table present
= 0 as default(?) otherwise

----------------------------------------------
byte(s) 28    : Quality
= 2 (LetterQuality) (fixed value)

----------------------------------------------
byte(s) 29    : Placement
= 0 (fixed value)

----------------------------------------------
byte(s) 30    : Underline Position
= 0 (fixed value)

----------------------------------------------
byte(s) 31    : Underline Thickness
= 0 (fixed value)

----------------------------------------------
byte(s) 32-33 : Text Height
= hhea.yAscender – hhea.yDescender + hhea.yLineGap

----------------------------------------------
byte(s) 34-35 : Text Width
= OS/2.xAvgCharWidth

----------------------------------------------
byte(s) 36-37 : First Code
= 0x0020 for Symbol Set Type 2 usually(?)
= other value for specific font

----------------------------------------------
byte(s) 38-39 : Last Code
= 0x00ff for Symbol Set Type 2 usually(?)
= other value for specific font

----------------------------------------------
byte(s) 40    : Pitch Extended
= 0 (fixed value)

----------------------------------------------
byte(s) 41    : Height Extended
= 0 (fixed value)

----------------------------------------------
byte(s) 42-43 : Cap Height
= PCLT.CapHeight if PCLT table present
= OS/2.sCapHeight otherwise

----------------------------------------------
byte(s) 44-47 : Font Number
= PCLT.FontNumber if PCLT table present
= 0 otherwise

----------------------------------------------
byte(s) 48-63 : Font Name
= PCLT.Typeface if PCLT table present
= name.ID4 (for language = 0x0409) otherwise; value is usually (Big-Endian) Unicode, so must be converted to ANSI

----------------------------------------------
byte(s) 64-65 : Scale Factor
= head.unitsPerEm

----------------------------------------------
byte(s) 66-67 : Master Underline Position
= -(head.unitsPerEm * 20%)

----------------------------------------------
byte(s) 68-69 : Master Underline Thickness
= (head.unitsPerEm * 5%)

----------------------------------------------
byte(s) 70    : Font Scaling Technology
= 1 (TrueType) (fixed value)

----------------------------------------------
byte(s) 71    : Variety
= 0 (fixed value)

RE: TrueType soft font descriptor fields

Thank you!

Jim Asman

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close