7

I wanna be able to copy czech characters from PDF, but for some reason it doesn´t work.

here is my code:

\usepackage{cmap}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{charter}

and if I write for example říjen (october :), the text is fine in PDF, but when I try to copy it somewhere, I get ˇríjen. (It´s the same for all characters with ˇ).

if I change \usepackage{charter} to \usepackage{tgtermes}, the character ř is fine. But I would like to use charter font because it simply looks better, but I need to be able to copy czech characters.

How can I achieve copying czech characters with charter?

2
  • Welcome to TeX.SE. Nov 5, 2012 at 20:27
  • As we're talking about accents already: You shouldn't use acute accents ´ as apostrophes (wrong: don´t), but actual apostrophes ' instead (right: don't). On Czech keyboards, the apostrophe seems to be left of the backspace key.
    – doncherry
    Nov 5, 2012 at 22:18

2 Answers 2

4

The characters in TeX Gyre Termes are "real" glyphs, that is, they are fully precomposed.

In the case of Charter, the accented glyphs are realized by adding the accent to the letter. This happens via a virtual font, so that TeX is not confused when trying hyphenation, but the final output has the composed glyphs anyway.

Either you find a Charter font that has precomposed glyphs or there's little to do about this.

Here is the entry in the virtual font definition for bchr8t, the text font used when Charter is requested, for character octal 260, which in the T1 encoding corresponds to "ř":

(CHARACTER O 260
   (CHARWD R 0.382)
   (CHARHT R 0.741)
   (MAP
      (PUSH)
      (MOVEDOWN R -0.01)
      (MOVERIGHT R -0.059)
      (SETCHAR O 20)
      (POP)
      (SETCHAR C r)
      )
   )

This clearly shows how the glyph is composed by two parts: the accent (octal 20) and the "r".

3

This can be done by altering the Virtual font, to put the accent after the base letter, rather than before it, and ...

(CHARACTER O 260
   (CHARWD R 0.382)
   (CHARHT R 0.741)
   (MAP
      (PUSH)
      (SETCHAR C r)
      (POP)
      (MOVEDOWN R -0.01)
      (MOVERIGHT R -0.059)
      (SETCHAR O 20)
      )
   )

... ensure that the accent character is mapped to the Unicode combining accent:

\pdfglyphtounicode{caron}{030C}

The full procedure is:

vftovp bchr8t.vf > bchr8t.vpl
    edit bchr8t.vpl to modify all composed accented characters as above
vptovf bchr8t.vpl
    move the resulting files  bchr8t.vf  and   bchr8t.tfm  to where you want them in a local place,  such as  texmf-local  in the TeX directory tree
    Rebuild the database;  e.g.  texhash 

Do the same thing for Bold and Italic styles.

You must log in to answer this question.

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