×
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

Soft Font embedding in PCL File

Soft Font embedding in PCL File

Soft Font embedding in PCL File

(OP)
Hello, I have to write a java program that creates pcl files. Now I have to embed an external font (Arial Unicode MS) in the file. As I'm relatively new to PCL I'm stuck now with several questions. Hopefully they are easy to answer for you guys. If I refer to "the manual" I mean the "PCL 5 Printer Language Technical Reference Manual" from HP.

1.) The manual says that for unbound fonts (10 and 11) the first code / last code can be set to 0. Does this apply for TrueType (15) too? If not, what values do I have to use? From the OS/2 table for Arial Unicode MS I get 0 and 65535 as firstCharIndex and lastCharIndex?
 
2.) For calculating the checksum in the font header do I have to take every single byte from 64 to the last reserved byte as one single value or every "value field" as one value e.g. master underline position (0xFE, 0x67 = 2byte) => values = 254 + 103 (FE + 67) or value = 65127 (FE67)?
 
3.) What are the "design units" from the manual?
 
4.) Where do I get the font numbers from? Does it matter, if the number is set to zero?
 
5.)  Symbol Set: The manual says it must be set to 56 for fonts 10 and 11 (unbound Intellifont scalable). => Applies for TrueType?
 
6.) Pitch: Where do I get this value from?
 
7.) Character Download: How do I determine the GlyphID?
 
8.) Are reserved bytes always set to 0 or doesn't it matter?
 
9.) The data written in the TrueType Glyph Data part is the data from the glyf table from the TrueTypeFont file?

10.) Among others I'm using escapeE from RedTitan as a PCLViewer, PCLAnalzyer. It always says that my checksum for my character download is not correct. Right now I'm converting every byte from Character Data Size, Glyph ID and TrueType Glyph Data to an unsigned integer. So the values of my bytes have a range of 0 to 255. I add all resulting integers, calculate result = sum mod 256 and convert the result back to a byte value and write it into the checksum field. Is this way right?

Hopefully someone can help me. I'm stuck with theese questions for quite a while as I don't find any precise information. Of course I searched the forum prior to posting this.

Regards

Alex

RE: Soft Font embedding in PCL File

Some of your questions may be answered in thread286-1092001

I'll try to answer some of the others next time I log in (but this may not be for a week or so, as I shall be away).

RE: Soft Font embedding in PCL File

Q1: The manual says that for unbound fonts (10 and 11) the first code / last code can be set to 0. Does this apply for TrueType (15) too? If not, what values do I have to use? From the OS/2 table for Arial Unicode MS I get 0 and 65535 as firstCharIndex and lastCharIndex?

A1: I would expect to set these values (usually start=0x20 and end=hex code of last character you are defining) although it is possible that some/many printers may ignore the values.

Bear in mind that TrueType fonts tend to be unbound (or, more accurately, bound to Unicode) and may include hundreds, or even thousands, of characters.
For printer fonts, you will probably want (or perhaps have no option but) to bind each font to a particular symbol set (and perhaps limit the number of characters to less than 256); otherwise you may have to download symbol set definitions to the printer as well (if you're not sure that the printer has the required definitions) in order to select characters from an unbound font.

 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q2: For calculating the checksum in the font header do I have to take every single byte from 64 to the last reserved byte as one single value or every "value field" as one value e.g. master underline position (0xFE, 0x67 = 2byte) => values = 254 + 103 (FE + 67) or value = 65127 (FE67)?

A2: Every single byte (I can't remember for sure if byte 64 is included or not).

 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q3: What are the "design units" from the manual?

A3: Intellifont uses 'design units'; but as you are unlikely to be able to find any documentation on Intellifont, I wouldn't recommend this format (which is not supported by PCL6, by the way).
TrueType fonts use 'unitsPerEm' as part of the design mechanism; most fonts uses a value of 2048 for this, and it should anyway (for efficiency) be set to a power of 2 - but this will be a property of your 'donor' TrueType (.TTF) font, so you can't change it anyway.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q4: Where do I get the font numbers from? Does it matter, if the number is set to zero?

A4: I don't think that this is important, other than to help identify different fonts; thread286-1092001 may provide more detail.

 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q5: Symbol Set: The manual says it must be set to 56 for fonts 10 and 11 (unbound Intellifont scalable). => Applies for TrueType?

A5: The Kind1 value of 56 equates to a Symbol Set of 1X; this is a reserved value for 'unbound' fonts.
Type 10 is unbound Intellifont scalable, where glyph IDs are mapped to HP Master Symbol List values.
Type 11 is unbound TrueType scalable, where glyph IDs are mapped to Unicode values.

But (as mentioned in A1:) you're probably better sticking to bound fonts.

  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q6: Pitch: Where do I get this value from?

A6: See thread286-1092001 for detail.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q7: Character Download: How do I determine the GlyphID?

A7: A TrueType (.TTF) font defines glyphs (i.e. character shapes), each with its own ID.
Such fonts also include (one or more?) character to glyph mapping tables, most commonly (but not always?) mapping glyphs to Unicode character codes for Windows fonts.

You need to make use of the mapping tables, together with a knowledge of how 'your' symbol set maps to Unicode, in order to determine which parts of the glyph table to copy as part of each character definition.

 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q8: Are reserved bytes always set to 0 or doesn't it matter?

A8: You should always set reserved bytes to a (binary) zero value.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q9: The data written in the TrueType Glyph Data part is the data from the glyf table from the TrueTypeFont file?

A9: You need to refer to the TrueType (OpenType) specification, available on the Microsoft Typography web site.

In addition, HP provide some sample 'C' code to generate the PCL6 (PCL XL) equivalent of a PCL5 Format 15 (TrueType) or 16 (Universal) soft font from a 'donor' TrueType font; although the headers are obviously different, the 'body' is essentially the same, so this code should help you here.

[As an aside, it is a non-trivial mechanism!]

The sample code can be found on the same site as the PCL6 documentation (see the FAQs section in this (PCL) forum for details of where to find the documentation) under 'PCL6 Tools'.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q10: Among others I'm using escapeE from RedTitan as a PCLViewer, PCLAnalzyer. It always says that my checksum for my character download is not correct. Right now I'm converting every byte from Character Data Size, Glyph ID and TrueType Glyph Data to an unsigned integer. So the values of my bytes have a range of 0 to 255. I add all resulting integers, calculate result = sum mod 256 and convert the result back to a byte value and write it into the checksum field. Is this way right?

A10: I can't remember precisely how the checksums are calculated; the sample code referred to in A9: will provide help here.

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