I have created a virtual font which contains some non-standard characters (made up of superimposed characters from other fonts). I would like to use the pdftex command \pdfglyphtounicode to make pasting from generated pdf files work. This command needs a "glyph name" as the first argument.

How can I set the glyphname for my new characters?

For example, one of my character is at index 65, so TeX thinks it is an "A". But I cannot use \pdfglyphtounicode{a}{0102}, say, because this would damage all the regular "a" in my text.

  • 1
    by the time it gets to the pdf the virtual font has been expanded out to the underlying fonts and tex positional instructions, so it is the glyph names in your base fonts that you need to use. Jan 24, 2020 at 21:35
  • @DavidCarlisle One of my characters is made up of a "t" and a "," to get en.wikipedia.org/wiki/T-comma . Are you saying that this will always paste as two characters, and I can only choose what "t" and "," maps to when pasting? My hope was to somehow get a U+021A when I copy&paste this out of the pdf.
    – jochen
    Jan 24, 2020 at 21:41
  • 1
    pdfglyphtounicode can not help you as you have two glyphs in the pdf, it looks exactly as if you had t\hspace{..}, you can probably use actualtext tagging (see the accsupp package) Jan 24, 2020 at 21:45

1 Answer 1


In the PDF it makes no difference whether the input is via a virtual file or via explicit characters and kerns in the source. You can not use \pdfglyphtounicode as that works at the font level and in the PDF there are two characters, however you can use the ActualText feature and tag the range with a suitable replacement,



a Ț b


looks like

enter image description here

but if you cut and paste the inputenc faking if the T-comma becomes apparent, and you get

a T, b

However you can mark the region using accsupp:




a \BeginAccSupp{method=hex,unicode,ActualText={021A}}Ț\EndAccSupp{} b


The visual output looks the same, but now cut and paste produces

a Ț b

with a U+021A character.

Rather than putting \BeginAccSupp in the document you could modify the definition

\DeclareUnicodeCharacter{021A}{\textcommabelow T}

and add the accsupp markup to the last argument.

You could also place the equivalent construct in the vf definition for the character when using a virtual font.

  • 2
    it should be noted that not every pdf viewer honors the actualtext entry Also as it is implemented with pdfliterals the accsupp code affects kerning (one could avoid this with lualatex). Jan 24, 2020 at 22:58
  • @UlrikeFischer the kerning isn't so much of an issue here as the textcommabelow T is an \halign stack so there are no inter-character kerns anyway, similarly in the OP's virtual font case it should be possible to push the pdfliterals inside the virtual character and so still be able to specify inter-character kerns.. The fact that not all pdf readers support it is of course a potential problem... Jan 24, 2020 at 23:03
  • @UlrikeFischer You can do this by using the tagpdf package? Jan 24, 2020 at 23:04
  • @PabloGonzálezL yes you can also add such a actual text there, but it basically does the same as accsupp. Jan 24, 2020 at 23:10
  • @UlrikeFischer So no advantage at this point? Jan 24, 2020 at 23:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .