Sam Howard Sam is a developer at IDRsolutions who specialises in font rendering and conversion. He's also enjoyed working with SVG, Java 3D, Java FX and Swing.

Should Type 3 Font support be dropped from the PDF Specification?

1 min read

The PDF format has been around for at least 20 years now, and throughout that time it’s continued to add the latest and greatest technologies – from Unicode to OpenType – to its portfolio. This means that the range of fonts now supported are as follows:

  1. Type1
  2. MMType1
  3. Type3
  4. TrueType
  5. Type0
  6. CIDFontType0
  7. CIDFontType2
  8. Type1C
  9. CIDFontType0C
  10. OpenType

Most of the fonts we see inside PDF files are OpenType, TrueType, Type 1 or Type 1C. MMType1, Type0 and CID fonts are all extensions of those formats, which leaves Type 3 as the black sheep of the flock.

Type 3 fonts, along with Type 1 fonts, were first released in 1984 along with the PostScript specification. Type 1 offered a condensed set of PostScript operators, along with special commands for hinting, which gives the renderer some ideas of which features are most important for readability. Type 3, in contrast, offered the full range of PostScript commands but had no commands for hinting. Upon launch, Adobe released full documentation for Type 3 fonts, but kept Type 1 to themselves – they didn’t release any documentation, and used plenty of encryption on their Type 1 fonts.

This set the font world on an interesting course. Font foundries favoured Type 1 but were forced to use Type 3, Microsoft purchased a reverse engineered PostScript interpreter with Type 1 support called TrueImage, and Apple started work on a competing font format.

They later traded access to this format – TrueType – with Microsoft in exchange for a license to use TrueImage. Apple then almost immediately replaced TrueImage with an official PostScript license from Adobe, but both companies started to work on building TrueType support into their upcoming operating systems. (Both Mac OS System 7 and Windows 3.1 would feature TrueType support upon their release in 1991 and 1992 respectively.)

Adobe’s response to the looming emergence of a rival format and their loosening control over Type 1 technology was obvious – in 1990, they released the Type 1 specification to the font foundries and Type 1 quickly overtook Type 3 as the format of choice. To this day Type 1 and TrueType technology remain popular, although admittedly primarily through OpenType, which combines features from both.

When Adobe debuted the PDF format in 1993, they included support for Type 1 fonts, and a new version of Type 3 which uses PDF graphics commands instead of postscript operators.

Though it has advanced features similar to the original postscript version, like full colour, bitmaps and shadings, I have only ever come across a handful of Type 3 fonts. Not a single one of them used any features which can’t be matched by Type 1 fonts. In addition to this, the PDF specification lets you use text as a clip for other drawing, so any features within Type 3 fonts could be emulated within PDF files.

Realistically, I don’t expect Type 3 fonts will ever disappear from the specification – Adobe has been known to remove features from the specification, but it certainly isn’t a common occurrence. Plus it’s included in the archival format PDF/A, so it could be around for decades to come… I still can’t help but wonder if Type 3 adds anything, though – and if it does, I’m yet to see it.

Do you disagree? Have you used Type 3 fonts in any of your documents? Let us know in the comments!

This post is part of our “Fonts Articles Index” in these articles we explore Fonts.

 

IDRsolutions develop a Java PDF Viewer and SDK, an Adobe forms to HTML5 forms converter, a PDF to HTML5 converter and a Java ImageIO replacement. On the blog our team post anything interesting they learn about.

Sam Howard Sam is a developer at IDRsolutions who specialises in font rendering and conversion. He's also enjoyed working with SVG, Java 3D, Java FX and Swing.

