Changes

Jump to navigation Jump to search
m
no edit summary
A typical use of Unicode blocks is in the definition of '''fallback''' fonts to provide glyphs for certain characters. Sometimes, when writing a document in ConTeXt, one needs to typeset special symbols that are not available in the base font of the document. In such a situation, one can specify a fallback font to provide these missing symbols.
For example, in the following document, the base font [[TeX Gyre- Old Content|TeX Gyre Pagella]] does not have the glyphs for Cyrillic characters, whose code points are in the Unicode block {{code|Cyrillic}}. The document uses the {{cmd|definefallbackfamily}} command to get the glyphs for this block from the {{code|DejaVu Serif}} font. The ConTeXt name of the block is supplied as the value of the key {{code|range}} in the last setup of the command.
<context source=yes text="Here is an image showing the relevant part of the PDF file obtained by running context on a file containing this document:">
A different application of fallback fonts arises when one wants to replace the existing glyphs for some characters in the base font with glyphs for those characters from another font. This situation is different from the one in the previous example. There, the base font did not contain glyphs for the characters of interest, and the fallback font provided the missing glyphs. Here, the base font does contain glyphs for the characters in question, but, perhaps due to aesthetic reaosons, the author of the document, wants to replace those glyphs with glyphs from another font. In such a case, the latter font can be specified as a fallback font.
For example, the following document uses the [[TeX Gyre- Old Content|{{code|pagella}}]] typescript to provide the base font, and uses the {{code|STIX General Regular}} font for mathematical script letters, which lie in the Unicode block {{code|Mathematical Alphanumeric Symbols}}. Instead of {{cmd|definefallbackfamily}} which was used in the previous example, this document uses the command {{cmd|definefontfallback}}. The ConTeXt name of the block is supplied as the third setup of this command. The last setup {{code|1=force=yes}} ensures that the glyphs of the relevant characters are replaced from the fallback font, overriding the glyphs that may exist in the base font for these characters.
<texcode>
<references/>
 
[[Category:Fonts]]
[[Category:Languages]]

Navigation menu