diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2007-02-10 13:35:52 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2007-02-10 13:35:52 +0000 |
| commit | f4b2ef94c1200ec17dad6a4502308f54371c9694 (patch) | |
| tree | d8412224fb5795d5948e4e346680b16aafd4bec2 /bk_pdf.c | |
| parent | 7d287800e5a5bcdf0d4d38679ff7980ce8c18250 (diff) | |
| download | halibut-f4b2ef94c1200ec17dad6a4502308f54371c9694.zip halibut-f4b2ef94c1200ec17dad6a4502308f54371c9694.tar.gz halibut-f4b2ef94c1200ec17dad6a4502308f54371c9694.tar.bz2 halibut-f4b2ef94c1200ec17dad6a4502308f54371c9694.tar.xz | |
Now that glyph indices are exposed to bk_pdf.c, move CMap generation there,
since that seems closer to being where it belongs.
[originally from svn r7262]
Diffstat (limited to 'bk_pdf.c')
| -rw-r--r-- | bk_pdf.c | 39 |
1 files changed, 37 insertions, 2 deletions
@@ -197,7 +197,42 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords, object *cidfont = new_object(&olist); object *cmap = new_object(&olist); objtext(font, "/Subtype/Type0\n/Encoding "); - sfnt_cmap(fe, cmap); + objtext(cmap, "<</Type/CMap\n/CMapName/"); + objtext(cmap, fe->name); + objtext(cmap, "\n/CIDSystemInfo<</Registry(Adobe)" + "/Ordering(Identity)/Supplement 0>>\n"); + objstream(cmap, "%!PS-Adobe-3.0 Resource-CMap\n" + "%%DocumentNeededResources: procset CIDInit\n" + "%%IncludeResource: procset CIDInit\n" + "%%BeginResource: CMap "); + objstream(cmap, fe->name); + objstream(cmap, "\n%%Title ("); + objstream(cmap, fe->name); + objstream(cmap, " Adobe Identity 0)\n%%Version: 1\n%%EndComments\n"); + objstream(cmap, "/CIDInit/ProcSet findresource begin\n"); + objstream(cmap, "12 dict begin begincmap\n"); + objstream(cmap, "/CIDSystemInfo 3 dict dup begin\n" + "/Registry(Adobe)def/Ordering(Identity)def" + "/Supplement 0 def end def\n"); + objstream(cmap, "/CMapName/"); + objstream(cmap, fe->name); + objstream(cmap, " def/CMapType 0 def/WMode 0 def\n"); + objstream(cmap, "1 begincodespacerange<00><FF>" + "endcodespacerange\n"); + for (i = 0; i < 256; i++) { + char buf[20]; + if (fe->vector[i] == NOGLYPH) + continue; + objstream(cmap, "1 begincidchar"); + sprintf(buf, "<%02X>", i); + objstream(cmap, buf); + sprintf(buf, "%hu", sfnt_glyphtoindex(fe->font->info->fontfile, + fe->vector[i])); + objstream(cmap, buf); + objstream(cmap, " endcidchar\n"); + } + objstream(cmap, "endcmap CMapName currentdict /CMap " + "defineresource pop end end\n%%EndResource\n%%EOF\n"); objref(font, cmap); objtext(font, "\n/DescendantFonts["); objref(font, cidfont); @@ -537,7 +572,7 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords, zbuf = snewn(zlen, char); memcpy(zbuf, o->stream.text, zlen); sprintf(text, "/Length %d\n>>\n", zlen); -#else +#else zcontext = deflate_compress_new(DEFLATE_TYPE_ZLIB); deflate_compress_data(zcontext, o->stream.text, o->stream.pos, DEFLATE_END_OF_DATA, &zbuf, &zlen); |