•  Back 
  •  The extended xFSL call 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help page 
  •  Show info about hypertext 
  •  View a new file 
Topic       : TOS - The Operating System
Author      : 
Version     : tos.hyp (December 19, 2008)
Subject     : Programmieren/Atari
Nodes       : 3010
Index Size  : 93790
HCP-Version : 5
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Title
@help       : 
@options    : +g -i -s +x +zz -t4
@width      : 70
View Ref-File13.14.1.3.8  The PFONTINFO structure                               TOS

This structure describes a font. After calling the font-selector it 
contains the selected font. In addition these specifications are 
evaluated by the font-selector already at the call (and the described 
font displayed), if a zero is passed as the VDI handle.

     typedef struct
     {
      int          fontid;     /* ID of the font               */
      int          fonttype;   /* Type of font                 */
      char        *fontname;   /* Name of the font             */
      union fsize  fontsize;   /* Font size in pt or fix31     */
      union fsize  fontwidth;  /* Width in pt or fix31         */
      char         trackkern;  /* Track kerning                */
      char         pairkern;   /* Pair kerning                 */
      int          fontattr;   /* Attributes                   */
      int          fontskew;   /* Skew                         */
      int          fontcol;    /* Colour                       */
      int          backcol;    /* Text background colour       */
      int          halign;     /* Horizontal text alignment    */
      int          valign;     /* Vertical text alignment      */
      int          rotation;   /* Text rotation in 1/10 degree */
      int          validtype;  /* Type (V_CHAR_...) or mapping */
      int         *validchars; /* Valid characters, or  0L     */
     } PFONTINFO;

