Re: pdftex - Encoding for metafont PK fonts
Ross Moore <[email protected]>
| Newsgroups | gmane.comp.tex.pdftex |
|---|---|
| Message-ID | <[email protected]> |
Hello Pali, On Jun 27, 2016, at 7:11 AM, Pali Rohár <[email protected]<mailto:[email protected]>> wrote: Yes! And that glyph name for each numberical value (index) is available in encode file (csr.enc). This is reason why I'm tryint to tell pdftex: "hey pdftex, please use csr.enc for my csb12 PK font, it contains mapping index --> glyph name which you need to building cmap file” OK. But why do you need csb12 ? That is, why not csbx12 which *is* available in PFB format, and is properly mapped. viz. SCI:vector ross$ grep csb `kpsewhich pdftex.map` | grep -v fcsb | grep -v TeXGyre | grep -v Roman csb10 <csb10.pfb csbx10 <csbx10.pfb csbx12 <csbx12.pfb csbx5 <csbx5.pfb csbx6 <csbx6.pfb csbx7 <csbx7.pfb csbx8 <csbx8.pfb csbx9 <csbx9.pfb csbxsl10 <csbxsl10.pfb csbxti10 <csbxti10.pfb These fonts (and corresponding medium/regular weights) are handled in LaTeX using csfonts.sty . The encoding seems to be a subset of XL2. viz. % @psencodingfile{ % author = "Petr Olsak, Zdenek Wagner", % date = "19oct12", % filename = "xl2.enc", % license = "public domain", % email = "[email protected]<mailto:[email protected]>", % codetable = "ISO/ASCII", % docstring = " % some of our (CSTUG- czech TeX Users Group) users want to support % 8bit font coding such that: % -- lower 7bit is exactly OT1 (but with differences imposed % by DEK -- e.g. layout of cmr is different from cmtt) % -- upper part is taken from ISO-Latin 2 (iso 8859-2), % but some of empty positions are filled with useful characters % usually available in type-1 font (permill sign etc.) % " % } Changing your test as follows works fine, at least for some characters, in Plain TeX. \pdfcompresslevel 0 \pdfobjcompresslevel 0 \nopagenumbers \pdfgentounicode 1 \input glyphtounicode.tex %\pdfglyphtounicode{ccaron}{010D} \font\csb=csbx12 \csb \char232 \char233 %\char234 %\char235 % \char236 \char237 %\char238 \char239 \bye č.ě.ď (I hope 5 characters are showing for you here. If not, my mail client could be at fault.) Just extract them yourself from the PDF attached here.
csb.pdf
(application/pdf, 6.7 KB) - not displayed
ATT00001.htm
(text/html, 7.5 KB)
<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><div><div><div><div style="margin: 0px;" class=""><div style="margin: 0px;" class=""><div style="margin: 0px;" class=""><div style="margin: 0px;" class=""></div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Note that the characters <span style="color: rgb(18, 192, 14);" class="">\char234 \char235</span><span style="color: rgb(18, 192, 14);" class=""> \char238 </span></div><div style="margin: 0px;" class=""><font color="#12c00e" class="">are not in the subset of XL2 characters </font><span style="color: rgb(18, 192, 14);" class="">supported</span><span style="color: rgb(18, 192, 14);" class=""> </span><font color="#12c00e" class="">within the csr and csbx fonts.</font><span style="color: rgb(18, 192, 14);" class=""> </span></div></div></div></div></div><br class=""><blockquote type="cite" class=""><div class=""><blockquote type="cite" class="">Ok, it is really not possible with pdftex. I looked into pdftex<br class="">source code and code for writing PK & Type 3 fonts in PDFtex does<br class="">not use encoding vectors...<br class=""><br class="">Also code for loading mapfile cannot be used for PK fonts (checker<br class="">refuse it).<br class=""></blockquote></div></blockquote><div><br class=""></div><div>There is no csr.enc in TeXLive, at least not from 2014 onwards.</div><div>So I cannot test this assertion unless you send a copy.</div><div>But do you really need this, given XL2 encoding?</div><div><br class=""></div><div>Certainly one can attach a /ToUnicode map to the /Type3 font.</div><div>However there is something else missing in the way the /Font dictionary</div><div>is built in that case, which prevents Acrobat from using that CMap.</div><div>The lack of encoding vector and /CharSet may well be the problem,</div><div>or it may be some other piece of font metadata that is needed.</div><br class=""><blockquote type="cite" class=""><div class=""><blockquote type="cite" class=""><br class="">I looked deeply how pdftex working with Type 3 and PK fonts and<br class="">created small patch which adds support for generating /ToUnicode<br class="">object (from \pdfglyphtounicode table) and which allows to load enc<br class="">file also PK fonts.<br class=""><br class="">Patch was created against pdftex in TeXLive 2012 (which is on my<br class="">system), but is really small and should be very easy to rewrite/apply<br class="">it on new versions.<br class=""><br class="">Patch pdftex-pkfonts-encfile-tounicode.patch is attached.<br class=""><br class="">Let me know what do you think about it and if it can be added to<br class="">pdftex project.<br class=""></blockquote><br class="">Ops, in patch from previous email is small problem with indexes and <br class="">notdef. Fixed in new attached pdftex-pkfonts-encfile-tounicode-v2.patch<br class=""></div></blockquote><div><br class=""></div><div>Thanks for going to this level of detail.</div><div>But is it really needed, when csfonts are available?</div><div>Besides, there is no point constructing the /ToUnicode CMAP automatically</div><div>if it’s not going to work properly anyway.</div><div><br class=""></div><div><br class=""></div><div>Surely new documents should use csfonts .</div><div><br class=""></div><div>But if there is an existing archive of documents that use older methods,</div><div>which may need faithful production into the future, then you have my </div><div>support for adding improvements to the way Type-3 fonts are handled.</div><br class=""><blockquote type="cite" class=""><div class=""><br class="">-- <br class="">Pali Rohár<br class=""><a href="mailto:[email protected]" class="">[email protected]</a><br class=""><span id="cid:FFA0EBE2-4823-4BFF-A1C5-D6F69089C661"><pdftex-pkfonts-encfile-tounicode-v2.patch></span></div></blockquote><br class=""></div><div>Hope this helps,</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Ross</div><br class=""><div apple-content-edited="true" class=""> <div style="font-family: Arial, sans-serif; orphans: 2; widows: 2; " class=""><span class="Apple-style-span" style="font-size: 9px;"><b class=""><span style="font-size: 9pt;" class=""><br class="Apple-interchange-newline">Dr Ross Moore</span></b></span></div><div style="font-family: Arial, sans-serif; orphans: 2; widows: 2;" class=""><p style="font-family: Arial, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(119, 119, 119); font-size: 7pt; margin-bottom: 3.75pt;" class=""><font color="#000000" class=""><span style="font-size: 9pt;" class=""><b class="">Mathematics Dept </b><b class="">|</b> Level 2, S2.638 AHH<br class="">Macquarie University, NSW 2109, Australia</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;" class=""></span></font></p><p style="font-family: Arial, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(119, 119, 119); font-size: 7pt; line-height: 11.25pt; margin-bottom: 3.75pt;" class=""><b class=""><span style="font-size: 9pt;" class=""><font color="#000000" class="">T:</font></span></b><span style="font-size: 9pt;" class=""><font color="#000000" class=""> +61 2 9850 <b class="">8955 | F:</b> </font><a href="tel:%2B61%202%209850%209695" value="+61298509695" target="_blank" class=""><font color="#000000" class="">+61 2 9850 8114</font></a><br class=""><font color="#000000" class=""><b class="">M:</b><a href="tel:%2B61%20409%20125%20670" value="+61409125670" target="_blank" class="">+61 407 288 255</a><b class=""> | </b>E: </font><a href="mailto:[email protected]" target="_blank" class=""><font color="#000000" class="">[email protected]</font><font color="#1155cc" class=""><span style="color: black;" class=""></span></font></a><font color="#1155cc" class=""><span style="color: black;" class=""></span></font><span style="color: black;" class=""></span><br class=""></span></p><p style="font-family: Arial, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(119, 119, 119); font-size: 7pt; line-height: 11.25pt; margin-bottom: 3.75pt;" class=""><span style="font-size: 9pt;" class=""><span style="color: black;" class=""><a title="Macquarie University" href="http://mq.edu.au/" target="_blank" class="">http://www.maths.mq.edu.au</a></span></span></p><p style="color: rgb(0, 0, 0); font-family: Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://mq.edu.au/" target="_blank" class=""><br class="Apple-interchange-newline"><span></span></a></p></div></div></div></body></html>
image001.png
(image/png, 4.5 KB) - not displayed
ATT00002.htm
(text/html, 2.4 KB)
<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div apple-content-edited="true" class=""><div style="font-family: Arial, sans-serif; orphans: 2; widows: 2;" class=""><p style="color: rgb(0, 0, 0); font-family: Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://mq.edu.au/" target="_blank" class=""><span></span></a></p><p style="font-family: Arial, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(119, 119, 119); font-size: 7pt;" class=""><a href="http://mq.edu.au/" target="_blank" class=""><span style="color: rgb(119, 119, 119); font-size: 7pt;" class=""><br class="Apple-interchange-newline">CRICOS Provider Number 00002J. Think before you print. <br class="">Please consider the environment before printing this email.</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;" class=""></span></a></p><p style="font-family: Arial, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(119, 119, 119); font-size: 7pt;" class=""><a href="http://mq.edu.au/" target="_blank" class=""><span style="color: rgb(119, 119, 119); font-size: 7pt;" class="">This message is intended for the addressee named and may <br class="">contain confidential information. If you are not the intended <br class="">recipient, please delete it and notify the sender. Views expressed <br class="">in this message are those of the individual sender, and are not <br class="">necessarily the views of Macquarie University.</span></a></p> </div> </div><br class=""></div></body></html>