# Vector fonts with UTF-8 support?

In fact the situation I find myself in is a bit more complicated than the question might suggest. I need to typeset a document with various accented characters and would like some hyphenation support for that. I know I need T1 font encoding for that. Unfortunately, then I have to use a bitmap font by default, which is quite ugly... Can I force Computer Modern with T1 or is there no way around? In the latter case, which vector fonts would you suggest? I am only marginally interested in XeTeX or LuaTeX solutions.

-
type1 version of T1-encoding cm-font exist now for already a long time. Install either the cm-super fonts or use the the lmodern fonts. Beside this: The font encoding (T1) has nothing to do with the input encoding (utf-8). – Ulrike Fischer Oct 23 '11 at 16:53
@UlrikeFischer: Thanks for the clarification! I am aware that font encoding and input encoding are different things. Maybe the title of the post was misleading. I just wanted to say that I use UTF-8 input encoding and would like a vector font with appropriate font encoding to support all facilities offered by UTF-8. By the way: I see there is a cm-unicode font also. Wouldn't that be a better option than cm-super? – Count Zero Oct 23 '11 at 17:49
UTF-8 encodes each of the 1112064 code points in the Unicode character set. So do you really want a font which supports all facilities of utf8? If yes you should use xetex/luatex along with a large unicode font. Covering such a large number of glyphs with the standard TeX-fonts with 256 glyphs per font is (as you can see in the CJK packages) rather tiresome. — cm-unicode is as far as I can see meant for engines like xetex/luatex. – Ulrike Fischer Oct 24 '11 at 7:53
@UlrikeFischer: Ok, I'm not that greedy! :D Why don't you make your first comment an answer? I'd surely upvote it. – Count Zero Oct 24 '11 at 8:10

I strongly suggest Latin Modern fonts instead of CM. See the post: Latin Modern vs cm-super?

If you also want to have UTF8 encoding mapping in the pdf file (for copy-pasting and accessibility) you can add some line to your preamble assuming you are using pdfTeX (pdfLaTeX).

The minimal code below I have prepared for another post show you how to do this:

\documentclass[]{article}

%PdfTeX settings for a correct UTF 8 Mapping
%------------------------------------------------------
\usepackage{ifpdf}
\ifpdf    \input{glyphtounicode.tex}    %Part of modern distribution
%%%\input{glyphtounicode-cmr.tex}     %Additionnal glyph: You must grab it from pdfx package
\pdfgentounicode=1
\else  %Place here the settings for other compilator
\fi

%Encoding + cmap (to get proper UTF8 mapping)
%------------------------------------------------------
\usepackage{cmap}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

%NB: CHANGE lmodern AND fourier TO SEE THE PROBLEM OF MISSING UNICODE CHARACTERS
%     You can see this on Acrobat Pro with acessibility checking or simply by copy-pasting the content.
%     Of course copy paste is not perfect in both case but it is better with lmodern
%------------------------------------------------------
\usepackage{lmodern}
%%\usepackage{fourier}

%AMS Math + UTF8 mapping of ams symbols
%------------------------------------------------------
\usepackage{amsmath}
\usepackage{amssymb} % I load it after Fourier else I have more incorrect utf8 mapping (with \geqslant for example)
%Correct UTF8 mapping for ams fonts
\ifdefined\pdffontattr% \ifdefined is part of the e-TeX extension, which is part of any modern LaTeX compiler.
\immediate\pdfobj stream file {umsa.cmap}
{\usefont{U}{msa}{m}{n}\pdffontattr\font{/ToUnicode \the\pdflastobj\space 0 R}}
\immediate\pdfobj stream file {umsb.cmap}
{\usefont{U}{msb}{m}{n}\pdffontattr\font{/ToUnicode \the\pdflastobj\space 0 R}}
\fi

%Start document
%------------------------------------------------------
\begin{document}

All these examples work fine with Latin Modern but not with Fourier Font (and Palatino and maybe others).

\bigskip
Issue with mapsto : ${\mathcal F} : \boldsymbol{\eta} \in {\mathbb{R}}^{np}\ \mapsto {\mathcal F}\left(\boldsymbol{\eta} \right)\in \mathbb{R}$

\bigskip
Issue with sqrt : $\sqrt{X}$

\bigskip
Issue with parenthesis : $X \geqslant \left(\frac{1}{2}\right)^2$

\bigskip
Issue with sum : $\sum_{n=0}^\infty X^n$

\end{document}

-