1

I have simple code, which have strange behavior. When I compile this code by command lualatex test.tex or xelatex test.tex and look into the generated pdf file, the glyphs with accents are two symbols in reality.

 \documentclass{scrbook}
 \usepackage{fontspec} 
 \setmainfont{Cambria}  

 \begin{document}
   Příliš žluťoučký kůň úpěl ďábelské ódy.
 \end{document}

As a result, I cannot search copied text properly, between source file with UTF encoding and pdf file. The text is simply not the same. I was hoping that if I was going to use UTF, I would avoid this phenomenon.

I use up to date Miktex distribution together with MS Visual Studio Code as editor with UTF setting.

Mico
  • 506,678
JardaFait
  • 3,922
  • 1
    That's a problem specific to cambria. See https://tex.stackexchange.com/a/420568/2388. (char+accent is an allowed decomposition also in unicode: https://en.wikipedia.org/wiki/Unicode_equivalence). – Ulrike Fischer Dec 16 '19 at 15:20
  • 2
    Are you sure alle the accented letters exists in the Cambria font? If not LaTeX has no other way to represent them – daleif Dec 16 '19 at 15:20
  • Please tell us which pdf viewer you employ. For what it's worth, I use Acrobat as my pdf viewer, and I don't experience any of the search-related problems you describe when compiling your sample document. I also use MacTeX2019, with all updates current, and the font file is /Library/Fonts/Microsoft/Cambria.ttf. The font file is said to contain 6974 [!] separate glyphs, including all of the "accented" characters employed in your sample document. – Mico Dec 16 '19 at 17:10
  • @Mico: Adobe reader DC, PDF xChange, Sumatra, all viewers are up tu date. – JardaFait Dec 17 '19 at 14:28

0 Answers0