Difference between revisions of "Command/definetypeface"

From Wiki
Jump to navigation Jump to search
m (fixed reference to "next section")
(remove manual syntax table (was outdated))
 
(4 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
}}
 
}}
  
== [[Help:Reference|Syntax]] ==
+
== [[Help:Reference|Syntax]] (autogenerated) ==
<table cellspacing="4" cellpadding="2" class="cmd">
+
<syntax>definetypeface</syntax>
  <tr>
 
    <td colspan="2" class="cmd">\definetypeface<span class="first">[...]</span><span class="second">[...]</span><span class="third">[...]</span><span class="fourth">[...]</span><span class="fifth">[...]</span><span class="sixth">[...]</span></td>
 
  </tr>
 
  <tr valign="top" class="first">
 
    <td class="cmd">[...]</td>
 
    <td>TEXT (typescript identifier)</td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[...]</td>
 
    <td>rm ss tt mm hw cg ("basic style")</td>
 
  </tr>
 
  <tr valign="top" class="third">
 
    <td class="cmd">[...]</td>
 
    <td>IDENTIFIER (existing font set)</td>
 
  </tr>
 
  <tr valign="top" class="fourth">
 
    <td class="cmd">[...]</td>
 
    <td>IDENTIFIER (existing font set)</td>
 
  </tr>
 
  <tr valign="top" class="fifth">
 
    <td class="cmd">[...]</td>
 
    <td>IDENTIFIER (?)</td>
 
  </tr>
 
  <tr valign="top" class="sixth">
 
    <td class="cmd">[...]</td>
 
    <td>features = IDENTIFIER<br />
 
rscale = NUMBER<br/>
 
encoding = IDENTIFIER<br/>
 
text = IDENTIFIER</td>
 
  </tr>
 
</table>
 
  
 
== Description ==  
 
== Description ==  
  
{{cmd|definetypeface}} sets up a typeface for use within a typescript.
+
{{cmd|definetypeface}} sets up a typeface for use within a typescript. This typeface links a style (rm, ss, etc.) to an actual font family (or font set).
 +
 
 +
The first argument specifies the typescript of which the newly defined typeface will be a part.
 +
 
 +
The second argument tells which style to define a typeface for.
  
 
The third and fourth arguments to \definetypeface are pointers to already declared font sets;
 
The third and fourth arguments to \definetypeface are pointers to already declared font sets;
these are defined elsewhere. Table 5.8 gives the full list of predefined typescripts (the first
+
these are defined elsewhere. [[ConTeXt_reference_manual|Table 5.8]] gives the full list of predefined typescripts (the first
 
argument of \starttypescript) and font sets that are attached to the styles (the third and
 
argument of \starttypescript) and font sets that are attached to the styles (the third and
 
fourth argument of each \definetypeface).
 
fourth argument of each \definetypeface).
Line 50: Line 23:
 
ternally remapped to one of the two-letter internal styles. Inside \definetypeface, they are
 
ternally remapped to one of the two-letter internal styles. Inside \definetypeface, they are
 
nothing more than convenience names that are attached to a group of fonts by the person that
 
nothing more than convenience names that are attached to a group of fonts by the person that
wrote the font definition. They only reflect a grouping that the person believed that could be
+
wrote the font definition. They only reflect a grouping that the person believed that could be
 
a single font style. Oftentimes, these names are identical to the official style keywords, just as
 
a single font style. Oftentimes, these names are identical to the official style keywords, just as
 
the typescript and typeface names are often the same, but there can be (and sometimes are)
 
the typescript and typeface names are often the same, but there can be (and sometimes are)
 
different names altogether.
 
different names altogether.
  
How to define your own font sets is explained in the reference manual, but there are quite a
+
How to define your own font sets is explained in the reference manual, but there are quite a
few predefined font sets that come with ConTEXt; these are all listed in the four tables 5.9, 5.10,
+
few predefined font sets that come with ConTEXt; these are all listed in the four [[ConTeXt_reference_manual|tables 5.9, 5.10,
5.11, and 5.12.
+
5.11, and 5.12]].
 
