Changes

Jump to navigation Jump to search
= Quick use of a new font =
= Using a newly downloaded font = == Quickly use one of the styles (3 steps, 1 min.) == Let's take a example, we want to use [https://fonts.google.com/specimen/Noto+Serif Noto Serif]. The google website enable us to download a zip file with the 4 alternative styles:* variations (Regular 400* , Regular 400 italic* , Bold 700* , Bold 700 italic).
; #1. Store them is a dedicated folder
</texcode>
; #3. Your are done! You can use the font anywhere on in your input files.:* Use the commands with {{cmd|definedfont}}
<texcode>
\definedfont[file:NotoSerif-BoldItalic at 12pt]
[[File:result_of_test_with_noto-serif_one.png]]
== Use all of the styles (different font variations = * It's not nice to have to write \definedfont[file:YourSuperFont-WeightStyle at xxpt] each time you want to use a particular font. * That why it's worth defining a '''typescript'''. It's just 3 steps, 1 minand less than 5 minutes.Then, you will be able to easily switch between fonts with {{cmd|tf}}, {{cmd|it}}, {{cmd|bf}}, {{cmd|bi}} (see [[Font_Switching#Font_styles_and_alternatives]]) ==, and all the typesetting of your document will use a consistent set of fonts.* [[typescripts| Many typescripts are ready for use on usual free and commercial fonts]].
  ; #1. Define them as a new typescript (ConTeXt vocabulary) in your input file.:* Use the commands , with {{cmd|starttypescript}} .:* Define the links between ''filenames'' and ''People-readable names'' with {{cmd|definefontsynonym}} to declare.:* In this example, the typescript is called "mynotoserif".
<texcode>
\starttypescript [serifmynotoserif] % \definefontsynonym[notoserifHuman readable] [file:filename without extension] \definefontsynonym[NotoSerif-Regular] [file:NotoSerif-Regular] \definefontsynonym[NotoSerif-Italic] [file:NotoSerif-Italic] \definefontsynonym[NotoSerif-Bold] [file:NotoSerif-Bold] \definefontsynonym[NotoSerif-BoldItalic] [file:NotoSerif-BoldItalic]
\stoptypescript
</texcode>
; #2. Define them as part of your font familyThe boring step, here as define the links between ''ConTeXt basics names'' and the ''People-readable names''.:* It's good to add a romanfallback.
<texcode>
\definefontfamily starttypescript [MyFontIdentifiermynotoserif] \setups[font:fallback:serif] % security: if not found==> bask to defaults% \definefontsynonym[ConTeXt bascics name] [Human readable] [features=default] \definefontsynonym[Serif] [NotoSerif-Regular] [features=default] \definefontsynonym[SerifItalic] [NotoSerif-Italic] [features=default] \definefontsynonym[SerifBold] [NotoSerif-Bold] [features=default] \definefontsynonym[SerifBoldItalic] [NotoSerif-BoldItalic] [features=default]\stoptypescript</texcode> ; #3. Define the pack of the 4 variations as the roman typeface of the typescript "mynotoserif" :<texcode>\starttypescript [mynotoserif] \definetypeface [mynotoserif] [rm] [notoserifserif] [mynotoserif] [default]\stoptypescript
</texcode>
<texcode>
\starttypescript [serif] [notoserifmynotoserif] \definefontsynonym[NotoSerif-Regular] [file:NotoSerif-Regular] \definefontsynonym[NotoSerif-Italic] [file:NotoSerif-Italic] \definefontsynonym[NotoSerif-Bold] [file:NotoSerif-Bold] \definefontsynonym[NotoSerif-BoldItalic] [file:NotoSerif-BoldItalic]\stoptypescript \starttypescript [mynotoserif] \setups[font:fallback:serif] \definefontsynonym[Serif] [NotoSerif-Regular] [features=default] \definefontsynonym[SerifItalic] [NotoSerif-Italic] [features=default] \definefontsynonym[SerifBold] [NotoSerif-Bold] [features=default] \definefontsynonym[SerifBoldItalic] [NotoSerif-BoldItalic] [features=default]
\stoptypescript
\definefontfamily starttypescript [MyFontIdentifiermynotoserif] \definetypeface [mynotoserif] [rm] [notoserifserif] [mynotoserif] [default]\stoptypescript
\setupbodyfont[MyFontIdentifiermynotoserif]
\setupbodyfont[12pt]
{\rm The quick brown fox jumps over the lazy dog}\\{\rmit The quick brown fox jumps over the lazy dog}\\{\bf The quick brown fox jumps over the lazy dog}\\{\rm\it bi The quick brown fox jumps over the lazy dog}\\
</texcode>

Navigation menu