home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / Fonts.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  8.1 KB  |  285 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Fonts.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __FONTS__
  18. #define __FONTS__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29.  
  30. #if GENERATINGPOWERPC
  31. #pragma options align=mac68k
  32. #endif
  33.  
  34. #ifdef __CFM68K__
  35. #pragma lib_export on
  36. #endif
  37.  
  38.  
  39. enum {
  40.     systemFont                    = 0,
  41.     applFont                    = 1,
  42.     newYork                        = 2,
  43.     geneva                        = 3,
  44.     monaco                        = 4,
  45.     venice                        = 5,
  46.     london                        = 6,
  47.     athens                        = 7,
  48.     sanFran                        = 8,
  49.     toronto                        = 9,
  50.     cairo                        = 11,
  51.     losAngeles                    = 12,
  52.     times                        = 20,
  53.     helvetica                    = 21,
  54.     courier                        = 22,
  55.     symbol                        = 23,
  56.     mobile                        = 24,
  57.     commandMark                    = 17,
  58.     checkMark                    = 18,
  59.     diamondMark                    = 19
  60. };
  61.  
  62. enum {
  63.     appleMark                    = 20,
  64.     propFont                    = 36864,
  65.     prpFntH                        = 36865,
  66.     prpFntW                        = 36866,
  67.     prpFntHW                    = 36867,
  68.     fixedFont                    = 45056,
  69.     fxdFntH                        = 45057,
  70.     fxdFntW                        = 45058,
  71.     fxdFntHW                    = 45059,
  72.     fontWid                        = 44208
  73. };
  74.  
  75. struct FMInput {
  76.     short                            family;
  77.     short                            size;
  78.     Style                            face;
  79.     Boolean                            needBits;
  80.     short                            device;
  81.     Point                            numer;
  82.     Point                            denom;
  83. };
  84. typedef struct FMInput FMInput;
  85.  
  86. struct FMOutput {
  87.     short                            errNum;
  88.     Handle                            fontHandle;
  89.     UInt8                            boldPixels;
  90.     UInt8                            italicPixels;
  91.     UInt8                            ulOffset;
  92.     UInt8                            ulShadow;
  93.     UInt8                            ulThick;
  94.     UInt8                            shadowPixels;
  95.     SInt8                            extra;
  96.     UInt8                            ascent;
  97.     UInt8                            descent;
  98.     UInt8                            widMax;
  99.     SInt8                            leading;
  100.     SInt8                            curStyle;
  101.     Point                            numer;
  102.     Point                            denom;
  103. };
  104. typedef struct FMOutput FMOutput;
  105.  
  106. typedef FMOutput *FMOutPtr;
  107.  
  108. struct FontRec {
  109.     short                            fontType;                    /*font type*/
  110.     short                            firstChar;                    /*ASCII code of first character*/
  111.     short                            lastChar;                    /*ASCII code of last character*/
  112.     short                            widMax;                        /*maximum character width*/
  113.     short                            kernMax;                    /*negative of maximum character kern*/
  114.     short                            nDescent;                    /*negative of descent*/
  115.     short                            fRectWidth;                    /*width of font rectangle*/
  116.     short                            fRectHeight;                /*height of font rectangle*/
  117.     unsigned short                    owTLoc;                        /*offset to offset/width table*/
  118.     short                            ascent;                        /*ascent*/
  119.     short                            descent;                    /*descent*/
  120.     short                            leading;                    /*leading*/
  121.     short                            rowWords;                    /*row width of bit image / 2 */
  122. };
  123. typedef struct FontRec FontRec;
  124.  
  125. struct FMetricRec {
  126.     Fixed                            ascent;                        /*base line to top*/
  127.     Fixed                            descent;                    /*base line to bottom*/
  128.     Fixed                            leading;                    /*leading between lines*/
  129.     Fixed                            widMax;                        /*maximum character width*/
  130.     Handle                            wTabHandle;                    /*handle to font width table*/
  131. };
  132. typedef struct FMetricRec FMetricRec, *FMetricRecPtr, **FMetricRecHandle;
  133.  
  134. struct WidEntry {
  135.     short                            widStyle;                    /*style entry applies to*/
  136. };
  137. typedef struct WidEntry WidEntry;
  138.  
  139. struct WidTable {
  140.     short                            numWidths;                    /*number of entries - 1*/
  141. };
  142. typedef struct WidTable WidTable;
  143.  
  144. struct AsscEntry {
  145.     short                            fontSize;
  146.     short                            fontStyle;
  147.     short                            fontID;                        /*font resource ID*/
  148. };
  149. typedef struct AsscEntry AsscEntry;
  150.  
  151. struct FontAssoc {
  152.     short                            numAssoc;                    /*number of entries - 1*/
  153. };
  154. typedef struct FontAssoc FontAssoc;
  155.  
  156. struct StyleTable {
  157.     short                            fontClass;
  158.     long                            offset;
  159.     long                            reserved;
  160.     char                            indexes[48];
  161. };
  162. typedef struct StyleTable StyleTable;
  163.  
  164. struct NameTable {
  165.     short                            stringCount;
  166.     Str255                            baseFontName;
  167. };
  168. typedef struct NameTable NameTable;
  169.  
  170. struct KernPair {
  171.     char                            kernFirst;                    /*1st character of kerned pair*/
  172.     char                            kernSecond;                    /*2nd character of kerned pair*/
  173.     short                            kernWidth;                    /*kerning in 1pt fixed format*/
  174. };
  175. typedef struct KernPair KernPair;
  176.  
  177. struct KernEntry {
  178.     short                            kernLength;                    /*length of this entry*/
  179.     short                            kernStyle;                    /*style the entry applies to*/
  180. };
  181. typedef struct KernEntry KernEntry;
  182.  
  183. struct KernTable {
  184.     short                            numKerns;                    /*number of kerning entries*/
  185. };
  186. typedef struct KernTable KernTable;
  187.  
  188. struct WidthTable {
  189.     Fixed                            tabData[256];                /*character widths*/
  190.     Handle                            tabFont;                    /*font record used to build table*/
  191.     long                            sExtra;                        /*space extra used for table*/
  192.     long                            style;                        /*extra due to style*/
  193.     short                            fID;                        /*font family ID*/
  194.     short                            fSize;                        /*font size request*/
  195.     short                            face;                        /*style (face) request*/
  196.     short                            device;                        /*device requested*/
  197.     Point                            inNumer;                    /*scale factors requested*/
  198.     Point                            inDenom;                    /*scale factors requested*/
  199.     short                            aFID;                        /*actual font family ID for table*/
  200.     Handle                            fHand;                        /*family record used to build up table*/
  201.     Boolean                            usedFam;                    /*used fixed point family widths*/
  202.     UInt8                            aFace;                        /*actual face produced*/
  203.     short                            vOutput;                    /*vertical scale output value*/
  204.     short                            hOutput;                    /*horizontal scale output value*/
  205.     short                            vFactor;                    /*vertical scale output value*/
  206.     short                            hFactor;                    /*horizontal scale output value*/
  207.     short                            aSize;                        /*actual size of actual font used*/
  208.     short                            tabSize;                    /*total size of table*/
  209. };
  210. typedef struct WidthTable WidthTable;
  211.  
  212. struct FamRec {
  213.     short                            ffFlags;                    /*flags for family*/
  214.     short                            ffFamID;                    /*family ID number*/
  215.     short                            ffFirstChar;                /*ASCII code of 1st character*/
  216.     short                            ffLastChar;                    /*ASCII code of last character*/
  217.     short                            ffAscent;                    /*maximum ascent for 1pt font*/
  218.     short                            ffDescent;                    /*maximum descent for 1pt font*/
  219.     short                            ffLeading;                    /*maximum leading for 1pt font*/
  220.     short                            ffWidMax;                    /*maximum widMax for 1pt font*/
  221.     long                            ffWTabOff;                    /*offset to width table*/
  222.     long                            ffKernOff;                    /*offset to kerning table*/
  223.     long                            ffStylOff;                    /*offset to style mapping table*/
  224.     short                            ffProperty[9];                /*style property info*/
  225.     short                            ffIntl[2];                    /*for international use*/
  226.     short                            ffVersion;                    /*version number*/
  227. };
  228. typedef struct FamRec FamRec;
  229.  
  230. extern pascal void InitFonts(void)
  231.  ONEWORDINLINE(0xA8FE);
  232. extern pascal void GetFontName(short familyID, Str255 name)
  233.  ONEWORDINLINE(0xA8FF);
  234. extern pascal void GetFNum(ConstStr255Param name, short *familyID)
  235.  ONEWORDINLINE(0xA900);
  236. extern pascal Boolean RealFont(short fontNum, short size)
  237.  ONEWORDINLINE(0xA902);
  238. extern pascal void SetFontLock(Boolean lockFlag)
  239.  ONEWORDINLINE(0xA903);
  240. extern pascal FMOutPtr FMSwapFont(const FMInput *inRec)
  241.  ONEWORDINLINE(0xA901);
  242. extern pascal void SetFScaleDisable(Boolean fscaleDisable)
  243.  ONEWORDINLINE(0xA834);
  244. extern pascal void FontMetrics(FMetricRecPtr theMetrics)
  245.  ONEWORDINLINE(0xA835);
  246. extern pascal void SetFractEnable(Boolean fractEnable);
  247. extern pascal short GetDefFontSize(void)
  248.  FIVEWORDINLINE(0x3EB8, 0x0BA8, 0x6604, 0x3EBC, 0x000C);
  249. extern pascal Boolean IsOutline(Point numer, Point denom)
  250.  TWOWORDINLINE(0x7000, 0xA854);
  251. extern pascal void SetOutlinePreferred(Boolean outlinePreferred)
  252.  TWOWORDINLINE(0x7001, 0xA854);
  253. extern pascal Boolean GetOutlinePreferred(void)
  254.  TWOWORDINLINE(0x7009, 0xA854);
  255. extern pascal OSErr OutlineMetrics(short byteCount, const void *textPtr, Point numer, Point denom, short *yMax, short *yMin, FixedPtr awArray, FixedPtr lsbArray, RectPtr boundsArray)
  256.  TWOWORDINLINE(0x7008, 0xA854);
  257. extern pascal void SetPreserveGlyph(Boolean preserveGlyph)
  258.  TWOWORDINLINE(0x700A, 0xA854);
  259. extern pascal Boolean GetPreserveGlyph(void)
  260.  TWOWORDINLINE(0x700B, 0xA854);
  261. extern pascal OSErr FlushFonts(void)
  262.  TWOWORDINLINE(0x700C, 0xA854);
  263. #if CGLUESUPPORTED
  264. extern void getfnum(const char *theName, short *familyID);
  265. extern void getfontname(short familyID, char *theName);
  266. #endif
  267. extern pascal short GetSysFont( void )
  268.     TWOWORDINLINE( 0x3EB8, 0x0BA6 ); /* MOVE.W $0BA6,(SP) */
  269. extern pascal short GetAppFont( void )
  270.     TWOWORDINLINE( 0x3EB8, 0x0984 ); /* MOVE.W $0984,(SP) */
  271.  
  272. #ifdef __CFM68K__
  273. #pragma lib_export off
  274. #endif
  275.  
  276. #if GENERATINGPOWERPC
  277. #pragma options align=reset
  278. #endif
  279.  
  280. #ifdef __cplusplus
  281. }
  282. #endif
  283.  
  284. #endif /* __FONTS__ */
  285.