For everything to work properly in MkII, the predefined font sets also have to have an encoding
 
For everything to work properly in MkII, the predefined font sets also have to have an encoding
 
attached, you can look those up in the relevant tables as well.
 
attached, you can look those up in the relevant tables as well.
Line 70: Line 43:
 
== Example ==
 
== Example ==
 
<context source="yes">
 
<context source="yes">
\starttypescript [palatino] [texnansi,ec,qx,t5,default]
+
\starttypescript [palatino]
 
  \definetypeface[palatino] [rm] [serif][palatino] [default]
 
  \definetypeface[palatino] [rm] [serif][palatino] [default]
 
  \definetypeface[palatino] [ss] [sans] [modern] [default] [rscale=1.075]
 
  \definetypeface[palatino] [ss] [sans] [modern] [default] [rscale=1.075]
Line 78: Line 51:
 
</context>
 
</context>
  
This defines a typescript named palatino in five different encodings. When this typescript is
+
This defines a typescript named `palatino`. When this typescript is
executed via \usetypescript, it will define four typefaces, one of each of the four basic styles
+
executed via {{cmd|usetypescript}}, it will define four `typeface`s that are (by coincidence) also called `palatino`; one of each of the four basic styles rm, ss, tt, and mm. These typefaces are then usable as arguments to {{cmd|setupbodyfont}} or {{cmd|switchtobodyfont}}
rm, ss, tt, and mm.
 
  
 
== See also ==
 
== See also ==

Latest revision as of 12:05, 3 July 2020

\definetypeface

Syntax (autogenerated)

\definetypeface[...][...][...][...][...][...=...,...]
[...]name
[...]rm ss tt mm hw cg
[...]serif sans mono math handwriting calligraphy
[...]name
[...]default dtp
rscaleauto number
featuresname
fallbacksname
goodiesname
designsizeauto default
directionboth


Description

\definetypeface sets up a typeface for use within a typescript. This typeface links a style (rm, ss, etc.) to an actual font family (or font set).

The first argument specifies the typescript of which the newly defined typeface will be a part.

The second argument tells which style to define a typeface for.

The third and fourth arguments to \definetypeface are pointers to already declared font sets; these are defined elsewhere. Table 5.8 gives the full list of predefined typescripts (the first argument of \starttypescript) and font sets that are attached to the styles (the third and fourth argument of each \definetypeface). The names in the third argument (like serif and sans) do not have the same meaning as the names used in \setupbodyfont. Inside \setupbodyfont, they were keywords that were in- ternally remapped to one of the two-letter internal styles. Inside \definetypeface, they are nothing more than convenience names that are attached to a group of fonts by the person that wrote the font definition. They only reflect a grouping that the person believed that could be a single font style. Oftentimes, these names are identical to the official style keywords, just as the typescript and typeface names are often the same, but there can be (and sometimes are) different names altogether.

How to define your own font sets is explained in the reference manual, but there are quite a few predefined font sets that come with ConTEXt; these are all listed in the four tables 5.9, 5.10, 5.11, and 5.12. For everything to work properly in MkII, the predefined font sets also have to have an encoding attached, you can look those up in the relevant tables as well.

The fifth argument to \definetypeface specifies specific font size setups (if any), these will be covered in the reference manual. Almost always, specifying default will suffice.

The optional sixth argument is used for tweaking font settings like the specification of font features or adjusting parameters. In this case, the two modern font sets are loaded with a small magnification, this evens out the visual heights of the font styles.

Example

\starttypescript [palatino]
 \definetypeface[palatino] [rm] [serif][palatino] [default]
 \definetypeface[palatino] [ss] [sans] [modern] [default] [rscale=1.075]
 \definetypeface[palatino] [tt] [mono] [modern] [default] [rscale=1.075]
 \definetypeface[palatino] [mm] [math] [palatino] [default]
\stoptypescript

This defines a typescript named palatino. When this typescript is executed via \usetypescript, it will define four typefaces that are (by coincidence) also called palatino; one of each of the four basic styles rm, ss, tt, and mm. These typefaces are then usable as arguments to \setupbodyfont or \switchtobodyfont

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: