On 12/15/2017 7:12 PM, Pali Rohár wrote:
On Friday 15 December 2017 17:13:22 Karl Berry wrote:
(Sorry for the delayed reply.)
Date: Sat, 19 Aug 2017 16:02:17 +0200 From: Pali Rohár
Subject: [PATCH v4] Allow .enc files for bitmap PK fonts Thanks for splitting the patch into those separate pieces, Pali, and doing the test and documentation updates. Very helpful. Reading through the changes, they generally look fine.
My only question at the moment is, why do duplicate glyph names have to be removed in advance (in patch 3)? Otherwise we'll try to put two glyphs by the same (PostScript/PDF) name in the output font? Or something else? --thanks, karl.
Hi! Glyph names are put into /Differences PDF table and also glyphs itself are identified in PDF by its names. So we cannot have two different glyphs in PDF file with same name.
Where does the pdf standard mention that limitation? Why should glyph names be unique? If there is some nencoding issue it more looks like there is a shared Differences related dictionary / array that should not be shared
Function remove_duplicate_glyph_names() just remove duplicate glyph names from enc file and later function writet3() for glyph index uses either glyph name or if is not available (e.g. because of duplicates), then it use name "a
" (like before). This ensures that every glyph has a unique name in PDF file. If you comment that remove_duplicate_glyph_names() then you would see what happen. pdftex would not be able to create PDF file with two different glyphs with same name and would store just one glyph. That would result in damaged PDF font, one glyph would be used for all characters which had associated that one glyph name in enc file. Probably it would be the glyph with highest index.
Test case for reproducing should be easy:
File my.enc: ============ /my [ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /mychar /mychar /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef ] def ============
Ok, but that is not related to pdf (as format) but to a bad vector and/or pdftex not taking the right one ... is messing around with names (thereby obscuring the problem) better than fixing the enc file? After all, now one of the glyphs will still have the wrong name.
File test.tex: ============ \pdfglyphtounicode{mychar}{269} \pdfgentounicode=1 \pdfmapline{cmb10
And result PDF file would not render glyph 'a' if function remove_duplicate_glyph_names() is disabled. There would be two glyphs 'b'.
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------