home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD v1.2 / amidev_cd_12.iso / reference / amiga_mail_vol1 / gfx / extextfont < prev    next >
Text File  |  1990-01-26  |  7KB  |  161 lines

  1. (c)  Copyright 1989 Commodore-Amiga, Inc.   All rights reserved.
  2. The information contained herein is subject to change without notice, and 
  3. is provided "as is" without warranty of any kind, either expressed or implied.  
  4. The entire risk as to the use of this information is assumed by the user.
  5.  
  6.  
  7.  
  8.                      Extended Text Fonts
  9.  
  10.                        by Andy Finkel
  11.  
  12.  
  13. One of the Amiga's strengths is its use of colors.  However, under the
  14. current OS, the use of colors with text is not well supported.  This
  15. will change in a future release of the ROM kernel when the Amiga adopts
  16. the ColorText format for multi-bitplane font definitions designed by
  17. InterActive Softworks.  On the Amiga, the new text structure will be 
  18. called an ExtendedTextFont.
  19.  
  20. The ExtendedTextFont structure is a logical way to extend the TextFont 
  21. structure to multiple bitplanes, while retaining compatibility with current
  22. software.  The ExtendedTextFont structure allows a program to use up to 
  23. thirty-two colors in a normal working environment.  This structure can be 
  24. used by any programs that need additional colors and shadings for text.
  25. Use of the ExtendedTextFont to add colors can really improve the appearance
  26. of a program.  However, there is a speed penalty for the additional 
  27. bitplanes (if you use more than 2). 
  28.  
  29. To make a color text font, you can use the Font Editor or Calligrapher 
  30. programs from InterActive Softworks.  These color fonts can then be used
  31. in your applications by calling a special replacement module for the Amiga's
  32. Text() routine provided by InterActive.   This replacement routine will be 
  33. incorporated into the Amiga in a future revision of the ROM set.  For more 
  34. information on the color text routines, contact: InterActive Softworks, 57 
  35. Post St., #811, San Francisco, CA 94104, (415) 956-2660.  They  are also on 
  36. BIX (address: arcade).
  37.  
  38.  
  39. The new ExtendedTextFont structure is shown below.  Notice that the first
  40. member in the structure is the old TextFont structure:
  41.  
  42.  
  43.      struct ExtendedTextFont =
  44.  
  45.      {
  46.       struct TextFont ctf_TF;     /* Text Font Structure     */
  47.                  /* TextFont is in "Amiga Rom Kernal 
  48.                                      Manual, Vol. 2,p. D-41 */
  49.  
  50.      USHORT ctf_Flags;      /* ExtendedTextFont preferences and flags */
  51.  
  52.      UBYTE ctf_Depth;          /* Number of BitPlanes   */
  53.  
  54.      UBYTE ctf_FgColor;       /* Color that is remapped to FgPen   */ 
  55.      
  56.      UBYTE ctf_Low;         /* Lowest Color in ExtendedTextFont  */
  57.      UBYTE ctf_High;         /* Highest Color in ExtendedTextFont */
  58.  
  59.      UBYTE ctf_PlanePick;     /* PlanePick as described by Images */
  60.      UBYTE ctf_PlaneOnOff;     /* PlaneOnOff as described by Images */  
  61.  
  62.      APTR ctf_ColorMap;      /* Pointer to ColorMap for font */
  63.                 /* ColorMap is in "Amiga Rom Kernal 
  64.                                      Manual, Vol. 2, p. D-42 */
  65.  
  66.      APTR ctf_CharData [8];      /* Pointers to BitPlane Data  */
  67.     };
  68.  
  69.  
  70.  
  71.  
  72.  
  73. The ExtendedTextFont Structure
  74.  
  75. The struct TextFont ctf_TF contains all the basic information about the 
  76. font.  The tf_CharData pointer in ctf_TF should point to the first plane of 
  77. CharData in the ExtendedTextFont.  By doing this, the system will be able to 
  78. handle the font even if the Text() routines have not been modified to work
  79. with an ExtendedTextFont.
  80.  
  81. The field, USHORT ctf_Flags, contains flags that tell what kind of an
  82. ExtendedTextFont this is.  Current flags supported are: 
  83.  
  84.    CTF_COLORFONT  0x0001; /* ExtendedTextFont (Contains Color) */  
  85.    CTF_GREYFONT   0x0002; /* ExtendedTextFont (Contains grey scale) */
  86.    CTF_NORMALFONT 0x8000; /* Normal TextFont (Should not be needed) */
  87.  
  88. UBYTE ctf_Depth, gives the number of bitplanes in the ExtendedTextFont.  This
  89. should always be greater than one since no ExtendedTextFont should ever 
  90. contain just one bitplane - such a font could be more easily described by the 
  91. old TextFont structure.
  92.  
  93. The field, UBYTE ctf_FgColor, contains the color that will be dynamically 
  94. remapped during output by changing ctf_FgColor to RastPort->FgPen.  This field
  95. allows an ExtendedTextFont to contain color outlines, shadows, etc. while also
  96. containing a predominant color that can be changed by the user in any given 
  97. program through the standard user palette interface.  If the font does not 
  98. have a predominant color, set ctf_FgColor equal to 0xFF.
  99.  
  100. For example, given an ExtendedTextFont that has a blue and red outline and a
  101. white center, the person designing the font can set ctf_FgColor equal to white.
  102. Then when the font is used in DPaint, the white will be changed to whatever the
  103. current foreground color is set to. 
  104.  
  105. The fields, UBYTE ctf_Low and ctf_High, contain the lowest and highest color 
  106. values in the ExtendedTextFont.  For example, a 4 bitplane color font can have
  107. sixteen colors, but the font may use only nine of those colors.  Thus Low=0 
  108. and High=8 .  
  109.  
  110. The most important use of these colors is for defining the boundaries of a 
  111. grey scale font.  If the font uses less than the total number of colors 
  112. allowed, but needs white as the lowest and black as the highest level of 
  113. grey, then the boundaries would have to be defined in order for the font to 
  114. be rendered correctly.  Defaults for these values should be the lowest and 
  115. the highest values for the given number of bitplanes.  
  116.  
  117. # of BitPlanes       Default Low         Default High
  118. --------------       -----------         ------------
  119.      1                   0                   1
  120.      2                   0                   3
  121.      3                   0                   7
  122.      4                   0                   15
  123.      5                   0                   31
  124.  
  125. The members UBYTE ctf_PlanePick and ctf_PlaneOnOff contain information 
  126. for saving space in memory for some types of ExtendedTextFont structures.  
  127. The field UBYTE ctf_PlanePick contains information about where each plane 
  128. of data will be rendered in a given BitMap.  UBYTE ctf_PlaneOnOff contains 
  129. information about planes that are not used to render a plane of font data.  
  130. If ctf_PlaneOnOff contains a 0 bit for a given plane, the plane is cleared. 
  131. If ctf_PlaneOnOff contains a 1 bit for a given plane, the plane is filled.  
  132. Much more information can be found in the Intuition Reference Manual under 
  133. Images and in the ROM Kernal Manual under GELs.
  134.  
  135. The APTR ctf_ColorMap field contains information about colors used by font.
  136. Size of ColorTable is determined by ctf_ColorMap->Count. The ColorMap 
  137. structure is the same as the structure found in graphics/view.h
  138.  
  139. The last item in the ExtendedTextFont structure is the array 
  140. APTR ctf_CharData[8] which contains pointers to each of the BitPlanes of 
  141. ColorFont data.  With eight bitplanes, up to 256 colors are supported. 
  142. Since ctf_CharData is the last variable in the structure, the 
  143. ExtendedTextFont can be expanded easily to handle more than eight 
  144. bitplanes of data.   
  145.  
  146.  
  147.  
  148. How to Recognize an ExtendedTextFont
  149.  
  150. A special bit has been set aside in the TextFont structure in order to 
  151. identify it as ExtendedText.  The bit is 0x40 in the field TextFont->tf_Style.
  152. Thus, in order to recognize ExtendedText, test ( TextFont->tf_Style & 0x40 ) 
  153. for a non-zero result.  The relevant defines are:
  154.  
  155. #define FSB_COLORFONT 6
  156. #define FSF_COLORFONT (1<<6)
  157.  
  158.  
  159.  
  160.  
  161.