Prev Up Top Next Contents

7.3 Fonts

This section is taken from the wiki [thwiki 12]: it contains the procedure to replace the font sizes. It is expected that in the future one can redefine the fonts. Right now one can include some MetaPost code, that redefines the font_setup, in the layout. The standard code is roughly as follows:
  code metapost
  def fonts_setup (expr t,s,m,l,h) =
    write "\def\updown#1#2{\vbox{" &
        "\offinterlineskip" &
        "\setbox100=\hbox{#1}" &
        "\setbox101=\hbox{#2}" &
        "\ifnum\wd100>\wd101\hsize=\wd100\else\hsize=\wd101\fi" &
        "\centerline{\box100}\vskip4pt" &
        "\centerline{\box101}}}" &
        "\def\thlabel{\thnormalsize}" &
        "\def\thremark{\thsmallsize\si}" &
        "\def\thaltitude{\thsmallsize}" &
        "\def\thstationname{\thsmallsize}" &
        "\def\thdate{\thsmallsize}" &
        "\def\thheight{\thsmallsize}" &
        "\def\thheightpos{\thsmallsize+\ignorespaces}" &
        "\def\thheightneg{\thsmallsize-\ignorespaces}" &
        "\def\thframed{\thsmallsize}" &
        "\def\thwallaltitude{\thtinysize}"
    to "mptexpre.tex";
    write "\def\thtinysize{\size[" & decimal max(optical_zoom*t,0) & "]}" &
        "\def\thsmallsize{\size[" & decimal max(optical_zoom*s,0) & "]}" &
        "\def\thnormalsize{\size[" & decimal max(optical_zoom*m,0) & "]}" &
        "\def\thlargesize{\size[" & decimal max(optical_zoom*l,0) & "]}" &
        "\def\thhugesize{\size[" & decimal max(optical_zoom*h,0) & "]}"
    to "mptexpre.tex";
    write EOF to "mptexpre.tex";
  enddef;
  initialize(Scale);
  endcode
To change one size you need to include a command specifing the size before the line "write EOF". For example,
    write "\def\thstationname{\size[4]}" to "mptexpre.tex";
As a matter of fact the "point" command of type "label" is followed by an argument that specifies the size of the text. Therefore to change the labels textsize you must consume the default scale and insert the new size, as in this example,
  code metapost
    def fonts_setup (expr t,s,m,l,h) =
      write "\def\thlabel#1{\size[32]}" to "mptexpre.tex";
      write "\def\threport#1{\size[16]}" to "mptexpre.tex";
      write EOF to "mptexpre.tex";
    enddef;
    initialize(Scale);
  endcode
This code redefines also the point of type "report", otherwise MetaPost raises an error when it is used.
Furthermore (rephrasing S. Mudrak):
In the future changing fonts sizes and styles should be simpler, and there should be some examples in The Therion Book. At least the choice of the color should be implemented sometime soon.

At the moment there is the "code metapost" option "fonts_setup" that allows to define the five basic font sizes, from the smallest (tiny) to the largest (huge). The points of type "label" use the third size (medium); the points of type "remark" use the second size (small). The definition of the "fonts_setup" command is in the file thmpost.cxx.
   code metapost
     \fonts_setup( 12, 16, 32, 64, 96 );
   endcode

7.3.1 Fonts ...

The fonts used by therion can be specified in the initialization file /etc/therion.ini. They are listed on lines begining with the keyword "tex-fonts". The syntax is /center tex-fonts encoding roman italic bold sansserif sansserifoblique //
During initialization therion loads the two fonts: cm (computer modern fonts) and cs (central european TeX fonts). This is done in thtexfonts.cxx::init_encodings(). The cs fonts are used to correctly display certain latin-2 characters. If they are not loaded, therion displays those characters using accents. If you do not need cs fonts you can comment out the relative line(s) of code.
By default Therion needs cyrillic (cmrss10) and czechslovak (csss10) fonts. They are installed with their respective texlive-lang- packages.
It is possible to use new fonts with unicode support (truetype and opentype). Just edit the therion.ini file and add the lines:
otf2pfb off
pdf-fonts <rm> <it> <bf> <ss> <si>  # paths to fonts in five styles
The pdf-fonts command has to be followed by paths specifying where regular, italic, bold, sans-serif and sans-serif oblique fonts are located in your system. TrueType and OpenType fonts are supported. Therion requires LCDF Typetools to be installed on your system to use this command (LCDF Typetools are included in the Windows installer). Example:
pdf-fonts "/usr/share/fonts/Serif.ttf" \\
  "/usr/share/fonts/Serif-Italic.ttf" \\
  "/usr/share/fonts/Serif-Bold.ttf" \\
  "/usr/share/fonts/Sans.ttf" \\
  "/usr/share/fonts/Sans-Oblique.ttf"

therion users - Fri Mar 5 15:55:42 2010
Prev Up Top Next Contents

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.