[Tex/LaTex] miktex-makepk: PK font Alegreya-Regular-lf-t1–base could not be created

errorspdftex

I just want to use Alegreya font with pdflatex. i had a question about an error before and got an answer. But it gives another error now. what should i do.

error message:

miktex-makepk: PK font Alegreya-Regular-lf-t1–base could not be created.

in log file:

!pdfTeX error: pdflatex.exe (file Alegreya-Regular-lf-t1–base): Font Alegreya-
Regular-lf-t1–base at 657 not found
==> Fatal error occurred, no output PDF file produced!

\documentclass[11pt,a4paper]{article}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.50cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{Alegreya} %% Option 'black' gives heavier bold face 
\renewcommand*\oldstylenums[1]{{\AlegreyaOsF #1}}

\begin{document}
This is giving an error.
\end{document}

Best Answer

Dvips.map and friends do not know about Alegreya, so instead of loading type 1 fonts, MiKTeX tries to make bitmaps and doesn't know how to make them.

Check if you have a text file named updmap.cfg in C:\Users\Your_name\AppData\Roaming\MiKTeX\2.9\miktex\config. If not, create one. Add the following lines in that file:

Map Alegreya.map

Then execute as administrator this command line:

updmap.exe -verbose

The -verbose switch is there to check what's happening. That's all. You can check everything's OK by looking at the contents of psfonts.map, in C:\Users\Your_name\AppData\Local\MiKTeX\2.9\dvips\config. It should contain references to Alegreya.

Alternatively, you can compile with XeLateX or LuaLaTeX: you have to remove inputenc loading, save you document in UTF-8 format (no \usepackage[utf8]{inputenc}!) and write these lines in your preamble

\usepackage{fontspec}  
\setmainfont{Alegreya}

Addendum: there seems to be a typo in line 233 of (MiKTeX's version of) alegreya.sty, which begins with:

\def*\useosf{...

and should begin with

\def\useosf{...