Difference between revisions of "Command/definefont"

From Wiki
Jump to navigation Jump to search
(Create reference page)
 
 
(19 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<!-- please remove this and the following line if you have checked this page -->
 
{{Reference_Cleanup}}
 
 
{{Reference
 
{{Reference
 
|name=definefont
 
|name=definefont
Line 6: Line 4:
 
}}
 
}}
  
== [[Help:Reference|Syntax]] ==
+
== [[Help:Reference|Syntax]] (autogenerated) ==
<table cellspacing="4" cellpadding="2" class="cmd">
+
<syntax>definefont</syntax>
  <tr>
 
    <td colspan="2" class="cmd">\definefont<span class="first" >[...]</span><span class="second" >[...]</span></td>
 
  </tr>
 
  <tr valign="top" class="first">
 
    <td class="cmd">[...]</td>
 
    <td>name </td>
 
  </tr>
 
  <tr valign="top" class="second">
 
    <td class="cmd">[...]</td>
 
    <td>file </td>
 
  </tr>
 
</table>
 
  
  
 
== Description ==  
 
== Description ==  
 +
This macro defines a font with the same name as the first argument and you can use its name as an identifier to select that font.
  
 +
The second argument works in the same way as the second argument to \definefontsynonym: you can use either a font synonym or a real font.
  
 +
There is an optional third argument that can be either a bare number like 1.5 or a named setup.
 +
In case of a bare number, that is a local setting for the interline space. In case of a setup, that setup can do whatever it wants.
  
 
== Example ==
 
== Example ==
<!-- Please fill in an example if you can -->
+
=== Example 1 ===
 +
<texcode>
 +
\loadmapfile [koeieletters]
 +
\definefont [ContextLogo] [koeielogos at 72pt]
 +
\ContextLogo \char 2
 +
</texcode>
 +
 
 +
=== Example 2 ===
 +
Newer LMTX example. Use this when you want a font for a short piece of text on a title page, for example, rather than throughout the document.
 +
<texcode>
 +
\definefont [TestA] [name:texgyreheros*default at 12pt]
 +
\definefont [TestB] [name:texgyreherosbold*default at 14pt]
 +
\definefont [TestC] [name:texgyreherositalic*default at 12pt]
 +
\definefont [TestD] [name:texgyreherosbolditalic*default at 14pt]
 +
 
 +
\starttext
 +
{\TestA The quick}
 +
{\TestB brown fox}
 +
{\TestC jumps over}
 +
{\TestD the lazy dog}
 +
\stoptext
 +
</texcode>
  
 
== See also ==
 
== See also ==
<!-- something like [[cmd:goto|\goto]] -->
+
<!-- something like {{cmd|goto}} -->
 +
* {{cmd|definedfont}}
 +
* {{cmd|definefontfamily}}
 +
 
 +
== Help from ConTeXt-Mailinglist/Forum ==
 +
All issues with:
 +
{{Forum|{{SUBPAGENAME}}}}
  
[[Category:Reference/en|definefont]]
+
[[Category:Command/Fonts|definefont]]

Latest revision as of 21:10, 25 August 2021

\definefont

Syntax (autogenerated)

\definefont[...][...][...=...,...]
[...]name
[...]font
...=...,...inherits from \setupinterlinespace


\definefont[...][...][...]
[...]name
[...]font
[...]name



Description

This macro defines a font with the same name as the first argument and you can use its name as an identifier to select that font.

The second argument works in the same way as the second argument to \definefontsynonym: you can use either a font synonym or a real font.

There is an optional third argument that can be either a bare number like 1.5 or a named setup. In case of a bare number, that is a local setting for the interline space. In case of a setup, that setup can do whatever it wants.

Example

Example 1

\loadmapfile [koeieletters]
\definefont [ContextLogo] [koeielogos at 72pt]
\ContextLogo \char 2

Example 2

Newer LMTX example. Use this when you want a font for a short piece of text on a title page, for example, rather than throughout the document.

\definefont [TestA] [name:texgyreheros*default at 12pt]
\definefont [TestB] [name:texgyreherosbold*default at 14pt]
\definefont [TestC] [name:texgyreherositalic*default at 12pt]
\definefont [TestD] [name:texgyreherosbolditalic*default at 14pt]

\starttext
{\TestA The quick}
{\TestB brown fox}
{\TestC jumps over}
{\TestD the lazy dog}
\stoptext

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: