[NTG-context] Minimal example for Cyrillic

mathew meta at pobox.com
Thu Mar 31 16:44:43 CEST 2011


Here's a full working Cyrillic (and Greek) example, with comments:

%&context
%
% Example of Cyrillic in ConTeXt.
%
% For plain text, I'm using Gentium Plus, which has more glyphs but doesn't yet
% have bold and italic variants.
%
% You can obtain Gentium Plus from http://scripts.sil.org/gentium
%
\starttypescript [serif][gentium][name]
  \definefontsynonym [Serif]        	  [name:gentiumplus]
  \definefontsynonym [SerifBold]		    [name:gentiumbasicbold]
  \definefontsynonym [SerifItalic]      [name:gentiumbasicitalic]
  \definefontsynonym [SerifSlanted]     [name:gentiumplus]
  \definefontsynonym [SerifBoldItalic]  [name:gentiumbasicbolditalic]
  \definefontsynonym [SerifBoldSlanted] [name:gentiumbasicbold]
  \definefontsynonym [SerifCaps]        [name:gentiumplus]
\stoptypescript

% Now define a typescript which groups together the three chosen fonts, and
% sets their relative sizes.
% Two arguments: 'myfonts' is the name, 'default' is the character encoding.
\starttypescript [myfonts][default]
    % For each typeface definition:
    % - The first parameter is the name for the typeface collection, which
    %   may be a font family, or just a set of fonts that work well together.
    %   Whatever the case, it's the name we'll use to select this set of
    %   fonts later.
    % - The next parameter is a basic style; typically we'll have one line
    %   for each basic style, but I'm skipping mm (math mode) in this example.
    % - Then there are three arguments which are used to locate a typescript
    %   defined earlier. Note that [default] matches our earlier definitions
    %   because they were all implicitly in the default text encoding.
    % - Finally, any options, most commonly adjustments to relative scaling
    %   so the fonts work together.
    \definetypeface [nicefonts][rm][serif][gentium] [default]
\stoptypescript

% Now tell ConTeXt to actually execute the typescript we defined immediately
% above, and hence any typescripts it depends on.
%
% This executes the \definetypeface calls to define our typeface set.  Again,
% myfonts is the name of the typescript, default is the character encoding.
\usetypescript[myfonts][default]

% Finally, use that typeface set, at 10pt base size.
% Calling setupbodyfont changes headers and footers as well as body text;
% switchtobodyfont just changes body text.
\setupbodyfont[nicefonts,10pt]

% And finally, the actual document
\starttext

Улице найденных совершенно на тд. Можно статьи команды он без. Одну филипа
обычно по вот. Мои статьи человек процессе те, могу фирме всё он, ну над никто
размере русском. Опа до раздавая правильно, нейманом содержимое об над. Те
взяться плохого код, свой осуществлять все не.

Here's some Greek too:

Αν σωστά νόμιζες της, έτσι γραμμής βασανίζουν να πως, κι εκτός μάλλον όσο.
Πετούν παραγωγικής οι σας, έξι τελικά κάνεις σε. Μέρος υπέροχα τελειώσει όρο
δε. Δε νέο πάτο διακοπή, επί αφού κειμένων αποφάσισε πω. Τέτοιο βασανίζουν από
ως. Σας σχεδιαστής χρησιμοποιήσει τι, γέλασαν διάσημα δημιουργείς το που.

\showbodyfont[gentium]

\stoptext


mathew
-- 
http://www.pobox.com/~meta/


More information about the ntg-context mailing list