home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / basic / fontb.bi < prev    next >
Encoding:
Text File  |  1989-11-09  |  3.6 KB  |  82 lines

  1. '*** FONTB.BI - Font Routine Include File for the Presentation Graphics Toolbox in
  2. '           Microsoft BASIC 7.0, Professional Development System
  3. '              Copyright (C) 1987-1989, Microsoft Corporation
  4. '
  5. '  Purpose:
  6. '
  7. '     This is the INCLUDE file that interfaces a BASIC application with the
  8. '     Presentation Graphics Font Toolbox.  It should be included in any
  9. '     BASIC application using the toolbox.  The file contains DECLAREs
  10. '     for all of the user-accessible routines as well as a TYPE definition
  11. '     for the FontInfo data type, a declaration for the /FontLib/
  12. '     COMMON block which contains the FontErr variable, and finally
  13. '     CONST definitions for errors returned by the toolbox.
  14. '
  15. '**************************************************************************
  16.  
  17. '-- Global constants:
  18. CONST cFontBlockSize = 100
  19. CONST cIBMChars = 0
  20. CONST cWindowsChars = 1
  21.  
  22. ' Type to hold information about a font:
  23. TYPE FontInfo
  24.    FontNum        AS INTEGER        ' Position of font in reg. or loaded list
  25.    Ascent         AS INTEGER        ' From baseline to top of ascender
  26.    Points         AS INTEGER
  27.    PixWidth       AS INTEGER        ' 0 if proportional, width otherwise
  28.    PixHeight      AS INTEGER        ' Height of character bitmap
  29.    Leading        AS INTEGER        ' Internal leading above body of chars
  30.    AvgWidth       AS INTEGER        ' Average pixel width of chars
  31.    MaxWidth       AS INTEGER        ' Maximum pixel width of character
  32.    FileName       AS STRING * 66    ' .FON File name
  33.    FaceName       AS STRING * 32    ' Type face name
  34. END TYPE
  35.  
  36. ' Data type for blocks in the font data array:
  37. TYPE FontDataBlock
  38.    Block    AS STRING * cFontBlockSize   ' Buffer block for font data
  39. END TYPE
  40.  
  41. '-- Declarations for FontLib functions and subroutines:
  42.  
  43. DECLARE SUB SetMaxFonts (Registered AS INTEGER, Loaded AS INTEGER)
  44. DECLARE SUB GetMaxFonts (Registered AS INTEGER, Loaded AS INTEGER)
  45. DECLARE SUB GetTotalFonts (Registered AS INTEGER, Loaded AS INTEGER)
  46.  
  47. DECLARE FUNCTION RegisterFonts% (FileName$)
  48. DECLARE FUNCTION RegisterMemFont% (FontSeg AS INTEGER, FontOffset AS INTEGER)
  49. DECLARE SUB UnRegisterFonts ()
  50.  
  51. DECLARE FUNCTION LoadFont% (FontSpec$)
  52. DECLARE SUB SelectFont (FontNumber AS INTEGER)
  53.  
  54. DECLARE SUB GTextWindow (X1 AS SINGLE, Y1 AS SINGLE, X2 AS SINGLE, Y2 AS SINGLE, Scrn AS INTEGER)
  55. DECLARE SUB SetGCharset (CharSet AS INTEGER)
  56. DECLARE SUB SetGTextColor (C AS INTEGER)
  57. DECLARE SUB SetGTextDir (Dir AS INTEGER)
  58. DECLARE FUNCTION OutGText% (X AS SINGLE, Y AS SINGLE, Text$)
  59. DECLARE FUNCTION GetGTextLen% (Text$)
  60.  
  61. DECLARE SUB GetFontInfo (FontParams AS FontInfo)
  62. DECLARE SUB GetRFontInfo (Font AS INTEGER, FontParams AS FontInfo)
  63.  
  64. '-- Error return variable and CONST definitions:
  65.  
  66. COMMON SHARED /FontLib/ FontErr AS INTEGER
  67.  
  68. CONST cFLUnexpectedOff = 200  'Unexpected BASIC error offset
  69. CONST cFileNotFound = 1        'Specified file not found (RegisterFonts)
  70. CONST cBadFontSpec = 2         'Invalid part of a font spec (LoadFont)
  71. CONST cFontNotFound = 3        'Spec. doesn't match any font (LoadFont)
  72. CONST cBadFontFile = 5         'Invalid font file format (RegisterFonts)
  73. CONST cBadFontLimit = 6        'Invalid font limit (SetMaxFonts)
  74. CONST cTooManyFonts = 7        'Tried to go past limit (LoadFont, RegisterMemFont,
  75. '                               RegisterFonts)
  76. CONST cNoFonts = 8             'No loaded fonts (SelectFont, GetFontInfo,
  77. '                               GetGTextLen, LoadFont)
  78. CONST cBadFontType = 10        'Not bitmap font (RegisterMemFont)
  79. CONST cBadFontNumber = 11      'Bad Font Number (GetRFontInfo)
  80. CONST cNoFontMem = 12          'Not enough memory (SetMaxFonts, LoadFonts)
  81.  
  82.