9 Replies to “Should Type 3 Font support be dropped from the…”

  1. Found your article while searching for how to implement a Type 3 font in a PDF. We sell software online. When a customer buys the software, we just take their email address so we can send them the license (payment is handled by a third party). If they want an invoice, we have a web page where they can enter their name and address and download a PDF of their invoice. The PDF is generated by a php script and only uses standard Postscript fonts (Helvetica and Courier) so they don’t have to be embedded. The PDF files are about 2.5 kilobytes.

    The problem comes when the user enters non-ascii characters in their name or address (e.g. Kanji). My understanding is that we could handle this by creating a Type 3 font and we would only have to provide bitmap representations of the characters that are actually used (using GNU Unifont Glyphs). This would keep the size of the PDF to a minimum. Is this a valid use of a Type 3 font or would there be a better way to achieve the same result?

      1. Thank you for your reply. I got it working using a Type 3 font. One issue is that you can select the text and copy to another document, which gives the characters you are replacing in the Type 3 font. So if you start your replacement from A, when you copy and paste “I love 日本”, you get “I love AB”.

        Then I thought about your suggestion of embedding a image for each multibyte character as I have the bitmap data anyway. The problem is that text and drawing commands have separate coordinate spaces within a PDF and there seems to be no way of getting the current text position. This means that if you have a line of text that contains both single and multibyte characters, you either have to convert the single byte characters to images as well or somehow keep track of the text position based on the width of the single bytes characters. Or were you suggesting something different?

        I think I will probably go with the type 3 font, but change the first replacement character to something after 128, so the multibyte characters look like garbage when you copy and paste them and the user will just think it is a font issue!

          1. I don’t want to copy and paste from the generated invoice, but it is possible a customer might try to do it.

  2. “If you want to cut and paste the text, type3 is a bad choice because it lacks proper encoding.”

    Not true. PDF has supported ToUnicode mapping for Type 3 fonts for at least a decade. Dropping Type 3 font support does not make much sense because it is the cleanest way supported by the PDF spec to make arbitrary glyphs selectable text.

  3. This article is misleading and mixing two different things together.

    So… There are two fully different Type3 font formats. First one is “PostScript Type3” font format which is defined in “PostScript Language Reference Manual” in chapter “5.7. Type 3 Fonts”. This is that Type 3 font from year 1984. Second one is “PDF Type3” font format which is defined in PDF specification in section “Simple Fonts” “Type3 Fonts”.

    PDF document uses different Type3 font format and you cannot use PostScript Type3 font in PDF document. In PostScript Type3 font you can use any PostScript command, but in PDF Type3 font you can use only PDF commands. PDF format is not backward compatible with PostScript. And Postscript commands in PDF Type3 fonts are not allowed. Therefore you could not see 1984’s PostScript Type3 font in some (modern) PDF document. But you could try to convert PostScript Type3 font to PDF Type3 font format.

    On the other hand, there is only one Type1 format (that subset from PostScript language) and this is fully supported in both PostScript and PDF documents.

    So when talking about Type3, important is if you mean Postscript Type3 font format or PDF Type3 font format.

    And about usage…

    You would be surprised, but PDF Type3 fonts are still widely used in TeX typesetting system (https://en.wikipedia.org/wiki/TeX), used mostly in scientific math publications due to beautiful typesetting of complex mathematical formulas.

    Original fonts for TeX, including Computer Modern font family, were written in METAFONT language. METAFONT is turing-complete so automatic conversion to Type1 font format is impossible. When TeX is producing PDF output with some font written in METAFONT language/format it generates bitmap of that font. From that generated bitmap is created PDF Type3 font (as PDF Type3 can use PDF image command) which is then put into final PDF output.

    Nowadays almost all METAFONT fonts used in TeX have also Type1 format and they are used instead of auto-generated PDF Type3. But PDF documents produced by TeX in 15-20 years ago could have still those PDF Type3 fonts.

  4. Thanks for your comment! I’ve updated the article to correct my mistakes.

    METAFONT looks like an interesting experiment. I concede that Type 3 probably does provide a slightly better experience for bitmap fonts than the other methods available, although hopefully modern documents will be using more recent formats!

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2019. All rights reserved.