home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / M2V11-1.LHA / modula / amiga / Bullet.def < prev    next >
Encoding:
Text File  |  1993-11-10  |  16.1 KB  |  410 lines

  1. DEFINITION FOR LIBRARY MODULE Bullet ;
  2.  
  3. FROM SYSTEM    IMPORT STRING, ADDRESS ;
  4. FROM Utility    IMPORT TAG_USER, TagItemPtr, Tag ;
  5. FROM Exec    IMPORT MinNode, LibraryPtr ;
  6.  
  7. TYPE
  8.   GlyphEnginePtr    = POINTER TO GlyphEngine ;
  9.   GlyphMapPtr        = POINTER TO GlyphMap ;
  10.   GlyphWidthEntryPtr    = POINTER TO GlyphWidthEntry ;
  11.  
  12. (* tag definitions for .otag files *)
  13.  
  14. CONST
  15. (* Level 0 entries never appear in the .otag tag list, but appear in font *)
  16. (* specifications                              *)
  17.  
  18.   OT_Level0        = TAG_USER ;
  19.  
  20. (* Level 1 entries are required to exist in the .otag tag list *)
  21.  
  22.   OT_Level1        = TAG_USER+01000H ;
  23.  
  24. (* Level 2 entries are optional typeface metric tags    *)
  25.  
  26.   OT_Level2        = TAG_USER+02000H ;
  27.  
  28. (* Level 3 entries are required for some OT_Engines    *)
  29.  
  30.   OT_Level3        = TAG_USER+03000H ;
  31.  
  32. (* Indirect entries are at (tag address+data offset)    *)
  33.  
  34.   OT_Indirect        = 08000H ;
  35.  
  36. (*=========================================================================*)
  37. (* font specification and inquiry tags                       *)
  38.  
  39. (* !  tags flagged with an exclaimation mark are valid for           *)
  40. (*    specification.                               *)
  41. (*  ? tags flagged with a question mark are valid for inquiry           *)
  42. (*                                       *)
  43. (* fixed binary numbers are encoded as 16 bits of integer and           *)
  44. (* 16 bits of fraction.  Negative values are indicated by twos           *)
  45. (* complement of all 32 bits.                           *)
  46.  
  47. (* !  OT_DeviceDPI specifies the target device dots per inch -- X DPI is   *)
  48. (*    in the high word, Y DPI in the low word.                   *)
  49.  
  50.   OT_DeviceDPI        = OT_Level0+001H ;    (* == TA_DeviceDPI *)
  51.  
  52. (* !  OT_DotSize specifies the target device dot size as a percent of       *)
  53. (*    it's resolution-implied size -- X percent in high word, Y percent    *)
  54. (*    in low word.                               *)
  55.  
  56.   OT_DotSize        = OT_Level0+002H ;
  57.  
  58. (* !  OT_PointHeight specifies the requested point height of a typeface,   *)
  59. (*    specifically, the height and nominal width of the em-square.       *)
  60. (*    The point referred to here is 1/72".  It is encoded as a fixed       *)
  61. (*    binary number.                               *)
  62.  
  63.   OT_PointHeight    = OT_Level0+008H ;
  64.  
  65. (* !  OT_SetFactor specifies the requested set width of a typeface.       *)
  66. (*    It distorts the width of the em-square from that specified by       *)
  67. (*    OT_PointHeight.  To compensate for a device with different       *)
  68. (*    horizontal and vertical resolutions, OT_DeviceDPI should be used       *)
  69. (*    instead.    For a normal aspect ratio, set to 1.0 (encoded as       *)
  70. (*    000010000H).  This is the default value.                   *)
  71.  
  72.   OT_SetFactor        = OT_Level0+009H ;
  73.  
  74. (* !  OT_Shear... specifies the Sine and Cosine of the vertical stroke       *)
  75. (*    angle, as two fixed point binary fractions.  Both must be specified: *)
  76. (*    first the Sine and then the Cosine.  Setting the sine component       *)
  77. (*    changes the Shear to an undefined value, setting the cosine       *)
  78. (*    component completes the Shear change to the new composite value.       *)
  79. (*    For no shear, set to 0.0, 1.0 (encoded as 000000000H, 000010000H).   *)
  80. (*    This is the default value.                       *)
  81.  
  82.   OT_ShearSin        = OT_Level0+00AH ;
  83.   OT_ShearCos        = OT_Level0+00BH ;
  84.  
  85. (* !  OT_Rotate... specifies the Sine and Cosine of the baselin rotation   *)
  86. (*    angle, as two fixed point binary fractions.  Both must be specified: *)
  87. (*    first the Sine and then the Cosine.  Setting the sine component       *)
  88. (*    changes the Shear to an undefined value, setting the cosine       *)
  89. (*    component completes the Shear change to the new composite value.       *)
  90. (*    For no shear, set to 0.0, 1.0 (encoded as 000000000H, 000010000H).   *)
  91. (*    This is the default value.                       *)
  92.  
  93.   OT_RotateSin        = OT_Level0+00CH ;
  94.   OT_RotateCos        = OT_Level0+00DH ;
  95.  
  96. (* !  OT_Embolden... specifies values to algorithimically embolden -- or,  *)
  97. (*    when negative, lighten -- the glyph.  It is encoded as a fixed point *)
  98. (*    binary fraction of the em-square.  The X and Y components can be       *)
  99. (*    changed indendently.  For normal characters, set to 0.0, 0.0       *)
  100. (*    (encoded as 000000000H, 000000000H).  This is the default value.       *)
  101.  
  102.   OT_EmboldenX        = OT_Level0+00EH ;
  103.   OT_EmboldenY        = OT_Level0+00FH ;
  104.  
  105. (* !  OT_PointSize is an old method of specifying the point size,       *)
  106. (*    encoded as (points * 16).                           *)
  107.  
  108.   OT_PointSize        = OT_Level0+010H ;
  109.  
  110. (* !  OT_GlyphCode specifies the glyph (character) code to use with       *)
  111. (*    subsequent operations.  For example, this is the code for an       *)
  112. (*    OT_Glyph inquiry                               *)
  113.  
  114.   OT_GlyphCode        = OT_Level0+011H ;
  115.  
  116. (* !  OT_GlyphCode2 specifies the second glyph code.  For example,       *)
  117. (*    this is the right glyph of the two glyphs of an OT_KernPair       *)
  118. (*    inquiry                                   *)
  119.  
  120.   OT_GlyphCode2        = OT_Level0+012H ;
  121.  
  122. (* !  OT_GlyphWidth specifies a specific width for a glyph.           *)
  123. (*    It sets a specific escapement (advance) width for subsequent       *)
  124. (*    glyphs.  It is encoded as a fixed binary fraction of the em-square.  *)
  125. (*    To revert to using the font-defined escapement for each glyph, set   *)
  126. (*    to 0.0 (encoded as 000000000H).  This is the default value.       *)
  127.  
  128.   OT_GlyphWidth        = OT_Level0+013H ;
  129.  
  130. (* !  OT_OTagPath and                               *)
  131. (* !  OT_OTagList specify the selected typeface.  Both must be specified:  *)
  132. (*    first the Path and then the List.  Setting the path name changes       *)
  133. (*    changes the typeface to an undefined value, providing the List       *)
  134. (*    completes the typeface selection to the new typeface.  OTagPath       *)
  135. (*    is the null terminated full file path of the .otag file associated   *)
  136. (*    with the typeface.  OTagList is a memory copy of the processed       *)
  137. (*    contents of that .otag file (i.e. with indirections resolved).       *)
  138. (*    There are no default values for the typeface.                *)
  139.  
  140.   OT_OTagPath        = OT_Level0+OT_Indirect+014H ;
  141.   OT_OTagList        = OT_Level0+OT_Indirect+015H ;
  142.  
  143. (*  ? OT_GlyphMap supplies a read-only struct GlyphMap pointer that       *)
  144. (*    describes a bitmap for a glyph with the current attributes.       *)
  145.  
  146.   OT_GlyphMap        = OT_Level0+OT_Indirect+020H ;
  147.  
  148. (*  ? OT_WidthList supplies a read-only struct MinList of struct       *)
  149. (*    GlyphWidthEntry nodes for glyphs that are defined from GlyphCode       *)
  150. (*    to GlyphCode2, inclusive.  The widths are represented as fixed       *)
  151. (*    binary fractions of the em-square, ignoring any effect of           *)
  152. (*    SetFactor or GlyphWidth.    A width would need to be converted to       *)
  153. (*    a distance along the baseline in device units by the           *)
  154. (*    application.                               *)
  155.  
  156.   OT_WidthList        = OT_Level0+OT_Indirect+021H ;
  157.  
  158. (*  ? OT_...KernPair supplies the kern adjustment to be added to the       *)
  159. (*    current position after placement of the GlyphCode glyph and       *)
  160. (*    before placement of the GlyphCode2 glyph.  Text kern pairs are       *)
  161. (*    for rendering body text.    Display kern pairs are generally       *)
  162. (*    tighter values for display (e.g. headline) purposes.  The           *)
  163. (*    adjustment is represented as a fixed binary fraction of the       *)
  164. (*    em-square, ignoring any effect of SetFactor.  This number would       *)
  165. (*    need to be converted to a distance along the baseline in device      *)
  166. (*    units by the application.                           *)
  167.  
  168.   OT_TextKernPair    = OT_Level0+OT_Indirect+022H ;
  169.   OT_DesignKernPair    = OT_Level0+OT_Indirect+023H ;
  170.  
  171. (*  ? OT_Underlined is an unsigned word which is used to request       *)
  172. (*    algorithimic underlining for the engine when rendering the glyph.       *)
  173. (*    Bullet.library currently does not support this tag, though it       *)
  174. (*    may be used by other engines in the future.  The default for       *)
  175. (*    any engine which supports this tag must be OTUL_None.  Engines which *)
  176. (*    do not support this tag should return an appropriate OTERR value.       *)
  177. (*                                       *)
  178. (*    As of V39, diskfont.library will request underlining if specified    *)
  179. (*    in the TextAttr, or TTextAttr passed to OpenDiskFont().  Diskfont       *)
  180. (*    will first request Broken underlining (like the Text() function       *)
  181. (*    does when SetSoftStyle() is used), and then Solid underlining if       *)
  182. (*    the engine returns an error.  If the engine returns an error for       *)
  183. (*    both, then diskfont.library attempts to find, or create the best       *)
  184. (*    non-underlined font that it can. *)
  185.  
  186.   OT_UnderLined        = OT_Level0+024H ;
  187.  
  188.   OTUL_None        = 0 ;
  189.   OTUL_Solid        = 1 ;
  190.   OTUL_Broken        = 2 ;
  191.   OTUL_DoubleSolid    = 3 ;
  192.   OUTL_DoubleBroken    = 4 ;(* typo ??? *)
  193.   OTUL_DoubleBroken    = 4 ;
  194.  
  195. (*  ? OT_StrikeThrough is a boolean which is used to request           *)
  196. (*    algorithimic strike through when rendering the glyph.           *)
  197. (*    Bullet.library currently does not support this tag, though it       *)
  198. (*    may be used by other engines in the future.  The default for       *)
  199. (*    any engined which supports this tag must be FALSE.  Engines which       *)
  200. (*    do not support this tag should return an appropriate OTERR value.       *)
  201.  
  202.   OT_StrikeThrough    = OT_Level0+025H ;
  203.  
  204.  
  205. (*=========================================================================*)
  206. (* .otag tags                                   *)
  207.  
  208. (* suffix for files in FONTS: that contain these tags *)
  209.  
  210.   OTSUFFIX        = ".otag" ;
  211.  
  212. (* OT_FileIdent both identifies this file and verifies its size.
  213.  * It is required to be the first tag in the file. *)
  214.  
  215.   OT_FileIdent        = OT_Level1+001H ;
  216.  
  217. (* OT_Engine specifies the font engine this file is designed to use *)
  218.   OT_Engine        = OT_Level1+OT_Indirect+002H ;
  219.  
  220.   OTE_Bullet        = "bullet" ;
  221.  
  222. (* OT_Family is the family name of this typeface *)
  223.  
  224.   OT_Family        = OT_Level1+OT_Indirect+003H ;
  225.  
  226. (* The name of this typeface is implicit in the name of the .otag file  *)
  227. (* OT_BName is used to find the bold variant of this typeface        *)
  228.  
  229.   OT_BName        = OT_Level2+OT_Indirect+005H ;
  230.  
  231. (* OT_IName is used to find the italic variant of this typeface *)
  232.  
  233.   OT_IName        = OT_Level2+OT_Indirect+006H ;
  234.  
  235. (* OT_BIName is used to find the bold italic variant of this typeface *)
  236.  
  237.   OT_BIName        = OT_Level2+OT_Indirect+007H ;
  238.  
  239. (* OT_SymSet is used to select the symbol set that has the OT_YSizeFactor *)
  240. (* described here.  Other symbol sets might have different extremes      *)
  241.  
  242.   OT_SymbolSet        = OT_Level1+010H ;
  243.  
  244. (* OT_YSizeFactor is a ratio to assist in calculating the Point height      *)
  245. (* to BlackHeight relationship -- high word: Point height term, low      *)
  246. (* word: Black height term -- pointSize = ysize*<high>/<low>          *)
  247.  
  248.   OT_YSizeFactor    = OT_Level1+011H ;
  249.  
  250. (* OT_SpaceWidth specifies the width of the space character relative      *)
  251. (* to the character height                           *)
  252.  
  253.   OT_SpaceWidth        = OT_Level2+012H ;
  254.  
  255. (* OT_IsFixed is a boolean indicating that all the characters in the      *)
  256. (* typeface are intended to have the same character advance           *)
  257.  
  258.   OT_IsFixed        = OT_Level2+013H ;
  259.  
  260. (* OT_SerifFlag is a boolean indicating if the character has serifs        *)
  261.  
  262.   OT_SerifFlag        = OT_Level1+014H ;
  263.  
  264. (* OT_StemWeight is an unsigned byte indicating the weight of the character *)
  265.  
  266.   OT_StemWeight    = OT_Level1+015H ;
  267.  
  268.   OTS_UltraThin        =   8 ;    (*   0- 15 *)
  269.   OTS_ExtraThin        =  24 ;    (*  16- 31 *)
  270.   OTS_Thin         =  40 ;    (*  32- 47 *)
  271.   OTS_ExtraLight    =  56 ;    (*  48- 63 *)
  272.   OTS_Light         =  72 ;    (*  64- 79 *)
  273.   OTS_DemiLight        =  88 ;    (*  80- 95 *)
  274.   OTS_SemiLight        = 104 ;    (*  96-111 *)
  275.   OTS_Book        = 120 ;    (* 112-127 *)
  276.   OTS_Medium        = 136 ;    (* 128-143 *)
  277.   OTS_SemiBold        = 152 ;    (* 144-159 *)
  278.   OTS_DemiBold        = 168 ;    (* 160-175 *)
  279.   OTS_Bold        = 184 ;    (* 176-191 *)
  280.   OTS_ExtraBold        = 200 ;    (* 192-207 *)
  281.   OTS_Black        = 216 ;    (* 208-223 *)
  282.   OTS_ExtraBlack    = 232 ;    (* 224-239 *)
  283.   OTS_UltraBlack    = 248 ;    (* 240-255 *)
  284.  
  285. (* OT_SlantStyle is an unsigned byte indicating the font posture *)
  286.  
  287.   OT_SlantStyle    = OT_Level1+016H ;
  288.  
  289.   OTS_Upright        = 0 ;
  290.   OTS_Italic        = 1 ;    (* Oblique, Slanted, etc. *)
  291.   OTS_LeftItalic    = 2 ;    (* Reverse Slant      *)
  292.  
  293. (* OT_HorizStyle is an unsigned byte indicating the appearance width *)
  294.  
  295.   OT_HorizStyle    = OT_Level1+017H ;
  296.  
  297.   OTH_UltraCompressed    =  16 ;    (*   0- 31 *)
  298.   OTH_ExtraCompressed    =  48 ;    (*  32- 63 *)
  299.   OTH_Compressed    =  80 ;    (*  64- 95 *)
  300.   OTH_Condensed        = 112 ;    (*  96-127 *)
  301.   OTH_Normal        = 144 ;    (* 128-159 *)
  302.   OTH_SemiExpanded    = 176 ;    (* 160-191 *)
  303.   OTH_Expanded        = 208 ;    (* 192-223 *)
  304.   OTH_ExtraExpanded    = 240 ;    (* 224-255 *)
  305.  
  306. (* OT_SpaceFactor specifies the width of the space character relative    *)
  307. (* to the character height                        *)
  308.  
  309.   OT_SpaceFactor    = OT_Level2+018H ;
  310.  
  311. (* OT_InhibitAlgoStyle indicates which ta_Style bits, if any, should    *)
  312. (* be ignored even if the font does not already have that quality.    *)
  313. (* For example, if FSF_BOLD is set and the typeface is not bold but    *)
  314. (* the user specifies bold, the application or diskfont library is    *)
  315. (* not to use OT_Embolden to achieve a bold result.            *)
  316.  
  317.   OT_InhibitAlgoStyle    = OT_Level2+019H ;
  318.  
  319. (* OT_AvailSizes is an indirect pointer to sorted UWORDs, 0th is count *)
  320.  
  321.   OT_AvailSizes    = OT_Level1+OT_Indirect+020H ;
  322.  
  323.   OT_MAXAVAILSIZES    = 20 ;    (* no more than 20 sizes allowed *)
  324.  
  325. (* OT_SpecCount is the count number of parameters specified here *)
  326.  
  327.   OT_SpecCount        = OT_Level1+0100H ;
  328.  
  329. (* Specs can be created as appropriate for the engine by ORing in the    *)
  330. (* parameter number (1 is first, 2 is second, ... up to 15th)        *)
  331.  
  332.   OT_Spec        = OT_Level1+0100H ;
  333.  
  334. (* OT_Spec1 is the (first) parameter to the font engine to select    *)
  335. (* this particular typeface                        *)
  336.  
  337.   OT_Spec1        = OT_Level1+0101H ;
  338.  
  339. (* structures for glyph libraries *)
  340.  
  341. (* A GlyphEngine must be acquired via OpenEngine and is read-only *)
  342.  
  343. TYPE
  344.   GlyphEngine = RECORD
  345.     gle_Library : LibraryPtr ; (* engine library            *)
  346.     gle_Name    : STRING     ; (* library basename: e.g. "bullet"    *)
  347.     (* private library data follows... *)
  348.   END ;
  349.  
  350.   FIXED = LONGINT ;        (* 32 bit signed w/ 16 bits of fraction *)
  351.  
  352. TYPE
  353.   GlyphMap = RECORD
  354.     glm_BMModulo    : CARDINAL ; (* # of bytes in row: always multiple of4*)
  355.     glm_BMRows        : CARDINAL ; (* # of rows in bitmap              *)
  356.     glm_BlackLeft    : CARDINAL ; (* # of blank pixel columns at left      *)
  357.     glm_BlackTop    : CARDINAL ; (* # of blank rows at top              *)
  358.     glm_BlackWidth    : CARDINAL ; (* span of contiguous non-blank columns  *)
  359.     glm_BlackHeight    : CARDINAL ; (* span of contiguous non-blank rows     *)
  360.     glm_XOrigin        : FIXED    ; (* distance from upper left corner of bit*)
  361.     glm_YOrigin        : FIXED    ; (* map to initial CP,in fractional pixels*)
  362.     glm_X0        : INTEGER  ; (* approximatn of XOrigin in whole pixels*)
  363.     glm_Y0        : INTEGER  ; (* approximatn of YOrigin in whole pixels*)
  364.     glm_X1        : INTEGER  ; (* approximation of XOrigin+Width        *)
  365.     glm_Y1        : INTEGER  ; (* approximation of YOrigin+Width        *)
  366.     glm_Width        : FIXED    ; (* character advance , as fraction of em *)
  367.                          (*  width                      *)
  368.     glm_BitMap        : ADDRESS  ; (* actual glyph bitmap              *)
  369.   END ;
  370.  
  371. TYPE
  372.   GlyphWidthEntry = RECORD
  373.     gwe_Node : MinNode  ;    (* on list returned by OT_WidthList inquiry   *)
  374.     gwe_Code : CARDINAL ;    (* entry's character code value              *)
  375.     gwe_Width: FIXED ;        (* character advance, as fraction of em width *)
  376.   END ;
  377.  
  378. (* error results from outline libraries *)
  379.  
  380. (* PRELIMINARY *)
  381. CONST
  382.   OTERR_Failure        = -1 ;    (* catch-all for error            *)
  383.   OTERR_Success        =  0 ;    (* no error                *)
  384.   OTERR_BadTag        =  1 ;    (* inappropriate tag for function    *)
  385.   OTERR_UnknownTag    =  2 ;    (* unknown tag for function        *)
  386.   OTERR_BadData        =  3 ;    (* catch-all for bad tag data        *)
  387.   OTERR_NoMemory    =  4 ;    (* insufficient memory for operation    *)
  388.   OTERR_NoFace        =  5 ;    (* no typeface currently specified    *)
  389.   OTERR_BadFace        =  6 ;    (* typeface specification problem    *)
  390.   OTERR_NoGlyph        =  7 ;    (* no glyph specified            *)
  391.   OTERR_BadGlyph    =  8 ;    (* bad glyph code or glyph range    *)
  392.   OTERR_NoShear        =  9 ;    (* shear only partially specified    *)
  393.   OTERR_NoRotate    = 10 ;    (* rotate only partially specified    *)
  394.   OTERR_TooSmall    = 11 ;    (* typeface metrics yield tiny glyphs    *)
  395.   OTERR_UnknownGlyph    = 12 ;    (* glyph not known by engine        *)
  396.  
  397. VAR
  398.   BulletBase : LibraryPtr ;
  399.  
  400. PROCEDURE OpenEngine( ) : GlyphEnginePtr ;
  401. PROCEDURE CloseEngine( glyphEng : GlyphEnginePtr ) ;
  402. PROCEDURE SetInfoA( glyphEng : GlyphEnginePtr ; tags : TagItemPtr ) : LONGINT ;
  403. PROCEDURE SetInfo( glyphEng : GlyphEnginePtr ; tag1 : Tag ; .. ) : LONGINT ;
  404. PROCEDURE ObtainInfoA( glyphEng: GlyphEnginePtr ; tags: TagItemPtr ) : LONGINT ;
  405. PROCEDURE ObtainInfo( glyphEng : GlyphEnginePtr ; tag1 : Tag ; .. ) : LONGINT ;
  406. PROCEDURE ReleaseInfoA( glyphEng: GlyphEnginePtr ; tags: TagItemPtr ): LONGINT ;
  407. PROCEDURE ReleaseInfo( glyphEng : GlyphEnginePtr ; tag1 : Tag ; .. ) : LONGINT ;
  408.  
  409. END Bullet.
  410.