Difference between revisions of "Understanding how fonts work in ConTeXt - Old Content"

From Wiki
Jump to navigation Jump to search
(using palatino)
(some typescripts mumbo-jumbo)
Line 1: Line 1:
This page is a draft which I hope will evolve into some kind of beginner's guide to understanding what's going on in ConTeXt as far as fonts are concerned.  Currently I can hardly understand anything about it, but I keep on asking on the mailing list;) (http://archive.contextgarden.net/thread/20080304.225545.5990b35d.en.html) and I'm going to post the answers here.
+
This page is a draft (currently kind of a personal notebook) which I hope will evolve into some kind of beginner's guide to understanding what's going on in ConTeXt as far as fonts are concerned.  Currently I can hardly understand anything about it, but I keep on asking on the mailing list;) (http://archive.contextgarden.net/thread/20080304.225545.5990b35d.en.html) and I'm going to post the answers here.
  
Most of the following material comes from the answers I got on the mailing list.  Since crediting people for each and every answer would be cumbersome, I'd like to thank here all of you that helped me understand ConTeXt (especially Hans, of course). --[[User:Mbork|Mbork]] 00:37, 5 March 2008 (CET)
+
Most of the following material comes from the answers I got on the mailing list and/or the documentation (mfonts.pdf).  Since crediting people for each and every answer would be cumbersome, I'd like to thank here all of you that helped me understand ConTeXt (especially Hans, of course).
  
== How to typeset in Palatino ==
+
Please correct any errors you spot on this page!  I'm a ConTeXt newbie and write here what I guess is right, but I might as well be wrong.  Don't rely on any information marked with a question sign!  (Still, I hope I'll get it more or less right...)
 +
 
 +
--[[User:Mbork|Mbork]] 15:28, 5 March 2008 (CET)
 +
 
 +
== How to typeset in, say, Palatino ==
  
 
<context source="yes">
 
<context source="yes">
Line 14: Line 18:
 
\stoptext
 
\stoptext
 
</context>
 
</context>
 +
 +
<cmd>usetypescriptfile</cmd> loads a given file (<code>type-gyr.tex</code> in this case).  This file usually contains definitions of ''typescripts''.  <cmd>usetypescript</cmd> kind of "selects" (?) the specified typescript from that file.  It takes up to three parametres and their rôles are still cryptic to me...
 +
 +
== Defining typescripts ==
 +
One of the keys for defining typescripts is clever usage of the <cmd>definefontsynonym</cmd> command.  It takes 2 or three parameters.  Example from mfonts.pdf:
 +
<texcode>\definefontsynonym[Serif][Times-Roman]
 +
\definefontsynonym[Times-Roman][tir][encoding=texnansi]</texcode>
 +
 +
The first case - with two arguments - makes <code>Serif</code> kind of an "alias" (?) for <code>Times-Roman</code>.  Both names are completely independent of name of the font file.  This is clever, since instead of fiddling with font file names one can say <code>Times-Roman</code> and just don't care where it resides on tbe disk.  Or even better: one can say <code>Serif</code> and don't care whether the final version of the document will use Times, Palatino or Latin Modern.
 +
 +
The second one makes <code>Times-Roman</code> an "alias" (?) for font stored in the file called <code>tir</code> (probably with some extension?).  The third argument specifies the encoding (it might be qx, for instance, or something else) and possibly another options, like <code>features=smallcaps</code> (for opentype fonts).  Encoding is used by pdfTeX only - XeTeX and LuaTeX both use Unicode (Mojca - thanks for this point!).  Other possibilities include <code>mapping</code> and <code>handling</code>, but don't ask me about these;).

Revision as of 14:30, 5 March 2008

This page is a draft (currently kind of a personal notebook) which I hope will evolve into some kind of beginner's guide to understanding what's going on in ConTeXt as far as fonts are concerned. Currently I can hardly understand anything about it, but I keep on asking on the mailing list;) (http://archive.contextgarden.net/thread/20080304.225545.5990b35d.en.html) and I'm going to post the answers here.

Most of the following material comes from the answers I got on the mailing list and/or the documentation (mfonts.pdf). Since crediting people for each and every answer would be cumbersome, I'd like to thank here all of you that helped me understand ConTeXt (especially Hans, of course).

Please correct any errors you spot on this page! I'm a ConTeXt newbie and write here what I guess is right, but I might as well be wrong. Don't rely on any information marked with a question sign! (Still, I hope I'll get it more or less right...)

--Mbork 15:28, 5 March 2008 (CET)

How to typeset in, say, Palatino

\usetypescriptfile[type-gyr]
\usetypescript[palatino][qx]
\setupbodyfont[palatino,10pt]

\starttext
Hello world, I'm Palatino!
\stoptext

\usetypescriptfile loads a given file (type-gyr.tex in this case). This file usually contains definitions of typescripts. \usetypescript kind of "selects" (?) the specified typescript from that file. It takes up to three parametres and their rôles are still cryptic to me...

Defining typescripts

One of the keys for defining typescripts is clever usage of the \definefontsynonym command. It takes 2 or three parameters. Example from mfonts.pdf:

\definefontsynonym[Serif][Times-Roman]
\definefontsynonym[Times-Roman][tir][encoding=texnansi]

The first case - with two arguments - makes Serif kind of an "alias" (?) for Times-Roman. Both names are completely independent of name of the font file. This is clever, since instead of fiddling with font file names one can say Times-Roman and just don't care where it resides on tbe disk. Or even better: one can say Serif and don't care whether the final version of the document will use Times, Palatino or Latin Modern.

The second one makes Times-Roman an "alias" (?) for font stored in the file called tir (probably with some extension?). The third argument specifies the encoding (it might be qx, for instance, or something else) and possibly another options, like features=smallcaps (for opentype fonts). Encoding is used by pdfTeX only - XeTeX and LuaTeX both use Unicode (Mojca - thanks for this point!). Other possibilities include mapping and handling, but don't ask me about these;).