Changes

Jump to navigation Jump to search
6,209 bytes added ,  19:02, 5 May 2014
Added links to the Fonts Manual.
'''Please, someone, fill this page !'''
'''This page is beeing regorganizedbeing reorganized'''
= Getting access Using [[LuaTeX]] as the processing engine in ConTeXt allows one to directly use fonts installed on the user's system . Instead of converting all fonts into the standard <code>.tfm</code> and <code>.vf</code> formats (as outlined in some [[My Way]] documents<ref>[http://dl.contextgarden.net/websitesarchive/atl/tex/OpenType.pdf OpenType in ConTeXt] by Adam Lindsay</ref><ref>[http://dl.contextgarden.net/myway/expertfonts.pdf Installing Expert Fonts: Minion Pro] by Idris Samawi Hamid</ref>), LuaTeX creates these metric files automatically at run-time. This greatly simplifies font installation in ConTeXt. =How LuaTeX handles system fonts = LuaTeX can use fonts in non-TeX format (e.g. OpenType, TrueType or Type1 format) directly. When ConTeXt processes a file that uses such non-traditional fonts, the actual fonts themselves are loaded in LuaTeX's embedded section of fontforge to extract their metric information. This removes the need for tfm and vf files on your disk, but it is also a somewhat lengthy and often memory-hungry process. Fortunately, the result of that internal preprocessing are also saved inside the texmf cache. Future runs using the same font (not just this file, but all files using that particular font) can then use the cached version of the metrics instead. Mac OS users should note that the current version of LuaTeX (0.60) has severe problems dealing with the new TrueType collection fonts in Snow Leopard (Mac OS 10.6). The older Mac OS .dfont format works fine nowadays.
== Building the font database ==
You can make LuaTeX access the non-TeX fonts (Type 1, True Type and OpenType) on your system by building a font database. First, you need to specify where the fonts should be looked for, by setting the <code>OSFONTDIR</code> environment variable. For instanceOn Windows,this might be achieved by running
set OSFONTDIR=c:/windows/fonts/
if the fonts should be found in <code>c:/windows/fonts/</code>; or. For Unix machines,
export OSFONTDIR="/usr/local/share/fonts;$HOME/.fonts"
if indicate that the fonts should be found in both <code>/usr/local/share/fonts</code> and <code>$HOME/.fonts</code>.
The font database will then be automatically generated in the next run of <code>context</code>. You can then also generate the font database it manually by typing mtxrun --script font --reloador equally
mtxrun --script fonts --reload
MTXrun | fontnames: 3837 files read, 3342 normal and 49 extra entries added, 5 rejected, 3386 valid
If mtxrun has problem finding the mtx-fonts.lua file, it may be necessary to regenerate ConTeXt's file database: context --generate
== Querying the font database ==
The command
mtxrun --script fonts --list--all --pattern=*
will return the whole entries of the font database as a list, such as
You can query the database against a particular pattern. For instance,
mtxrun --script fonts --list --all --pattern=Delicious*
will return
deliciousbold Delicious-Bold /usr/local/share/fonts/d/delicious_bold.otf
== Installing new fonts ==
After installing new fonts, the font datamase database must be rebuilt for LuaTeX to access them. In current versions of Mark IV (earlier than July 2008) this is automatically done whenever a named font cannot be found. You only have to do the reload manually when you have installed updates to already installed fonts that cause the font and/or file names to change. This normally only happens for fonts that are still in development like [[TeX Gyre]] and [[Latin Modern]].
You can rebuild the database manually, using the already-mentioned command
mtxrun --script fonts --reload
Alternatively, you can get turn off the automatic rebuild of the database to be automatically rebuilt when needed -- that is, on 'font not found' errors. To do so, set by setting either of
MTX.FONTS.AUTOLOAD
MTX_FONTS_AUTOLOAD
to "yesno". == Get a warning if the glyph is missing == You need to add the command <code>\checkcharactersinfont</code> or(better) <code>\enabletrackers[fonts.missing]</code> in the preambleof your document. == References == [http://context.aanhet.net/svn/contextman/context-reference/en/co-fonts.pdf The new manual chapter on fonts]  [http://pragma-ade.com/general/manuals/mfonts.pdf Old Fonts Manual by Hans Hagen] [http://pragma-ade.com/general/manuals/fonts-mkiv.pdf New Fonts Manual by Hans Hagen]  = Using fonts = Handling fonts in LuaTeX can be done* in a simple but limited way, using the [[simplefonts|<code>simplefonts</code> module]];* in the standard way, using [[TypeScripts]] == The standard way: Typescripts == === Installing typescripts === Installing typescripts consists in the following: 1. Copy the typescript files into either <texcode>$TEXMF/tex/texmf-fonts/tex/context/user$TEXMF/tex/texmf-project/tex/context/user</texcode>2. Run <code>context --generate</code> By convention, typescript files are named like <code>type-(fontname|foundry).tex</code>.  It may happen that some <code>type-xx.tex</code> typescript file depends on mkiv-specific code located in a matching <code>type-xx.mkiv</code> file. In this case, both files need to be installed. === Loading typescripts === A typescript file named <code>type-xx.tex</code> should be loaded using \usetypescriptfile[type-xx] An alternative way is \usetypefile[xx]where ConTeXt prepends <code>type-</code> when it loads the file; but <cmd>usetypescriptfile</cmd> is the preferred command because it takes care of the<cmd>starttypescriptcollection</cmd>/<cmd>stoptypescriptcollection</cmd> environments. === Very simple example of typescript === If you are new to typescript you might have a look at this [[Simple Typescript Example]] to get a first idea how to use it. === Where to find existing typescripts === Each of the typescripts below defines a keyword to use with <cmd>setupbodyfont</cmd>. Usually this is the same as the name of the typescript, but there is one exception (<code>antykwa-torunska</code>) * Latin Modern (typescript name: <code>modern</code>; this is the default font set)* Latin Modern variant (ts name: <code>modernvariable</code>; LM variable typewriter for serif)* Postscript (ts name: <code>postscript</code>; Termes for serif, Heros for sans, Cursor for mono)* Antykwa Toruńska (ts name: <code>antykwa-torunska</code>; only serif; defines <tt>antykwa</tt> as keyword for <cmd>setupbodyfont</cmd>)* Iwona (ts name: <code>iwona</code>; only sans serif)* Iwona Light, Medium and Heavy (ts names: <code>iwona-light</code>, <code>iwona-medium</code>, <code>iwona-heavy</code>; only sans; the medium variant is a small bit heavier than a "regular" one)* Pagella (ts name: <code>palatino</code>; only serif)* Termes (ts name: <code>times</code>; only serif, Heros for sans) === Usage example === <texcode>\usetypescript[palatino]\setupbodyfont[palatino,18pt] \starttextHello world, I'm Pagella!\stoptext</texcode> The first line seems to order ConTeXt to "install" (for the current file) the given typescript (it accepts what I have earlier called a "typescript name"). The last one starts using it (you may omit the size if you are satisfied with the default). === Combining predefined fonts in your own typescripts === It is also possible to combine fonts from the TeX Gyre collection in your own typescripts. The example below combines Bonum (Bookman) roman, Adventor (AvantGarde) for sans serif, Cursor (Courier) for teletype, and Euler for math. The <code>rscale=...</code> option ensures that all fonts have the same x-height. (You can lookup the relative x-heigt of a font using fontforge.) <texcode>\starttypescript [Bonum] \definetypeface [Bonum] [rm] [serif] [bonum] [default] \definetypeface [Bonum] [ss] [sans] [adventor] [default] [rscale=0.887] \definetypeface [Bonum] [tt] [mono] [cursor] [default] [rscale=1.163] \definetypeface [Bonum] [mm] [math] [euler] [default] [rscale=1.050]\stoptypescript \usetypescript[Bonum]\setupbodyfont[Bonum,12pt] \starttextHello world, I'm Bonum!\stoptext</texcode>
= Old contents =
 
* [[TrueType fonts in luaTeX]]
==== Good ol' typescripts ====
</texcode>
 
= References =
<references/>
[[Category:Fonts]]
[[Category:International]]
[[Category:LuaTeX]]
5

edits

Navigation menu