Using Postscript Type 1 fonts in ConTeXt/XeTeX?
Hi, I am fairly new to both ConTeXt (and XeTeX) but I've already been very impressed with the active user community and the amount of documentation available, as well as with the sheer userfriendliness of ConTeXt when compared to LaTeX. Now I'm trying to get into fonts, but activating a Postscript Type 1 font seems to go beyond my abilities and the wiki documentation on http://wiki.contextgarden.net/Fonts_in_XeTeX . Perhaps anybody can help? I have a Postscript type 1 font family called Eco, consisting of Eco101Roman, Eco102Italic, Eco301Bold and some others. FontBook shows these names identically as PostScript name, Full Name and Family name (which means Fontbook is unaware that they are a family, but this is not the topic here). The fonts can be used with any Mac application and they also work fine in a LaTeX-fontspec-XeTeX combination: the following minimal LaTeX file produces the text as desired in Eco101Roman. 1 %!TEX TS-program = xelatex 2 %!TEX encoding = UTF-8 Unicode 3 \documentclass[12pt]{article} 4 \usepackage{fontspec} 5 \defaultfontfeatures{Scale=MatchLowercase} 6 \setromanfont[Mapping=tex-text]{Eco101Roman} 7 \setsansfont[Mapping=tex-text]{Skia} 8 \setmonofont{Courier} 9 \author{Roland} 10 \title{XeTeX test} 11 12 \begin{document} 13 \maketitle 14 \section{This is a new section} 15 Let's try to \emph{write} this. 16 17 Lorem ipsum dolor sit amet, consectetur adipisicing elit, 40 \end{document} On ConTeXt however, I cannot get the font to be recognised. Please see my testfile below, in which I tried to (a) compile it with a self-installed TrueType font (which works) (b) tried to select Eco101Roman directly (which produces a ** ERROR ** Invalid font) and (c) tried to select the font through a typescript (which produces a "Metric (TFM) file or installed font not found.") What am I doing wrong? How can I get these fonts to work (and make ConTeXt treat them as a proper family too?) Looking forward to your ideas! Roland 1 % ====================== 2 % = Various font tests = 3 % ====================== 4 5 %% TRUETYPE -- works fine 6 %\definetypeface[myfont][rm][Xserif][LegacySerifLT-Book] 7 8 %% TYPE1 without typescript 9 %\definetypeface[myfont][rm][Xserif][Eco101Roman] 10 %% Produces 11 %% 12 %% [1 13 %% 14 %% ** ERROR ** Invalid font: -1 (1) 15 %% 16 %% 17 %% 18 %% Output file removed. 19 20 %% TYPE1 with typescript 21 \starttypescript[serif][eco][uc] 22 \definefontsynonym [Eco-Roman]['Eco101Roman:mapping=tex-text'][encoding=uc] 23 \definefontsynonym [Eco-Italic] ['Eco102Italic:mapping=tex-text'][encoding=uc] 24 \definefontsynonym [Eco-Bold] ['Eco301Bold:mapping=tex-text'][encoding=uc] 25 \stoptypescript 26 \usetypescript[eco] 27 \definetypeface[myfont][rm][Xserif][Eco-Roman] 28 %% produces 29 %% ./hello.tex:35: Font \*myfont12ptrmtfrm*:=Eco-Roman:mapping=tex-text at 12.0pt 30 %% not loadable: Metric (TFM) file or installed font not found. 31 %% <to be read again> 32 33 34 \starttext 35 \switchtobodyfont[myfont,18pt] 36 \section{Testing font} 37 This is plain text \bf{This is bold text} \it{This is bold italic text} 38 39 \stoptext
On Sun, 20 Jan 2008 11:21:32 +0100
Roland
Hi,
I am fairly new to both ConTeXt (and XeTeX) but I've already been very impressed with the active user community and the amount of documentation available, as well as with the sheer userfriendliness of ConTeXt when compared to LaTeX. Now I'm trying to get into fonts, but activating a Postscript Type 1 font seems to go beyond my abilities and the wiki documentation on http://wiki.contextgarden.net/Fonts_in_XeTeX . Perhaps anybody can help?
I have a Postscript type 1 font family called Eco, consisting of Eco101Roman, Eco102Italic, Eco301Bold and some others. FontBook shows these names identically as PostScript name, Full Name and Family name (which means Fontbook is unaware that they are a family, but this is not the topic here).
The fonts can be used with any Mac application and they also work fine in a LaTeX-fontspec-XeTeX combination: the following minimal LaTeX file produces the text as desired in Eco101Roman.
1 %!TEX TS-program = xelatex 2 %!TEX encoding = UTF-8 Unicode 3 \documentclass[12pt]{article} 4 \usepackage{fontspec} 5 \defaultfontfeatures{Scale=MatchLowercase} 6 \setromanfont[Mapping=tex-text]{Eco101Roman} 7 \setsansfont[Mapping=tex-text]{Skia} 8 \setmonofont{Courier} 9 \author{Roland} 10 \title{XeTeX test} 11 12 \begin{document} 13 \maketitle 14 \section{This is a new section} 15 Let's try to \emph{write} this. 16 17 Lorem ipsum dolor sit amet, consectetur adipisicing elit, 40 \end{document}
On ConTeXt however, I cannot get the font to be recognised. Please see my testfile below, in which I tried to (a) compile it with a self-installed TrueType font (which works) (b) tried to select Eco101Roman directly (which produces a ** ERROR ** Invalid font) and (c) tried to select the font through a typescript (which produces a "Metric (TFM) file or installed font not found.")
What am I doing wrong? How can I get these fonts to work (and make ConTeXt treat them as a proper family too?)
Looking forward to your ideas! Roland
1 % ====================== 2 % = Various font tests = 3 % ====================== 4 5 %% TRUETYPE -- works fine 6 %\definetypeface[myfont][rm][Xserif][LegacySerifLT-Book] 7 8 %% TYPE1 without typescript 9 %\definetypeface[myfont][rm][Xserif][Eco101Roman] 10 %% Produces 11 %% 12 %% [1 13 %% 14 %% ** ERROR ** Invalid font: -1 (1) 15 %% 16 %% 17 %% 18 %% Output file removed. 19 20 %% TYPE1 with typescript 21 \starttypescript[serif][eco][uc] 22 \definefontsynonym [Eco-Roman]['Eco101Roman:mapping=tex-text'][encoding=uc] 23 \definefontsynonym [Eco-Italic] ['Eco102Italic:mapping=tex-text'][encoding=uc] 24 \definefontsynonym [Eco-Bold] ['Eco301Bold:mapping=tex-text'][encoding=uc] 25 \stoptypescript 26 \usetypescript[eco] 27 \definetypeface[myfont][rm][Xserif][Eco-Roman] 28 %% produces 29 %% ./hello.tex:35: Font \*myfont12ptrmtfrm*:=Eco-Roman:mapping=tex-text at 12.0pt 30 %% not loadable: Metric (TFM) file or installed font not found. 31 %% <to be read again> 32 33 34 \starttext 35 \switchtobodyfont[myfont,18pt] 36 \section{Testing font} 37 This is plain text \bf{This is bold text} \it{This is bold italic text} 38 39 \stoptext
Try the following setup, please the field for the BoldItalic font by yourself because you forgot to tell the name for the style. \starttypescript[serif][eco] \definefontsynonym[Serif] [Eco-Regular] \definefontsynonym[SerifBold] [Eco-Bold] \definefontsynonym[SerifItalic] [Eco-Italic] \definefontsynonym[SerifBoldItalic][Eco-BoldItalic] \stoptypescript \starttypescript[serif][eco] \definefontsynonym[Eco-Regular] [Eco101Roman] \definefontsynonym[Eco-Bold] [Eco301Bold] \definefontsynonym[Eco-Italic] [Eco102Italic] \definefontsynonym[Eco-BoldItalic][...] \stoptypescript \starttypescript[eco] \definetypeface[\typescriptone][rm][serif][eco][default] \stoptypescript \usetypescript[eco] \setupbodyfont[eco] \starttext normal text, {\bf bold text}, {\em italic text} and {\bi bolditalic text}. \stoptext Wolfgang
On Jan 20, 2008 1:54 PM, Wolfgang Schuster wrote:
On Sun, 20 Jan 2008 11:21:32 +0100 Roland
wrote: Hi,
I am fairly new to both ConTeXt (and XeTeX) but I've already been very impressed with the active user community and the amount of documentation available, as well as with the sheer userfriendliness of ConTeXt when compared to LaTeX. Now I'm trying to get into fonts, but activating a Postscript Type 1 font seems to go beyond my abilities and the wiki documentation on http://wiki.contextgarden.net/Fonts_in_XeTeX . Perhaps anybody can help?
I have a Postscript type 1 font family called Eco, consisting of Eco101Roman, Eco102Italic, Eco301Bold and some others. FontBook shows these names identically as PostScript name, Full Name and Family name (which means Fontbook is unaware that they are a family, but this is not the topic here).
The fonts can be used with any Mac application and they also work fine in a LaTeX-fontspec-XeTeX combination: the following minimal LaTeX file produces the text as desired in Eco101Roman.
1 %!TEX TS-program = xelatex 2 %!TEX encoding = UTF-8 Unicode 3 \documentclass[12pt]{article} 4 \usepackage{fontspec} 5 \defaultfontfeatures{Scale=MatchLowercase} 6 \setromanfont[Mapping=tex-text]{Eco101Roman} 7 \setsansfont[Mapping=tex-text]{Skia} 8 \setmonofont{Courier} 9 \author{Roland} 10 \title{XeTeX test} 11 12 \begin{document} 13 \maketitle 14 \section{This is a new section} 15 Let's try to \emph{write} this. 16 17 Lorem ipsum dolor sit amet, consectetur adipisicing elit, 40 \end{document}
On ConTeXt however, I cannot get the font to be recognised. Please see my testfile below, in which I tried to (a) compile it with a self-installed TrueType font (which works) (b) tried to select Eco101Roman directly (which produces a ** ERROR ** Invalid font) and (c) tried to select the font through a typescript (which produces a "Metric (TFM) file or installed font not found.")
What am I doing wrong? How can I get these fonts to work (and make ConTeXt treat them as a proper family too?)
Looking forward to your ideas! Roland
1 % ====================== 2 % = Various font tests = 3 % ====================== 4 5 %% TRUETYPE -- works fine 6 %\definetypeface[myfont][rm][Xserif][LegacySerifLT-Book] 7 8 %% TYPE1 without typescript 9 %\definetypeface[myfont][rm][Xserif][Eco101Roman]
Xserif will not work if the font is not designed properly (grouped into the same family). Does \bf, \bi etc. work if you use \setromanfont[Mapping=tex-text]{Eco101Roman} in XeLaTeX (I guess not).
20 %% TYPE1 with typescript 21 \starttypescript[serif][eco][uc]
Leave "[uc]" out. It is not needed (any more). No other font encoding is supported in XeTeX.
22 \definefontsynonym [Eco-Roman]['Eco101Roman:mapping=tex-text'][encoding=uc]
That was the old deprecated syntax. Now the same can be expressed with % put font name for an installed font here \definefontsynonym[Eco-Roman][name:Eco101Roman][features=default] or % put filename here if kpathsea can find the file in [texmf]/fonts/opentype/[something] \definefontsynonym[Eco-Roman][file:Eco101Roman][features=default] features=default implies "mapping=tlig" (which replaces "mapping=tex-text") and handles endash, emdash and apostrophe (ligatures like `? -> reversed question mark, ,, -> quotation mark, ... from tex-text are not present since we considered them unnecessary)
23 \definefontsynonym [Eco-Italic] ['Eco102Italic:mapping=tex-text'][encoding=uc] 24 \definefontsynonym [Eco-Bold] ['Eco301Bold:mapping=tex-text'][encoding=uc] 25 \stoptypescript
Same for all of them.
26 \usetypescript[eco] 27 \definetypeface[myfont][rm][Xserif][Eco-Roman] 28 %% produces 29 %% ./hello.tex:35: Font \*myfont12ptrmtfrm*:=Eco-Roman:mapping=tex-text at 12.0pt 30 %% not loadable: Metric (TFM) file or installed font not found. 31 %% <to be read again>
The same comment as above: Xserif won't work for a font which is not designed properly.
33 34 \starttext 35 \switchtobodyfont[myfont,18pt] 36 \section{Testing font} 37 This is plain text \bf{This is bold text} \it{This is bold italic text} 38 39 \stoptext
Try the following setup, please the field for the BoldItalic font by yourself because you forgot to tell the name for the style.
\starttypescript[serif][eco] \definefontsynonym[Serif] [Eco-Regular] \definefontsynonym[SerifBold] [Eco-Bold] \definefontsynonym[SerifItalic] [Eco-Italic] \definefontsynonym[SerifBoldItalic][Eco-BoldItalic] \stoptypescript
\starttypescript[serif][eco] \definefontsynonym[Eco-Regular] [Eco101Roman] \definefontsynonym[Eco-Bold] [Eco301Bold] \definefontsynonym[Eco-Italic] [Eco102Italic] \definefontsynonym[Eco-BoldItalic][...]
Right, but use the syntax described above. (add [features=default] if you want to use endash, emdash, ... and prepend name: or file:)
\stoptypescript
\starttypescript[eco] \definetypeface[\typescriptone][rm][serif][eco][default] \stoptypescript
\usetypescript[eco] \setupbodyfont[eco]
\starttext normal text, {\bf bold text}, {\em italic text} and {\bi bolditalic text}. \stoptext
Wolfgang
Mojca
Roland, I forgot two things so I should better mention some before you ask. First: welcome to the ConTeXt community. Second: you need a *recent enough* ConTeXt (anything between october 07-january 08), but if you take the latest one, then you also need the future version of LM :) And you need a recent version of XeTeX & xdvipdfmx. If you're using TeX Live's version, then: a) update XeTeX binaries compile it from sources or take it from here (you can download it manually from http or using rsync) and replace the old binaries with these ones: http://minimals.contextgarden.net/current/bin/xetex/osx-intel/bin/ or rsync -av rsync://contextgarden.net/minimals/current/bin/xetex/osx-intel/bin/ path-to-bins b) update ConTeXt many other ways to do it as well (you can take a zip from pragma) For example: rsync -av rsync://contextgarden.net/minimals/current/context/2008.01.16/ path-to-texmf-tree-with-context you may replace 2008.01.16 with any version that you find here: http://minimals.contextgarden.net/current/context/ 2008.01.16 requres new LM fonts already, older versions do not. c) update LM if you take too recent ConTeXt (otherwise, leave the fonts alone) - these fonts are still a pre-release version, so you should better take an older version of ConTeXt rsync -av rsync://contextgarden.net/minimals/current/fonts/new/fonts/opentype/public/lm/ path-to-LM Mojca
Hi Wolfgang,
Thanks, I tried this. Getting loads of error messages though, see
below. They are repeated multiple times in Textmate, just once when I
try to issue the command "mktextfm Eco101Roman" from the command line.
1 /usr/local/texlive/2007/texmf/web2c/mktexnam: Could not map
source abbreviation E for Eco101Roman.
2 /usr/local/texlive/2007/texmf/web2c/mktexnam: Need to update
/usr/local/texlive/2007/texmf-dist/fonts/map/fontname/special.map?
3 mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1;
nonstopmode; input Eco101Roman
4 This is METAFONT, Version 2.71828 (Web2C 7.5.6)
5
6 kpathsea: Running mktexmf Eco101Roman
7 ! I can't find file `Eco101Roman'.
8 <*> ...our; mag:=1; nonstopmode; input Eco101Roman
9
10 Please type another input file name
11 ! Emergency stop.
12 <*> ...our; mag:=1; nonstopmode; input Eco101Roman
13
14 Transcript written on mfput.log.
15 grep: Eco101Roman.log: No such file or directory
16 mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1;
nonstopmode; input Eco101Roman' failed to make Eco101Roman.tfm.
This is in a freshly installed MacTex version, producing version
numbers as below:
1 This is XeTeXk, Version 3.141592-2.2-0.996 (Web2C 7.5.6)
2 file:line:error style messages enabled.
3 %&-line parsing enabled.
4 (WARNING: translate-file "natural.tcx" ignored)
5 entering extended mode
6 (./hello.tex
7
8 ConTeXt ver: 2007.01.12 15:56 MKII fmt: 2008.1.20 int:
english/english
Any idea?
Thanks
Roland
On 20/01/2008, Wolfgang Schuster
On Sun, 20 Jan 2008 11:21:32 +0100 Roland
wrote: Hi,
I am fairly new to both ConTeXt (and XeTeX) but I've already been very impressed with the active user community and the amount of documentation available, as well as with the sheer userfriendliness of ConTeXt when compared to LaTeX. Now I'm trying to get into fonts, but activating a Postscript Type 1 font seems to go beyond my abilities and the wiki documentation on http://wiki.contextgarden.net/Fonts_in_XeTeX . Perhaps anybody can help?
I have a Postscript type 1 font family called Eco, consisting of Eco101Roman, Eco102Italic, Eco301Bold and some others. FontBook shows these names identically as PostScript name, Full Name and Family name (which means Fontbook is unaware that they are a family, but this is not the topic here).
The fonts can be used with any Mac application and they also work fine in a LaTeX-fontspec-XeTeX combination: the following minimal LaTeX file produces the text as desired in Eco101Roman.
1 %!TEX TS-program = xelatex 2 %!TEX encoding = UTF-8 Unicode 3 \documentclass[12pt]{article} 4 \usepackage{fontspec} 5 \defaultfontfeatures{Scale=MatchLowercase} 6 \setromanfont[Mapping=tex-text]{Eco101Roman} 7 \setsansfont[Mapping=tex-text]{Skia} 8 \setmonofont{Courier} 9 \author{Roland} 10 \title{XeTeX test} 11 12 \begin{document} 13 \maketitle 14 \section{This is a new section} 15 Let's try to \emph{write} this. 16 17 Lorem ipsum dolor sit amet, consectetur adipisicing elit, 40 \end{document}
On ConTeXt however, I cannot get the font to be recognised. Please see my testfile below, in which I tried to (a) compile it with a self-installed TrueType font (which works) (b) tried to select Eco101Roman directly (which produces a ** ERROR ** Invalid font) and (c) tried to select the font through a typescript (which produces a "Metric (TFM) file or installed font not found.")
What am I doing wrong? How can I get these fonts to work (and make ConTeXt treat them as a proper family too?)
Looking forward to your ideas! Roland
1 % ====================== 2 % = Various font tests = 3 % ====================== 4 5 %% TRUETYPE -- works fine 6 %\definetypeface[myfont][rm][Xserif][LegacySerifLT-Book] 7 8 %% TYPE1 without typescript 9 %\definetypeface[myfont][rm][Xserif][Eco101Roman] 10 %% Produces 11 %% 12 %% [1 13 %% 14 %% ** ERROR ** Invalid font: -1 (1) 15 %% 16 %% 17 %% 18 %% Output file removed. 19 20 %% TYPE1 with typescript 21 \starttypescript[serif][eco][uc] 22 \definefontsynonym [Eco-Roman]['Eco101Roman:mapping=tex-text'][encoding=uc] 23 \definefontsynonym [Eco-Italic] ['Eco102Italic:mapping=tex-text'][encoding=uc] 24 \definefontsynonym [Eco-Bold] ['Eco301Bold:mapping=tex-text'][encoding=uc] 25 \stoptypescript 26 \usetypescript[eco] 27 \definetypeface[myfont][rm][Xserif][Eco-Roman] 28 %% produces 29 %% ./hello.tex:35: Font \*myfont12ptrmtfrm*:=Eco-Roman:mapping=tex-text at 12.0pt 30 %% not loadable: Metric (TFM) file or installed font not found. 31 %% <to be read again> 32 33 34 \starttext 35 \switchtobodyfont[myfont,18pt] 36 \section{Testing font} 37 This is plain text \bf{This is bold text} \it{This is bold italic text} 38 39 \stoptext
Try the following setup, please the field for the BoldItalic font by yourself because you forgot to tell the name for the style.
\starttypescript[serif][eco] \definefontsynonym[Serif] [Eco-Regular] \definefontsynonym[SerifBold] [Eco-Bold] \definefontsynonym[SerifItalic] [Eco-Italic] \definefontsynonym[SerifBoldItalic][Eco-BoldItalic] \stoptypescript
\starttypescript[serif][eco] \definefontsynonym[Eco-Regular] [Eco101Roman] \definefontsynonym[Eco-Bold] [Eco301Bold] \definefontsynonym[Eco-Italic] [Eco102Italic] \definefontsynonym[Eco-BoldItalic][...] \stoptypescript
\starttypescript[eco] \definetypeface[\typescriptone][rm][serif][eco][default] \stoptypescript
\usetypescript[eco] \setupbodyfont[eco]
\starttext normal text, {\bf bold text}, {\em italic text} and {\bi bolditalic text}. \stoptext
Wolfgang ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
participants (3)
-
Mojca Miklavec
-
Roland
-
Wolfgang Schuster