8

Can someone help to install the ocr-a font? I'm using fedora, I'm trying to find a proper tutorial but cannot find a good one.

doncherry
  • 54,637
Noor
  • 1,801

1 Answers1

10

The following should do:

  1. Download the zip file http://mirrors.ctan.org/fonts/ocr-a.zip

  2. Unzip it: unzip ocr-a.zip

  3. Do cd ocr-a and edit the ocr10.mf, ocr12.mf and ocr16.mf files so that their last line reads input ocr-a instead of input ocra (this is a bug in the distribution)

  4. Do cd .. to get one level up

  5. Do the following commands in super user mode (I'll use sudo, assuming a Bash shell)

    sudo mkdir -p $(kpsewhich -var-value=TEXMFLOCAL)/fonts/source
    sudo mv ocr-a $(kpsewhich -var-value=TEXMFLOCAL)/fonts/source/
    sudo mktexlsr
    
  6. Try compiling the following plain TeX file (pdftex tryocra)

    %%% File name tryocra.tex
    \font\ocraten=ocr10
    \ocraten
    
    ABCDEFGHIJKLMNOPQRSTUVZ
    
    \bye
    

The result should be as follows

enter image description here


A ZIP file with the fonts converted to Type1 and OpenType, along with a style file for getting them with LaTeX is available here, with instructions for installation on a Unix system with TeX Live.

egreg
  • 1,121,712
  • But when I need to write one piece of text, should i do it like \ocraten{test} ?? – Noor Apr 02 '13 at 11:01
  • @user1774937 Do you want to use it in LaTeX? – egreg Apr 02 '13 at 11:07
  • Is step 3. in general needed? – 71GA May 23 '13 at 06:08
  • @71GA It's needed in this case because of the mentioned bug. – egreg May 23 '13 at 09:40
  • Be careful: in MikTex 2.9, the first solution works if you copy the files in the correct folder. It happens for me that even if MikTex is installed in AppData/local/Programs/MikTex2.9, the metafont program was working in AppData/local/MikTex/2.9. When I placed the file over there, it finally work. – Denis Cousineau Sep 17 '18 at 21:25
  • @DenisCousineau I never support MiKTeX on Windows, for character incompatibility. Today I had to plug in a USB key into a Windows computer for printing a file (no other way to access the printer) and finding how to access the file system took me a few minutes. ;-) – egreg Sep 17 '18 at 21:30
  • I followed the first set of instructions, and am able to compile the example plain-TeX document with the alphabet. However, using the ocr package or using \font\ocrten=ocr10 in a LaTeX document, the font only seems to have numerals 0-9 and no letters. Why does this happen? – Scott Colby Nov 14 '21 at 07:52
  • @ScottColby \usepackage[ocr-a]{ocr} will use the font described here. – egreg Nov 14 '21 at 09:20
  • @egreg, that is what I was using, \usepackage[ocr-a]{ocr} ... \begin{document}\ocrfamily abcdefg123456789 ... results in Missing character: There is no a in font ocr10! etc. for all the letters but none of the numbers. – Scott Colby Nov 17 '21 at 04:01
  • @ScottColby I have the same and get no error and no missing character. Maybe you have a wrong version of the fonts? – egreg Nov 17 '21 at 09:37
  • :/ this was my fault. My input had lower-case letters, which OCR-B has, but OCR-A doesn't. Changing to upper case made the missing letters appear! Thank you. – Scott Colby Nov 19 '21 at 01:59
  • As a quick question: if there is an error in the distribution, why is it not corrected nearly 10 years later? – Denis Cousineau Jun 07 '23 at 01:10
  • @DenisCousineau The author/maintainer should do it, but the last intervention was in 1989. The package has a restrictive licence that doesn't allow replacing an inactive maintainer. – egreg Jun 07 '23 at 07:48