Changes

Jump to navigation Jump to search
7,378 bytes added ,  17:57, 22 January 2023
m
typo missing }
'''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 [[This Way - My Way#MyWay|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 can use non-TeX handles system fonts (in OpenType, TrueType or Type1 format) directly.=
The first time LuaTeX can use fonts in non-TeX format (e.g. OpenType, TrueType or Type1 format) directly. When ConTeXt processes a file that you runuses 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.
context myfile.tex on a file Mac OS users should note that uses such non-traditional fonts the current version of LuaTeX (which is probably always0.60), has severe problems dealing with the actual new TrueType collection fonts themselves have to be loaded in luatex's embedded section of fontforge to extract their metric informationSnow Leopard (Mac OS 10. This removes the need for tfm and vf files on your disk, but it is also a somewhat lengthy and often memory-hungry process6)That is why the results of that internal preprocessing are also saved inside the texmf cacheThe older Mac OS . 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 insteaddfont format works fine nowadays.
== Building the font database ==
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>
The font database will then be automatically generated in the next run of <code>context</code>. You can also generate 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
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- Old Content]] and [[Latin Modern]].
You can rebuild the database manually, using the already-mentioned command
to "no".
== References Missing glyphs ==
You need to add the command {{cmd|checkcharactersinfont}} or(better) {{cmd|enabletrackers|[http://context.aanhet.net/svn/contextman/context-reference/en/co-fonts.pdf The new manual chapter on fontsmissing]}} in the preambleof your document.
{{cmd|replacemissingcharacters}} will insert boxes where missing characters are expected. The boxes adhere to font style (italics, bold) and copying the box from PDF into the text editor will insert the missing glyph, so one can see the missing character without looking at the ''missing characters'' section of the log file.  {{cmd|enabledirectives|2= Using fonts [logs.errors=missing characters]}} throws an error and quits ConTeXt. After that, all you have to do is search for <code>start missing characters:</code> in the log file. In fairly recent LMTX and MkIV versions,<ref>Current latest from 2023.01.15 14:04, as the time of writing.</ref> only {{cmd|enabledirectives|2=[logs.errors=missing characters]}} and/or {{cmd|replacemissingcharacters}} are required.
Handling fonts in LuaTeX can be done* in a simple but limited wayFor example, using imagine this (otherwise extreme) example:<ref>The relevant section of the log file from this sample would read:<codepre>fonts > start missing characters: /home/user/context/tex/texmf/fonts/data/gust/lm/lmroman10-regular.otffonts > 2 U+003AC ά GREEK SMALL LETTER ALPHA WITH TONOSfonts > 2 U+003AD έ GREEK SMALL LETTER EPSILON WITH TONOSfonts > 2 U+003AE ή GREEK SMALL LETTER ETA WITH TONOSfonts > 2 U+003AF ί GREEK SMALL LETTER IOTA WITH TONOSfonts > 2 U+003B1 α GREEK SMALL LETTER ALPHAfonts > 2 U+003B2 β GREEK SMALL LETTER BETAfonts > 2 U+003B3 γ GREEK SMALL LETTER GAMMAfonts > 2 U+003B4 δ GREEK SMALL LETTER DELTAfonts > 2 U+003B5 ε GREEK SMALL LETTER EPSILONfonts > 2 U+003B7 η GREEK SMALL LETTER ETAfonts > 2 U+003B8 θ GREEK SMALL LETTER THETAfonts > 2 U+003B9 ι GREEK SMALL LETTER IOTAfonts > 2 U+003BA κ GREEK SMALL LETTER KAPPAfonts > 2 U+003BB λ GREEK SMALL LETTER LAMDAfonts > 2 U+003BC μ GREEK SMALL LETTER MUfonts > 2 U+003BD ν GREEK SMALL LETTER NUfonts > 2 U+003BF ο GREEK SMALL LETTER OMICRONfonts > 2 U+003C0 π GREEK SMALL LETTER PIfonts > 2 U+003C1 ρ GREEK SMALL LETTER RHOfonts > 2 U+003C2 ς GREEK SMALL LETTER FINAL SIGMAfonts > 2 U+003C3 σ GREEK SMALL LETTER SIGMAfonts > 2 U+003C4 τ GREEK SMALL LETTER TAUfonts > 2 U+003C5 υ GREEK SMALL LETTER UPSILONfonts > 2 U+003C6 φ GREEK SMALL LETTER PHIfonts > 2 U+003C7 χ GREEK SMALL LETTER CHIfonts > 2 U+003C8 ψ GREEK SMALL LETTER PSIfonts > 2 U+003C9 ω GREEK SMALL LETTER OMEGAfonts > 2 U+003CC ό GREEK SMALL LETTER OMICRON WITH TONOSfonts > 2 U+003CD ύ GREEK SMALL LETTER UPSILON WITH TONOSfonts > 2 U+003CE ώ GREEK SMALL LETTER OMEGA WITH TONOSfonts > 2 U+01F00 ἀ GREEK SMALL LETTER ALPHA WITH PSILIfonts > 2 U+01F04 ἄ GREEK SMALL LETTER ALPHA WITH PSILI AND OXIAfonts > 2 U+01F05 ἅ GREEK SMALL LETTER ALPHA WITH DASIA AND OXIAfonts > 2 U+01F10 ἐ GREEK SMALL LETTER EPSILON WITH PSILIfonts > 2 U+01F14 ἔ GREEK SMALL LETTER EPSILON WITH PSILI AND OXIAfonts > 2 U+01F21 ἡ GREEK SMALL LETTER ETA WITH DASIAfonts > 2 U+01F22 ἢ GREEK SMALL LETTER ETA WITH PSILI AND VARIAfonts > 2 U+01F27 ἧ GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENIfonts > 2 U+01F30 ἰ GREEK SMALL LETTER IOTA WITH PSILIfonts > 2 U+01F31 ἱ GREEK SMALL LETTER IOTA WITH DASIAfonts > 2 U+01F34 ἴ GREEK SMALL LETTER IOTA WITH PSILI AND OXIAfonts > 2 U+01F37 ἷ GREEK SMALL LETTER IOTA WITH DASIA AND PERISPOMENIfonts > 2 U+01F41 ὁ GREEK SMALL LETTER OMICRON WITH DASIAfonts > 2 U+01F44 ὄ GREEK SMALL LETTER OMICRON WITH PSILI AND OXIAfonts > 2 U+01F45 ὅ GREEK SMALL LETTER OMICRON WITH DASIA AND OXIAfonts > 2 U+01F50 ὐ GREEK SMALL LETTER UPSILON WITH PSILIfonts > 2 U+01F51 ὑ GREEK SMALL LETTER UPSILON WITH DASIAfonts > 2 U+01F54 ὔ GREEK SMALL LETTER UPSILON WITH PSILI AND OXIAfonts >simplefonts 2 U+01F56 ὖ GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENIfonts > 2 U+01F61 ὡ GREEK SMALL LETTER OMEGA WITH DASIAfonts > 2 U+01F65 ὥ GREEK SMALL LETTER OMEGA WITH DASIA AND OXIAfonts > 2 U+01F70 ὰ GREEK SMALL LETTER ALPHA WITH VARIAfonts > 2 U+01F72 ὲ GREEK SMALL LETTER EPSILON WITH VARIAfonts > 2 U+01F74 ὴ GREEK SMALL LETTER ETA WITH VARIAfonts > 2 U+01F78 ὸ GREEK SMALL LETTER OMICRON WITH VARIAfonts > 2 U+01FA7 ᾧ GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENIfonts > 2 U+01FB6 ᾶ GREEK SMALL LETTER ALPHA WITH PERISPOMENIfonts > 2 U+01FBD ᾽ GREEK KORONISfonts > 2 U+01FC6 ῆ GREEK SMALL LETTER ETA WITH PERISPOMENIfonts > 2 U+01FC7 ῇ GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENIfonts > 2 U+01FD6 ῖ GREEK SMALL LETTER IOTA WITH PERISPOMENIfonts > 2 U+01FE5 ῥ GREEK SMALL LETTER RHO WITH DASIAfonts > 2 U+01FE6 ῦ GREEK SMALL LETTER UPSILON WITH PERISPOMENIfonts > 2 U+01FF6 ῶ GREEK SMALL LETTER OMEGA WITH PERISPOMENIfonts > 2 U+01FF7 ῷ GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENIfonts > stop missing characters</codepre> module;* in Of course, this is an extreme case, since the standard way, using [[TypeScripts]]''Latin Roman'' typefaces lack Greek glyphs.</ref>
<context source="yes">\enabledirectives[logs.errors=missing characters]\mainlanguage[agr]\replacemissingcharacters\startTEXpage[offset= With the <code>simplefonts2em]\input aristotle-grc\stopTEXpage</codecontext> module ==
<code>simplefonts</code> is a third-party module written by Wolfgang SchusterThis particular error quits ConTeXt after the first run.The last two lines in the console are:
It simplifies the use of fonts in LuaTeX by* freeing the user from writing or using [[TypeScripts]];* offering an interface similar <pre>system > status > quitting due to the [http://www.ctan.org/texmissing charactersmtx-archive/macros/xetex/latex/fontspeccontext | fatal error: return code: 1</ fontspec package for XeTeX]pre>
For instanceUnless you check the console messages, assuming the [http://www.josbuivenga.demon.nl/delicious.html Delicious fonts] are properly installed and recognized by ConTeXtlog file or the whole document looking for the replaced glyphs, please consider that you can simply write:might miss that your PDF document may be lacking glyphs.
<texcode>\usemodule[simplefonts] % load the module\setmainfont[Delicious] % set Delicious as main (serif) font= Using fonts =
\starttext\rm\tf roman \it italic \bf bold \bi bolditalic \sc smallcaps\stoptextHandling fonts in LuaTeX can be done* in a simple but limited way, using the [[Simplefonts - Old Content|<code>simplefonts</texcodecode>module]];* in the standard way, using [[TypeScripts - Old Content]]
== The standard way: Typescripts ==
\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)
That's as simple as using a traditional ConTeXt typescript!
But ... how is it any different, then? Well, the difference is that in Mark IV, we can use an Opentype font directly, so that what is done here: when we want to use Palatino, the [[TeX Gyre- Old Content]] equivalent (“Pagella”) is called and we can use its Opentype “features”; read on.
==== Opentype features ====
== Example ==
 
Now to access, say the regular warnock font, the following are valid. And I ought to mention that Hans recommends the first http://article.gmane.org/gmane.comp.tex.context/43685.
</texcode>
 
= References =
 
* Chapter [http://pmrb.free.fr/contextref.pdf#aut:495 ''Fonts''] from the ''ConTeXt Reference Manual'' by Hans Hagen and Taco Hoekwater (September 2013).
* [https://pragma-ade.com/general/manuals/mfonts.pdf ''Fonts in ConTeXt''] by Hans Hagen (November 2005).
* [https://pragma-ade.com/general/manuals/fonts-mkiv.pdf ''Fonts Out of ConteXt: Explaining LuaTeX and MkIV''] by Hans Hagen (2016)
 
 
= Footnotes =
 
[[Category:Fonts]]
[[Category:International]]
139

edits

Navigation menu