The elements in detail:

 fontid      The ID of the font, as also returned by the VDI function 
             vqt_name. The font ID is a non-zero number (so can also 
             be negative).

 fonttype    The type of font, as used as of Speedo 5 or NVDI 3:

                   Name         Value   Font type 
                   BITMAP_FONT  0x0001  Pixel 
                   SPEEDO_FONT  0x0002  Speedo 
                   TT_FONT      0x0004  TrueType 
                   PFB_FONT     0x0008  Type-1 (Postscript) 

             These specification are currenly for information only, 
             having no meaning for the font-selector. However, in the 
             future it will be possible to set a font not just by its 
             ID but also by its name, in which case the font type will 
             be required as well.

             The font type is also of interest when one wants to alter 
             the size of the font: With bitmap fonts this is done with 
             the VDI function vst_point, for all other types (vector 
             fonts) with the function vst_arbpt.

 fontname    The name of the font, as returned by vqt_name (possibly 
             one or more space characters were removed).

             The caller itself must make enough space available for 
             the font name, thus for 32 characters and a NULL-byte! If 
             you do not require the font name, then you can also 
             simply set the pointer to zero.

 fontsize    The size of the font in points (pt) or 1/65536 point 
             (type 'fix31'):

                  union fsize
                  {
                   int   size;    /* Font size in points        */
                   fix31 size31;  /* Font size in 1/65536 point */
                  };

             Which of these two statements is valid is controlled 
             globally with the control-flag CC_FIX31.

 fontwidth   Width of the font in points (pt) or 1/65536 point (type 
             (type 'fix31'):

                  union fsize
                  {
                   int   size;    /* Font size in points        */
                   fix31 size31;  /* Font size in 1/65536 point */
                  };

             Which of these two statements is valid is controlled 
             globally with the control-flag CC_FIX31.

             The width can be set with the VDI functions vst_width in 
             points and with vst_setsize in fix31.

 trackkern   This parameter specifies the type of track kerning for 
             vst_kern. Valid values are:

              Value  Kerning 
                0    No kerning 
                1    Normal kerning 
                2    Tight kerning 
                3    Very tight kerning 

 pairkern    With this parameter pair kerning can be switched on (0) 
             or off (1), see vst_kern.

 fontattr    These are the font attributes (text effects), as also 
             used by the VDI function vst_effects.

             Calvino only uses this field if the CC_FAKESTYLE 
             control-flag is set.

 fontskew    The slope or skew of the font in 1/10 degree, see 
             vst_skew.

 fontcol     The colour of the font. The VDI colours are used, i.e. 0 
             = White, 1 = Black, etc. See vst_color.

 backcol     The background colour to the text. The VDI colours are 
             used, i.e. 0 = White, 1 = Black etc. The setting of a 
             text background colour is not supported directly by the 
             VDI, so it is up to the caller whether and how this 
             parameter is used.

 halign      With this one can specify the horizontal alignment of the 
             text: The text is to be output ranged left, ranged right 
             or centred.

              Name        Value  Alignment 
              THA_LEFT    0      Ranged left 
              THA_CENTER  1      Centred 
              THA_RIGHT   2      Ranged right 

             These values correspond to the parameter for horizontal 
             alignment for the VDI call vst_alignment.

 valign      With this one can specify the vertical aligment of the 
             text: The text is to be output aligned to the top line or 
             the bottom line, or (vertically) centred.

              Name        Value  Alignment 
              TVA_BOTTOM  0      At the text bottom line 
              TVA_CENTER  1      Vertically centred 
              TVA_TOP     2      At the text top line 

             These values deliberately do not correspond to the 
             parameter for vertical alignment with vst_alignment! 
             Values used there ('Base line', 'Character cell bottom 
             line') are hardly intuitive for the normal user and hence 
             should not form part of the user interface (which they 
             would be however for selections in the font-selector). 
             The alignment therefore must be converted by the calling 
             program to the 'correct' values.

 rotation    Text rotation in 1/10 degrees, as also used in the VDI 
             function vst_rotation.


Still missing are the two parameters validtype and validchars:

Sometimes it is important to ensure that the font contains certain 
characters. There are two possibilities for this:

If validchars is zero, one can select with validtype one of the 
following four groups of characters:

 Name        Value   Range  Comment 
 V_CHAR_IND  -1          -  'Doesn't matter' 
 V_CHAR_ASC  -2     32-126  All printable ASCII characters 
 V_CHAR_PRT  -3     32-255  All printable characters 
 V_CHAR_ALL  -4      0-255  Really all characters 

These four groups ought to cover the most common applications.

If both validtype and validchars are zero, then the font-selector will 
treat this as V_CHAR_IND; the same for othr invalid values in 
validtype.


Should the four groups not suffice at times, then one can instead also 
specify more precisely with validtype and validchars which characters 
are required:

 validtype then contains a value for the character mapping to be used 
     by GDOS (see vst_charmap and What's mapping?).

     A free choice of mapping is only available with an appropriate 
     GDOS (SpeedoGDOS or NVDI from Version 3 onwards). At present the 
     following mappings are defined:

      Name        Value  Meaning 
      MAP_DIRECT  0      Direct mapping 
      MAP_ASCII   1      ASCII mapping (default) 

     If the GDOS does not support mapping, then the font-selector will 
     only accept MAP_ASCII; in that case all other mappings will be 
     ignored and a test for the presence of given characters will not 
     be performed.

 validchars is a pointer to an array of integers (WORDs), with which 
     one can specify which characters the font has to contain.

     The array consists of a series of from-to pairs:

        . Two values following each other specify a range (from-to)

        . Individual characters are specified by doubling up

        . The end of the list is specified by a from-to pair in which 
          the 'to' is smaller than the 'from'

     Example: Only those fonts should be offered for selection that 
     contain all printable ASCII characters as well as the German 
     Umlauts:

     xFSL_PAR xpar;
     int chars[] = { ' ', '~',  /* ASCII 32..126 */
                     'ä','ä', 'ö','ö', 'ü','ü',
                     'Ä','Ä', 'Ö','Ö', 'Ü','Ü', 'ß','ß',
                     1,0       /* Ende der Liste */
                   };
 
     xpar.font->validtype=MAP_ASCII;
     xpar.font->validchars=chars;

Future GDOSes will probably support further mappings (BICS, Unicode, 
...). Thanks to the coding used, the font-selector will also handle 
these correctly: The mapping is simply passed in validtype and then 
the presence of a character tested with validchars.

Note: The various possibilities available with the validtype and 
validchars parameters should be used sparingly and with some thought, 
as the required testing of the characters may - depending on the GDOS 
- take quite a lot of time.