Changes

Jump to navigation Jump to search
</texcode>
[[File:result_of_test_with_noto-serif_one.png]]
 
 
= Use of the 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, and 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.
* [[typescriptsTypescripts_examples| Many typescripts are ready for use on usual free and commercial fonts]].  
:* Define the links between ''filenames'' and ''People-readable names'' with {{cmd|definefontsynonym}}.
:* In this example, the typescript is called "mynotoserif".
:* Reminder: you find the filenames for the Noto Serif fonts with <code>mtxrun --script font --list --file -pattern=*noto*</code>:
<texcode>
</texcode>
; #34. You are done! Finally, we have the following input file:
<texcode>
[[File:result_of_test_with_noto-serif.png]]
 
= Install and use your new typescript definition =
 
You will probably want to use your new customized typescript definition across different documents, so you have to install them in the distribution. Here is the definition.
 
<texcode>
\starttypescript [mynotoserif]
\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
 
\starttypescript [mynotoserif]
\definetypeface [mynotoserif] [rm] [serif] [mynotoserif] [default]
\stoptypescript
</texcode>
 
 
# Save your file as <code>type-(fontname|foundry).tex</code>, for example here <code>type-mynotoserif.tex</code>
# Copy the typescript files into <code>tex/texmf-fonts/tex/context/user/</code>
# Run <code>context --generate</code> to update ConTeXt file database
# You are done!
#* you can add \usetypescriptfile[mynotoserif] at the beginning of any input file
#* and \setupbodyfont[mynotoserif] will declare to typeset with your new font.

Navigation menu