<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hello Pali, and Paul
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Jun 26, 2016, at 7:21 AM, Pali Rohár <<a href="mailto:pali.rohar@gmail.com" class="">pali.rohar@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<blockquote type="cite" class="">
<blockquote type="cite" class="">Maybe PDF readers could think that font is not in Latin1, but in<br class="">
Unicode as IIRC Unicode at positions 128-255 have same characters<br class="">
as Latin1 encoding.<br class="">
<br class="">
Unicode character U+00E8 is for sure 'è'. So I bet this is reason<br class="">
why PDF reader thinks that I selected character 'è' and not 'č'.<br class="">
<br class="">
For Type 1 PFB fonts (even in IL2 encoding) this is not a problem,<br class="">
because for each characters there is stored unified glyph name and<br class="">
there is standard conversion table from glyph name to unicode<br class="">
character.<br class="">
<br class="">
So probably in PK fonts is not any conversion table from 8bit<br class="">
character to unicode character and so something (pdftex? PDF<br class="">
reader?) assume either Latin1 or Unicode.<br class="">
</blockquote>
</blockquote>
</div>
</blockquote>
<div><br class="">
</div>
<div>What you need is a CMAP resource, which gets associated</div>
<div>with the Font-Descriptor dictionary, not with the font itself.</div>
<div><br class="">
</div>
<div>This is what is done with PFA and PFB fonts, and others.</div>
<div>So I don’t see why you cannot also do this with PK fonts.</div>
<div><br class="">
</div>
<div>The question then becomes “who or what creates the CMAP?”.</div>
<div><br class="">
</div>
<div>pdfTeX has a primitive  \pdfgentounicode  which if set to 1 (or higher)</div>
<div>causes an attempt to create the CMAP internally, based upon glyph names</div>
<div>and using a standard list of font character names.</div>
<div>Extra info can be provided by the  \pdfglyphtounicode  primitive,</div>
<div>as you have encountered in an earlier posting.</div>
<div><br class="">
</div>
<div>But Metafont-produced pk-fonts tend to use lazy generic names for</div>
<div>characters, such as /a1, /a2, /a3, etc.</div>
<div>This can imply non-uniqueness across several fonts, so is likely to be</div>
<div>unsuitable if you need to provide CMAP resources for several fonts</div>
<div>using the same character names.</div>
<div><br class="">
</div>
<div>The alternative is to construct the full CMAP resource externally,</div>
<div>as a text file. Then the contents of this file is loaded into the PDF</div>
<div>using pdfTeX’s  \pdffontattr  primitive, which reads in the file as a stream,</div>
<div>and creates the correct dictionary entry.</div>
<div><br class="">
</div>
<div>For details on how this can be done in TeX coding, consult the package</div>
<div>   cmap.sty  .</div>
<div>Look at files such as  ot1.cmap, t1.cmap, t2.cmap etc. for the structure</div>
<div>of the kind of data file that is needed. These encode the unicode</div>
<div>mapping of the numbered character slots in a font.</div>
<div><br class="">
</div>
<div>Also it may be helpful to examine the coding that I’ve included below,</div>
<div>for attaching a CMAP resource to Xy-pic directional fonts,</div>
<div>e.g., for arrow-heads.</div>
<div>This assumes that LaTeX can find a private file called:  xyd.cmap .</div>
<div>Another primitive  \pdfnobuiltintounicode  disables the attempt to create</div>
<div>the CMAP internally.</div>
<div class=""><br class="">
</div>
<blockquote type="cite" class="">
<div class="">
<blockquote type="cite" class=""><br class="">
Yes, I agree that this is likely the case.  I do know that in PK<br class="">
fonts, there is only a character (or no character) for each of the<br class="">
positions 0-255, with no character names or additional coding<br class="">
information.<br class="">
</blockquote>
<br class="">
When specifying Type 1 PFB font, it needed to add it into pdftex font <br class="">
map file (primitive \pdfmapfile). And map line allows to specify <br class="">
encoding vector file. That file contains for each character 0-255 <br class="">
position glyph name. And pdftex primitive \pdfglyphtounicode then maps <br class="">
glyph name to unicode character. So For PFB fonts it is possible to do <br class="">
that 0-255 position to unicode mapping.<br class="">
</div>
</blockquote>
<div><br class="">
</div>
As outlined above.</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">But it is pity that it is not possible to specify that enc file also for
<br class="">
PK fonts generated by MetaFont. Or it is somehow possible?<br class="">
</div>
</blockquote>
<div><br class="">
</div>
<div>I see no reason why not, but could easily be wrong.</div>
<div>But I must admit that I’ve not tried it with a PK font.</div>
<div><br class="">
</div>
<div>Font outlines have been the preferred technology for ~20 years</div>
<div>or more, so I’ve not had the need with bit-mapped fonts.</div>
<br class="">
<blockquote type="cite" class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<blockquote type="cite" class="">In detail my question is: How to tell pdftex encoding of PK font<br class="">
(generated from MetaFont)?<br class="">
<br class="">
<blockquote type="cite" class="">For information on virtual fonts:  use Google.<br class="">
</blockquote>
<br class="">
With above detailed description, are you sure that virtual fonts<br class="">
could do this unicode mapping?<br class="">
<br class="">
Are not virtual fonts again only 8bit (as opposite of glyph names<br class="">
and unicode)?<br class="">
</blockquote>
<br class="">
Yes, virtual fonts are only 8 bits.  There are things called "omega<br class="">
virtual fonts" which I think allow for larger-numbered characters,<br class="">
but I don't know whether pdftex supports them.  I think that luatex<br class="">
does.<br class="">
</blockquote>
<br class="">
Luatex is unicoded and it is possible to create virtual font which remap <br class="">
latin2 to unicode (yesterday I tried that). But my question is about <br class="">
pdftex right now.<br class="">
</div>
</blockquote>
<div><br class="">
</div>
<div>Try what I suggest above.</div>
<br class="">
<div><br class="">
</div>
<div><br class="">
</div>
<div>
<div></div>
<blockquote type="cite" class="">
<div></div>
</blockquote>
<blockquote type="cite" class="">
<blockquote type="cite" class="">
<div></div>
</blockquote>
</blockquote>
<blockquote type="cite" class="">
<blockquote type="cite" class="">
<blockquote type="cite" class="">
<div>% Supply CMAP files for Xy-pic's arrowhead fonts</div>
<div>% otherwise an Accessibility check fails for encoding of arrow tips.</div>
<div>%</div>
<div>\def\TPDF@xyd@encoding{xyd}</div>
<div>\def\TPDF@support@xyarrows{%</div>
<div>  \IfFileExists{\TPDF@<a href="mailto:xyd@encoding.cmap" class="">xyd@encoding.cmap</a>}%</div>
<div>   {\TPDF@load@xyd}%</div>
<div>   {\TPDF@inhibitload@xyd}%</div>
<div>}</div>
<div>   </div>
<div>\def\TPDF@load@xyd{%</div>
<div>    \immediate\pdfobj stream file {\TPDF@<a href="mailto:xyd@encoding.cmap" class="">xyd@encoding.cmap</a>}\relax</div>
<div>    \xdef\TPDF@set@cmap@xyd##1{%</div>
<div>      \noexpand\expandafter\pdffontattr\noexpand##1 {/ToUnicode \the\pdflastobj\space 0 R}}%</div>
<div>  }</div>
<div>\def\TPDF@inhibitload@xyd{\gdef\TPDF@set@cmap@xyd##1{}}</div>
<div><br class="">
</div>
<div>% standard Xy tips</div>
<div>\def\TPDF@xyd@cmap@xy{%</div>
<div> \pdfnobuiltintounicode\xyatipfont</div>
<div> \TPDF@set@cmap@xyd{\xyatipfont}%</div>
<div> \pdfnobuiltintounicode\xybtipfont</div>
<div> \TPDF@set@cmap@xyd{\xybtipfont}%</div>
<div>}</div>
<div>% CM-style Xy tips</div>
<div>\def\TPDF@xyd@cmap@cm{%</div>
<div> \pdfnobuiltintounicode\xy@@atfont</div>
<div> \TPDF@set@cmap@xyd{\xy@@atfont}%</div>
<div> \pdfnobuiltintounicode\xy@@btfont</div>
<div> \TPDF@set@cmap@xyd{\xy@@btfont}%</div>
<div>}</div>
<div>% rebind the \UseTips  macro</div>
<div>\def\TPDF@UseTips{%</div>
<div> \LTX@UseTips</div>
<div> \TPDF@xyd@cmap@cm</div>
<div>}</div>
<div><br class="">
</div>
<div>\AtBeginDocument{%</div>
<div> \@ifpackageloaded{xy}{% activate CMaps for Xy-pic arrows</div>
<div>  \TPDF@support@xyarrows</div>
<div>  \TPDF@xyd@cmap@xy</div>
<div>  \let\LTX@UseTips\UseTips</div>
<div>  \let\UseTips\TPDF@UseTips</div>
<div> }{}%</div>
<div> }</div>
</blockquote>
</blockquote>
</blockquote>
<div class=""><br class="">
</div>
</div>
<br class="">
<blockquote type="cite" class="">
<div class=""><br class="">
-- <br class="">
Pali Rohár<br class="">
<a href="mailto:pali.rohar@gmail.com" class="">pali.rohar@gmail.com</a><br class="">
</div>
</blockquote>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
Hope this helps,</div>
<div class=""><br class="">
</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>Ross</div>
<div class=""><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:rick.minter@mq.edu.au" target="_blank" class=""><font color="#000000" class="">ross.moore@mq.edu.au</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=""><span><img height="58" width="260" apple-inline="yes" id="462D266D-CE67-47E9-9F12-5187198EDE03" apple-width="yes" apple-height="yes" src="cid:image001.png@01D030BE.D37A46F0" 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="">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>