Sample ToUnicode CMap (with explanations below):
/CIDInit /ProcSet findresource begin
12 dict begin
/Registry (UniqueName) /Ordering (FOP) /Supplement 0 >> def
/CMapName /UniqueName def
/CMapType 2 def
CMapName currentdict /CMap defineresource pop
Looks like normal CMap. I'll point out some differences:
/Registry and /CMapName must be unique and equal, so make up some names.
Font name for which ToUnicode cmap was generated is ok here. Just copy value
/Name from /Font dictionary.
CMapType for ToUnicode CMaps is 2.
begincodespacerange must be as shown above.
beginbfchar section has format:
There can be more beginbfchar sections, each can have no more than 100 entries.
Section in sample says that glyph 5 is A, glyph 6 is B and so on.
There are also beginbfrange sections, but I dont think they will be of any use here.
It is better not to emit structural comments (%%) or /XUID or /UIDOffset or all
the other crap. There are useless here and misleading.
All above taken from:
and checked by hand. It works at least with Acrobat Reader 5.0.
Do I look like I wanted this feature badly? Mail me for more info.