Subversion Repositories filter_foundry

Rev

Rev 193 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * ATMInterface.h
  3.  *
  4.  * Version 3.0
  5.  *
  6.  * Adobe Type Manager is a trademark of Adobe Systems Incorporated.
  7.  * Copyright 1983-1991 Adobe Systems Incorporated.
  8.  * All Rights Reserved.
  9.  */
  10.  
  11. #ifndef _H_ATMInterface
  12. #define _H_ATMInterface
  13.  
  14. #include <Dialogs.h>                                    /* needed for MMFPHook declaration */
  15.  
  16. /*
  17.  * This defines which language calling conventions you wish to use for the
  18.  * "pre-3.0" calls with ATM 3.0. For example, do you want the field "fontAvailable"
  19.  * a C or Pascal routine? If you wish this to be a PASCAL routine always, use
  20.  *              #define ATM_LANG        pascal
  21.  * We don't advise doing this unless you are guaranteed that the ATM you will
  22.  * be working with will _always_ be ATM 3.0 or greater!  But, you MUST do this
  23.  *if you request ATMPascalProcsStatusCode instead of ATMProcsStatusCode.
  24.  */
  25. #ifndef ATM_LANG
  26. #define ATM_LANG        ATM_C
  27. #endif
  28.  
  29. /*
  30.  * Does your compiler support function prototypes in structure fields? If so, we
  31.  * will supply them for you. Older versions of Think C (pre-5.0) don't and will give
  32.  * error messages for prototyping function pointers in structs, so you will want
  33.  * to turn this off.
  34.  */
  35. #ifndef ATM_USE_PROTOTYPES
  36. #       if !defined(THINK_C) || THINK_C == 5
  37. #               define ATM_USE_PROTOTYPES       1
  38. #       else
  39. #               define ATM_USE_PROTOTYPES       0
  40. #       endif
  41. #endif
  42.  
  43. /*
  44.  * Think C 4.0 (THINK_C == 1) doesn't allow the "pascal" keyword in function pointers
  45.  * in structs.
  46.  */
  47. #ifndef ATM_C
  48. #define ATM_C
  49. #endif
  50. #ifndef ATM_PASCAL
  51. #       if !defined(THINK_C) || THINK_C == 5
  52. #               define ATM_PASCAL       pascal
  53. #       else
  54. #               define ATM_PASCAL
  55. #       endif
  56. #endif
  57.  
  58. #define MaxLegalBlendName       31                      /* Maximum size of a legal font name (w/o len). */
  59. #define MaxBlendEntries         16                      /* Max entries in a blend vector.                               */
  60. #define MaxBlendAxes            4                       /* Can specify 4 dimensions.                                    */
  61.  
  62. #define WeightAxis      (StringPtr) "\pWeight"  /* Weight axis identifier.                                      */
  63. #define WidthAxis       (StringPtr) "\pWidth"   /* Width axis identifier.                                       */
  64.  
  65. /* For the "method" parameter of CopyFit. */
  66. enum {
  67.         ATMCopyFitDefault,                                      /* Let us choose the best method for H&J.               */
  68.         ATMCopyFitConstStems,                           /* Keep the stem widths constant.                               */
  69.         ATMCopyFitVarStems                                      /* Allow stem widths to vary.                                   */
  70. };
  71.  
  72. typedef long ATMFixed;
  73.  
  74. typedef short ATMErr;
  75.  
  76. /*
  77.  * For MPW users who don't want to use the ATMInterface.a glue routines:
  78.  * you must use ATMPascalProcsStatusCode.  This in turn requires that you
  79.  *              #define ATM_LANG pascal
  80.  * (as described above) before #include'ing ATMInterface.h.
  81.  */
  82. #define ATMProcsStatusCode                      0
  83. #define ATMPascalProcsStatusCode        16
  84. #define ATMPickerControlCode            10
  85.  
  86. /* Return codes from GetBlendedFontType                                                                                                 */
  87. #define ATMNotBlendFont                         0
  88. #define ATMBlendFontInstance            1
  89. #define ATMBlendFontBaseDesign          2
  90. #define ATMTempBlendFont                        3
  91.  
  92. typedef struct
  93.         {
  94.         ATMFixed a, b, c, d, tx, ty;
  95.         } ATMFixedMatrix;
  96.  
  97. typedef struct
  98.         {
  99.         ATMFixed x, y;
  100.         } ATMFixedPoint, *ATMPFixedPoint;
  101.  
  102. /*
  103.  * This structure is filled via getFontSpecsATM() and gives additional information
  104.  * about the current font than we can get from just the FOND. Make sure that the
  105.  * appropriate bits are set when the fields are filled in, and the "SpecsReserved"
  106.  * is initialized to zero!
  107.  *
  108.  * As of the 3.0 release, only the vertical stem width and xheight are used,
  109.  * though the cap height might be used if the xheight is not available. This structure
  110.  * is designed to be expandable as needed in the future.
  111.  *
  112.  * The version number MUST be initialized to zero or one...
  113.  */
  114. #define FontSpecsVersion        1
  115. #define SpecReserve                     23
  116.  
  117. typedef struct FontSpecs {
  118.         short   version;
  119.         Boolean vertStemWidthAvail : 1;         /* Signals that data is available.              */
  120.         Boolean horizStemWidthAvail : 1;
  121.         Boolean xHeightAvail : 1;
  122.         Boolean capHeightAvail : 1;
  123.         Boolean serifWidthAvail : 1;
  124.         Boolean serifHeightAvail : 1;
  125.                         /* These are in version 1 and above. */
  126.         Boolean italicAngleAvail : 1;
  127.         Boolean flagsAvail : 1;
  128.         Boolean lowerCaseScaleAvail : 1;
  129.  
  130. #ifdef THINK_C
  131.         long    SpecsReserved : SpecReserve;    /* Must be initialized to zero (0)!             */
  132. #else
  133.         int             SpecsReserved : SpecReserve;    /* Must be initialized to zero (0)!             */
  134. #endif
  135.        
  136.         Fixed   SpecsVertStemWidth;                     /* Thickness of the vertical stems.             */
  137.         Fixed   SpecsHorizStemWidth;            /* Thickness of the horizontal stems.   */
  138.         Fixed   SpecsxHeight;                           /* The height of the letter 'x'.                */
  139.         Fixed   SpecsCapHeight;                         /* The height of a capital letter.              */
  140.         Fixed   SpecsSerifWidth;                        /* The width of a serif.                                */
  141.         Fixed   SpecsSerifHeight;                       /* The height of a serif, ie. how tall  */
  142.                                                                                 /* are the tips off the base line.              */                                     
  143.                         /* These are in version 1 and above. */
  144.         Fixed   SpecsItalicAngle;                       /* How much the font "leans".                   */
  145.         long    SpecsFlags;                                     /* See below for flag values.                   */
  146.         Fixed   SpecsLowerCaseScale;            /* Amount to scale lowercase for
  147.                                                                                  * x-height matching */
  148.  
  149.         Fixed   SpecsResSpace[SpecReserve];     /* Reserved fields for later.                   */
  150. } FontSpecs;
  151.  
  152. #define SPECS_FORCE_BOLD                0x1             /* Font should be artificially emboldened. */
  153. #define SPECS_ALL_CAPS                  0x2             /* Font contains uppercase characters in lowercase positions. */
  154. #define SPECS_SMALL_CAPS                0x4             /* Font contains small capitals in lowercase positions. */
  155.  
  156. /*
  157.  * Creator/Picker option flags
  158.  */
  159. #define CREATOR_DIALOG  0x0001  /* Creator dialog, else Picker dialog */
  160. #define OK_IS_QUIT              0x0002  /* Ok button title becomes Quit */
  161.  
  162. #if ATM_USE_PROTOTYPES
  163. typedef ATM_PASCAL short (*MMFPHook)(short item, DialogPtr theDialog);
  164. #else
  165. typedef ProcPtr MMFPHook;
  166. #endif
  167.  
  168. /*
  169.  * Multiple Master Font Picker parameters
  170.  *
  171.  * All strings are Pascal format.
  172.  *
  173.  * The MMFP_Parms apply to both the Font Picker and Font Creator dialogs.
  174.  * Set the CREATOR_DIALOG bit in "flags" to get the Creator rather than the
  175.  * Picker dialog.  Use "where" to specify the dialog's position, or use [0,0]
  176.  * to get the standard positioning.  Pass in your own "prompt" string or use
  177.  * NULL to get the standard prompt.  Pass in your own "sample" string or use
  178.  * NULL to get the standard sample.  The sample string is continuously redrawn
  179.  * to illustrate the current font as the user navigates through the Multiple
  180.  * Master design space.  A short fragment of the user's selection in the
  181.  * current document is a reasonable alternative to the default sample text.
  182.  * The user is also able to type in the sample box to see other characters.
  183.  * Pass in your own sample "startSize" or use 0 to get the default initial
  184.  * sample size.  The user can also adjust the sample size through a popup
  185.  * menu and type-in size box.  Pass in your own "dlgHook" dialog event hook
  186.  * function if you wish to change the dialog behavior or add your own items.
  187.  * If you specify a "dlgHook", it is called by the Picker immediately after
  188.  * each call to ModalDialog().  Refer to the Standard File Package chapter of
  189.  * Inside Mac for more details on how to write and use a dialog hook routine.
  190.  * Despite their different appearances, both the Creator and Picker dialogs
  191.  * share the same item numbering.
  192.  *
  193.  * When the Picker or Creator dialog is first displayed, the family and
  194.  * instance popup menus and the sliders and axis values are all set to reflect
  195.  * the initial font, and the sample string is rendered in this font at the
  196.  * initial sample size.  There are a number of ways to choose this initial font.
  197.  * If "startFondID" is a Multiple Master font then it is used as the initial
  198.  * font.  If "startFondID" is -1 or a regular (non-Multiple Master) font, then
  199.  * "startFamilyName" is checked.  If this is the name of a Multiple Master
  200.  * font, then the instance at "startCoords" is used as the initial font.
  201.  * "StartCoords" must have as many elements as there are design axes for
  202.  * the specified family.  If "startCoords" is NULL, then the first instance
  203.  * in "startFamilyName" is used as the initial font.  If "startFamilyName"
  204.  * is NULL, then "startCoords" is ignored and the default initial font is
  205.  * chosen.
  206.  */
  207. struct MMFP_Parms
  208. {
  209.         short           version;                        /* (in) always 1 */
  210.         short           flags;                          /* (in) option flags, 0 for default Picker dialog */
  211.         Point           where;                          /* (in) dialog's top-left corner, [0,0] for default */
  212.         StringPtr       prompt;                         /* (in) prompt string, NULL for default */
  213.         StringPtr       sample;                         /* (in) sample string, NULL for default */
  214.         short           startFondID;            /* (in) initial font, -1 for none */
  215.         StringPtr       startFamilyName;        /* (in) initial family, NULL for default */
  216.         Fixed           *startCoords;           /* (in) initial axis coordinates, NULL for default */
  217.         short           startSize;                      /* (in) initial sample size, 0 for default */
  218.         MMFPHook        dlgHook;                        /* (in) application dialog hook function, NULL for none */
  219. };
  220. typedef struct MMFP_Parms               MMFP_Parms, *MMFP_ParmsPtr;
  221.  
  222. /*
  223.  * Multiple Master Font Picker Reply
  224.  *
  225.  * All strings are Pascal format.
  226.  *
  227.  * While the user manipulates the Picker or Creator dialog's controls to
  228.  * navigate through the Multiple Master design space, the sample text is
  229.  * continuously rerendered in the font instance with the selected design
  230.  * coordinates.  A temporary instance is created on the fly whenever a
  231.  * permanent instance does not already exist.  Only the permanent instances
  232.  * remain when the dialog is dismissed.  The Creator dialog has only an
  233.  * OK button while the Picker dialog has both OK and Cancel.  (For both
  234.  * dialogs, OK can be retitled Quit using the OK_IS_QUIT flag bit).  The
  235.  * Picker call returns ATM_NOERR (0) for OK, and ATM_PICKER_CANCELLED for
  236.  * Cancel.  Regardless of the way the user dismisses the dialog, any fields
  237.  * specified in MMFP_Reply are filled in to reflect the state in which the
  238.  * user last left the dialog.
  239.  *
  240.  * Any pointer argument specified as NULL is ignored.  The others are always
  241.  * filled in.  Specify "sample" to get a copy of the user's current sample
  242.  * text string.  Specify "familyName" to get the name of the current
  243.  * Multiple Master family.  Specify "coords" to get an array of design
  244.  * coordinates for the current instance.  "Coords" will contain "numAxes"
  245.  * elements.  Use MaxBlendAxes to safely allocate an array long enough for
  246.  * the returned coordinates.  If the font instance corresponding to these
  247.  * design coordinates was a permanent one, its ID is returned in "fondID".
  248.  * If the instance was a temporary one, it no longer exists, so "fondID" is
  249.  * set to -1.  The calling program may make appropriate ATM calls to create
  250.  * a new temporary or permanent instance of that font using the family name
  251.  * and design coordinates.
  252.  */
  253. struct MMFP_Reply
  254. {
  255.         StringPtr       sample;                         /* (out) last sample string (Str255), NULL to ignore */
  256.         short           fondID;                         /* (out) selected font if permanent, else -1 */
  257.         StringPtr       familyName;                     /* (out) selected family (Str32), NULL to ignore */
  258.         short           numAxes;                        /* (out) number of design axes in selected family */
  259.         Fixed           *coords;                        /* (out) coords of selected instance, NULL to ignore */
  260.         short           size;                           /* (out) last sample size */
  261. };
  262. typedef struct MMFP_Reply               MMFP_Reply, *MMFP_ReplyPtr;
  263.  
  264. #if ATM_USE_PROTOTYPES
  265. #       define ATM_PROTO7(a,b,c,d,e,f,g)        (a,b,c,d,e,f,g)
  266. #       define ATM_PROTO6(a,b,c,d,e,f)          (a,b,c,d,e,f)
  267. #       define ATM_PROTO5(a,b,c,d,e)            (a,b,c,d,e)
  268. #       define ATM_PROTO4(a,b,c,d)                      (a,b,c,d)
  269. #       define ATM_PROTO3(a,b,c)                        (a,b,c)
  270. #       define ATM_PROTO2(a,b)                          (a,b)
  271. #       define ATM_PROTO1(a)                            (a)
  272. #else
  273. #       define ATM_PROTO7(a,b,c,d,e,f,g)        ()
  274. #       define ATM_PROTO6(a,b,c,d,e,f)          ()
  275. #       define ATM_PROTO5(a,b,c,d,e)            ()
  276. #       define ATM_PROTO4(a,b,c,d)                      ()
  277. #       define ATM_PROTO3(a,b,c)                        ()
  278. #       define ATM_PROTO2(a,b)                          ()
  279. #       define ATM_PROTO1(a)                            ()
  280. #endif
  281.  
  282. #define ATMProcs3Version 3
  283. typedef struct
  284.         {
  285.         long version;
  286.         short (*fontAvailable) ATM_PROTO2(short family, short style);
  287.         short (*showText) ATM_PROTO3(Byte *text, short length, ATMFixedMatrix *matrix);
  288.         short (*xyshowText) ATM_PROTO4(Byte *text, short length, ATMFixedMatrix *matrix, Fixed *displacements);
  289.         } ATMProcs3;
  290.  
  291. #define ATMProcs4Version 4
  292. typedef struct
  293.         {
  294.         long version;
  295.         short (*fontAvailable) ATM_PROTO2(short family, short style);
  296.         short (*showTextErr) ATM_PROTO4(Byte *text, short length, ATMFixedMatrix *matrix, short *errorCode);
  297.         short (*xyshowTextErr) ATM_PROTO5(Byte *text, short length, ATMFixedMatrix *matrix,
  298.                                         Fixed *displacements, short *errorCode);
  299.         short (*getOutline) ATM_PROTO7(short c, ATMFixedMatrix *matrix, Ptr clientHook,
  300.                                         short (*MoveTo)(Ptr clientHook, ATMPFixedPoint pc),
  301.                                         short (*LineTo)(Ptr clientHook, ATMPFixedPoint pc),
  302.                                         short (*CurveTo)(Ptr clientHook, ATMPFixedPoint pc1, ATMPFixedPoint pc2, ATMPFixedPoint pc3),
  303.                                         short (*ClosePath)(Ptr clientHook));   
  304.         short (*startFill) ATM_PROTO1(void);
  305.         short (*fillMoveTo) ATM_PROTO1(ATMPFixedPoint pc);
  306.         short (*fillLineTo) ATM_PROTO1(ATMPFixedPoint pc);
  307.         short (*fillCurveTo) ATM_PROTO3(ATMPFixedPoint pc1, ATMPFixedPoint pc2, ATMPFixedPoint pc3);
  308.         short (*fillClosePath) ATM_PROTO1(void);
  309.         short (*endFill) ATM_PROTO1(void);
  310.         } ATMProcs4;
  311.  
  312. #define ATMProcs5Version 5
  313. #define ATMProcs8Version 8
  314. /*
  315.  * Note for version 5 and above.
  316.  *
  317.  * All the routines new for version 5 have pascal interfaces.
  318.  * Depending on how the interface is initialized, the older routines may or may not be
  319.  * pascal interface.
  320.  */
  321. typedef struct
  322.         {
  323.         long version;
  324.         ATM_LANG short (*fontAvailable) ATM_PROTO2(short family, short style);
  325.         ATM_LANG short (*showTextErr) ATM_PROTO4(Byte *text, short length, ATMFixedMatrix *matrix, ATMErr *errorCode);
  326.         ATM_LANG short (*xyshowTextErr) ATM_PROTO5(Byte *text, short length, ATMFixedMatrix *matrix,
  327.                                         Fixed *displacements, ATMErr *errorCode);
  328.         ATM_LANG short (*getOutline) ATM_PROTO7(short c, ATMFixedMatrix *matrix, Ptr clientHook,
  329.                                         short (*MoveTo)(Ptr clientHook, ATMPFixedPoint pc),
  330.                                         short (*LineTo)(Ptr clientHook, ATMPFixedPoint pc),
  331.                                         short (*CurveTo)(Ptr clientHook, ATMPFixedPoint pc1, ATMPFixedPoint pc2, ATMPFixedPoint pc3),
  332.                                         short (*ClosePath)(Ptr clientHook));   
  333.         ATM_LANG short (*startFill) ATM_PROTO1(void);
  334.         ATM_LANG short (*fillMoveTo) ATM_PROTO1(ATMPFixedPoint pc);
  335.         ATM_LANG short (*fillLineTo) ATM_PROTO1(ATMPFixedPoint pc);
  336.         ATM_LANG short (*fillCurveTo) ATM_PROTO3(ATMPFixedPoint pc1, ATMPFixedPoint pc2, ATMPFixedPoint pc3);
  337.         ATM_LANG short (*fillClosePath) ATM_PROTO1(void);
  338.         ATM_LANG short (*endFill) ATM_PROTO1(void);
  339.        
  340.         /* New for version 5 -- control functions for use with control panel (&testing). */
  341.         ATM_PASCAL void (*disable) ATM_PROTO1(void);
  342.         ATM_PASCAL void (*reenable) ATM_PROTO1(void);
  343.  
  344.         /* New for version 5 (with blended fonts) */
  345.         ATM_PASCAL short (*getBlendedFontType) ATM_PROTO2(StringPtr fontName, short fondID);
  346.         ATM_PASCAL ATMErr (*encodeBlendedFontName) ATM_PROTO4(StringPtr familyName, short numAxes,
  347.                                         Fixed *coords, StringPtr blendName);
  348.         ATM_PASCAL ATMErr (*decodeBlendedFontName) ATM_PROTO5(StringPtr blendName, StringPtr familyName,
  349.                                         short *numAxes, Fixed *coords, StringPtr displayInstanceStr);
  350.         ATM_PASCAL ATMErr (*addMacStyleToCoords) ATM_PROTO4(Fixed *coords, short macStyle, Fixed *newCoords, short *stylesLeft);
  351.         ATM_PASCAL ATMErr (*convertCoordsToBlend) ATM_PROTO2(Fixed *coords, Fixed *weightVector);
  352.         ATM_PASCAL ATMErr (*normToUserCoords) ATM_PROTO2(Fixed *normalCoords, Fixed *coords);
  353.         ATM_PASCAL ATMErr (*userToNormCoords) ATM_PROTO2(Fixed *coords, Fixed *normalCoords);
  354.         ATM_PASCAL ATMErr (*createTempBlendedFont) ATM_PROTO3(short numAxes, Fixed *coords, short *useFondID);
  355.         ATM_PASCAL ATMErr (*disposeTempBlendedFont) ATM_PROTO1(short fondID);
  356.         ATM_PASCAL ATMErr (*createPermBlendedFont) ATM_PROTO4(StringPtr fontName, short fontSize, short fontFileID, short *retFondID);
  357.         ATM_PASCAL ATMErr (*disposePermBlendedFont) ATM_PROTO1(short fondID);
  358.         ATM_PASCAL ATMErr (*getTempBlendedFontFileID) ATM_PROTO1(short *fileID);
  359.         ATM_PASCAL ATMErr (*getNumAxes) ATM_PROTO1(short *numAxes);
  360.         ATM_PASCAL ATMErr (*getNumMasters) ATM_PROTO1(short *numMasters);
  361.         ATM_PASCAL ATMErr (*getMasterFOND) ATM_PROTO2(short i, short *masterFOND);
  362.         ATM_PASCAL ATMErr (*copyFit) ATM_PROTO6(short method, Fixed TargetWidth, Fixed *beginCoords,
  363.                                         Fixed *baseWidths, Fixed *resultWidth, Fixed *resultCoords);
  364.         ATM_PASCAL ATMErr (*getFontSpecs) ATM_PROTO1(FontSpecs *hints);
  365.         ATM_PASCAL void (*private1) ATM_PROTO1(void);
  366.         ATM_PASCAL void (*private2) ATM_PROTO1(void);
  367.         ATM_PASCAL ATMErr (*showTextDesign) ATM_PROTO7(StringPtr fontFamily, Byte *text, short len, ATMFixedMatrix *matrix,
  368.                                         Fixed *coords, Fixed *displacements, short *lenDisplayed);
  369.         ATM_PASCAL ATMErr (*getAxisBlendInfo) ATM_PROTO6(short axis, short *userMin, short *userMax,
  370.                                         StringPtr type, StringPtr label, StringPtr shortLabel);
  371.         ATM_PASCAL ATMErr (*fontFit) ATM_PROTO7(Fixed *origCoords, short numTargets, short *varyAxes,
  372.                                         Fixed *targetMetrics, Fixed **masterMetrics,
  373.                                         Fixed *retCoords, Fixed *retWeightVector);
  374.         ATM_PASCAL ATMErr (*getNumBlessedFonts) ATM_PROTO1(short *numBlessedFonts);
  375.         ATM_PASCAL ATMErr (*getBlessedFontName) ATM_PROTO3(short i, StringPtr blessedFontName, Fixed *coords);
  376.         ATM_PASCAL ATMErr (*getRegularBlessedFont) ATM_PROTO1(short *regularIndex);
  377.         ATM_PASCAL ATMErr (*flushCache) ATM_PROTO1(void);
  378.         ATM_PASCAL ATMErr (*getFontFamilyFOND) ATM_PROTO2(StringPtr familyName, short *retFondID);
  379.         ATM_PASCAL ATMErr (*MMFontPicker) ATM_PROTO2(MMFP_Parms *parms, MMFP_Reply *reply);
  380.  
  381.         /* New for version 8 (with faux fonts) */
  382.         ATM_PASCAL Boolean (*isSubstFont) ATM_PROTO5(StringPtr fontName, short fondID, short style, FontSpecs ***fontSpecs, Handle *chamName);
  383.         ATM_PASCAL ATMErr (*spare02) ATM_PROTO1(void);          /* expansion */
  384.         ATM_PASCAL ATMErr (*getPSNum) ATM_PROTO3(StringPtr psName, short *retFondID, Boolean doCreate);
  385.         ATM_PASCAL ATMErr (*spare04) ATM_PROTO1(void);          /* expansion */
  386.         ATM_PASCAL ATMErr (*spare05) ATM_PROTO1(void);          /* expansion */
  387.         ATM_PASCAL ATMErr (*spare06) ATM_PROTO1(void);          /* expansion */
  388.         ATM_PASCAL ATMErr (*spare07) ATM_PROTO1(void);          /* expansion */
  389.         ATM_PASCAL ATMErr (*spare08) ATM_PROTO1(void);          /* expansion */
  390.         ATM_PASCAL ATMErr (*spare09) ATM_PROTO1(void);          /* expansion */
  391.         ATM_PASCAL ATMErr (*spare10) ATM_PROTO1(void);          /* expansion */
  392.         ATM_PASCAL ATMErr (*spare11) ATM_PROTO1(void);          /* expansion */
  393.         ATM_PASCAL ATMErr (*spare12) ATM_PROTO1(void);          /* expansion */
  394.         ATM_PASCAL ATMErr (*spare13) ATM_PROTO1(void);          /* expansion */
  395.         ATM_PASCAL ATMErr (*spare14) ATM_PROTO1(void);          /* expansion */
  396.         ATM_PASCAL ATMErr (*spare15) ATM_PROTO1(void);          /* expansion */
  397.         ATM_PASCAL ATMErr (*spare16) ATM_PROTO1(void);          /* expansion */
  398.         ATM_PASCAL ATMErr (*spare17) ATM_PROTO1(void);          /* expansion */
  399.         ATM_PASCAL ATMErr (*spare18) ATM_PROTO1(void);          /* expansion */
  400.         ATM_PASCAL ATMErr (*spare19) ATM_PROTO1(void);          /* expansion */
  401.         ATM_PASCAL ATMErr (*spare20) ATM_PROTO1(void);          /* expansion */
  402.         } ATMProcs5, ATMProcs8;
  403.  
  404. #define LATEST_VERSION ATMProcs8Version
  405. #define LATEST_PROCS ATMProcs8
  406.  
  407. /* **************** The following routines are available under ATMProcs3Version: **************** */
  408.  
  409. #ifdef __cplusplus
  410. extern "C" {
  411. #endif
  412.  
  413. /* Initializes ATMInterface for a given version, returns 1 if and only if that version
  414.         of the ATM interface is available */
  415. short initVersionATM(short);
  416.  
  417. /* Initializes ATMInterface for a given version, returns 1 if and only if that version
  418.         of the ATM interface is available with the Pascal interfaces */
  419. short initPascalVersionATM(short);
  420.  
  421. /* Returns 1 if and only if ATM can image the specified family and style */
  422. short fontAvailableATM(short family, short style);
  423.  
  424. /* Show length characters starting at text transformed by the specified matrix */
  425. /* Returns the number of characters not shown */
  426. /* Matrix maps one point character space to device space, relative to current pen position */
  427. /* Matrix's tx and ty components are updated */
  428. short showTextATM(Byte *text, short length, ATMFixedMatrix *matrix);
  429.  
  430. /* Show length characters starting at text transformed by the specified matrix */
  431. /* Matrix maps one point character space to device space, relative to current pen position */
  432. /* Matrix's tx and ty components are updated */
  433. /* Character x and y widths are specified by displacements */
  434. /* Returns the number of characters not shown */
  435. short xyshowTextATM(Byte *text, short length, ATMFixedMatrix *matrix, ATMFixed *displacements);
  436.  
  437. #ifdef __cplusplus
  438. }
  439. #endif
  440.  
  441. /* ****************************** end of ATMProcs3Version routines ****************************** */
  442.  
  443. /* **************** The following routines are available under ATMProcs4Version: **************** */
  444.  
  445. #ifdef __cplusplus
  446. extern "C" {
  447. #endif
  448.  
  449. /* Initializes ATMInterface for a given version, returns 1 if and only if that version
  450.         of the ATM interface is available */
  451. short initVersionATM(short);
  452.  
  453. /* Returns 1 if and only if ATM can image the specified family and style */
  454. short fontAvailableATM(short family, short style);
  455.  
  456. /* These error codes are returned by the routines below: */
  457. #define ATM_NOERR                       (0)             /* Normal return */
  458. #define ATM_NO_VALID_FONT       (-1)    /* can't find an outline font, or found a bad font - note that
  459.                                                                          * ATMGetOutline requires an outline font
  460.                                                                          * with exactly the current GrafPort's style(s) */
  461. #define ATM_CANTHAPPEN          (-2)    /* Internal ATM error */
  462. #define ATM_BAD_MATRIX          (-3)    /* Matrix inversion undefined or matrix too big */
  463. #define ATM_MEMORY                      (-4)    /* Ran out of memory */
  464. #define ATM_WRONG_VERSION       (-5)    /* currently installed ATM driver doesn't support this interface */
  465. #define ATM_NOT_ON                      (-6)    /* the ATM driver is missing or has been turned off */
  466. #define ATM_FILL_ORDER          (-7)    /* inconsistent fill calls, e.g. ATMFillMoveTo() without ATMStartFill() */
  467. #define ATM_CANCELLED           (-8)    /* the client halted an operation, e.g. a callback from ATMGetOutline returned 0 */
  468. #define ATM_NO_CHAR                     (-9)    /* the font does not have an outline for this character code */
  469. #define ATM_BAD_LENGTH          (-10)   /* ATMShowText() or ATMxyShowText() was called with length argument <= 0 or > 255 */
  470. #define ATM_PIC_SAVE            (-11)
  471. #define ATM_NOT_BLENDED_FONT (-12)      /* This font is not a blended font. */
  472. #define ATM_BASEDESIGN          (-13)   /* This operation is not allowed on a base design (eg. deleting FOND). */
  473. #define ATM_TEMPFONT_PROB       (-14)   /* We had a problem working with a temporary font. */
  474. #define ATM_ILL_OPER            (-15)   /* Can't perform this operation on this font. */
  475. #define ATM_FONTFIT_FAIL        (-16)   /* FontFit() failed (also from CopyFit()!). */
  476. #define ATM_MISS_BASEDESIGN     (-17)   /* Missing base design FOND. */
  477. #define ATM_NO_BLENDED_FONTS (-18)      /* no Multiple Master fonts installed */
  478. #define ATM_PICKER_CANCELLED (-19)      /* user hit Picker/Creator "Cancel" button */
  479. #define ATM_CREATE_FONT_FAIL (-20)      /* general font creation failure */
  480. #define ATM_DISK_FULL           (-21)   /* out of disk space */
  481. #define ATM_WRITE_PROTECTED     (-22)   /* volume or file is locked */
  482. #define ATM_IO_ERROR            (-23)   /* I/O error */
  483. #define ATM_COPY_PROT           (-24)   /* font is copy-protected */
  484. #define ATM_PROT_OUTLINE        (-25)   /* this outline is copy-protected */
  485.  
  486. /* new error code range so ATM error codes don't overrun any more OS error codes */
  487. #define ATM_SUBST_PROT          (-2627) /* font substitution is copy-protected */
  488. #define ATM_SUBST_DISABLED      (-2628) /* font substitution is turned off */
  489.  
  490. /* new error codes for ATM's font substitution database. */
  491. #ifndef DB_FILE_EXPIRED
  492. #define DB_FILE_EXPIRED       -2500     /* Database has expired (beta only) */
  493. #define DB_FILE_DAMAGED       -2501     /* Database has been damaged        */
  494. #define DB_FILE_MISSING       -2502     /* Font database missing            */
  495. #define DB_FILE_BUSY          -2503     /* Font database already in use     */
  496. #define DB_OUT_OF_MEMORY      -2504     /* Not enough memory for task       */
  497. #define DB_FONT_NOT_FOUND     -2505     /* Font not found in database       */
  498. #define DB_BAD_REF_NUM        -2506     /* Illegal ref_num sent to database */
  499. #define DB_BAD_VERSION        -2507     /* Requested version not available  */
  500. #define DB_NOT_A_MM_FONT      -2508     /* Font is not Multiple Master Font */
  501. #endif
  502.  
  503. /* Show length characters starting at text transformed by the specified matrix */
  504. /* Returns the number of characters not shown */
  505. /* Matrix maps one point character space to device space, relative to current pen position */
  506. /* Matrix's tx and ty components are updated */
  507. /* *errorCode is set to ATM_NOERR if all went well, otherwise to one of the above error codes */
  508. short showTextATMErr(Byte *text, short length, ATMFixedMatrix *matrix, short *errorCode);
  509.  
  510. /* Show length characters starting at text transformed by the specified matrix */
  511. /* Matrix maps one point character space to device space, relative to current pen position */
  512. /* Matrix's tx and ty components are updated */
  513. /* Character x and y widths are specified by displacements */
  514. /* Returns the number of characters not shown */
  515. /* *errorCode is set to ATM_NOERR if all went well, otherwise to one of the above error codes */
  516. short xyshowTextATMErr(Byte *text, short length, ATMFixedMatrix *matrix, ATMFixed *displacements, short *errorCode);
  517.  
  518. /* Get, via call-back procs, the PostScript definition of a character outline */
  519. /* The call-backs should return 1 if they wish to continue being called for the remainder */
  520. /* of the current character; they should return 0 if they wish to terminate getOutlineATM */
  521. /* Returns ATM_NOERR if successful, otherwise one of the ATM error codes */
  522. /* Matrix maps one point character space to device space */
  523. short getOutlineATM(short c, ATMFixedMatrix *matrix, Ptr clientHook,
  524.                                         short (*MoveTo)(/* Ptr clientHook, ATMPFixedPoint pc */),
  525.                                         short (*LineTo)(/* Ptr clientHook, ATMPFixedPoint pc */),
  526.                                         short (*CurveTo)(/* Ptr clientHook, ATMPFixedPoint pc1, ATMPFixedPoint pc2, ATMPFixedPoint pc3 */),
  527.                                         short (*ClosePath)(/* Ptr clientHook */));
  528.  
  529. /* Render the specified path according to the graphic state implicit in the current GrafPort */
  530. /* All these routines return ATM_NOERR if successful, otherwise one of the ATM error codes */
  531.  
  532. short startFillATM(void);
  533. short fillMoveToATM(ATMPFixedPoint pc);
  534. short fillLineToATM(ATMPFixedPoint pc);
  535. short fillCurveToATM(ATMPFixedPoint pc1, ATMPFixedPoint pc2, ATMPFixedPoint pc3);
  536. short fillClosePathATM(void);
  537. short endFillATM(void);
  538.  
  539. #ifdef __cplusplus
  540. }
  541. #endif
  542.  
  543. /* ****************************** end of ATMProcs4Version routines ****************************** */
  544.  
  545.  
  546. /* **************** The following routines are available under ATMProcs5Version: **************** */
  547.  
  548. #ifdef __cplusplus
  549. extern "C" {
  550. #endif
  551.  
  552. /* Returns TRUE if the specified font is a multi-master or "blended" font. */
  553. /* Uses the "fontName" if not NULL, otherwise looks at the fondID. */
  554. short getBlendedFontTypeATM(StringPtr fontName, short fondID);
  555.  
  556. /*
  557.  * Given a "familyName" (eg. "Minion") and coordinates in the design space, create
  558.  * a blended font name. This really isn't implemented well as it doesn't add labels (yet).
  559.  */
  560. ATMErr encodeBlendedFontNameATM(StringPtr familyName, short numAxes,
  561.                                 Fixed *coords, StringPtr blendName);
  562.  
  563. /*
  564.  * Given a "Blended" fontName (eg. "Minion_67 BLD 2 CND"), return coordinates
  565.  * in the design space and the font's family name. The "family name" is really
  566.  * just the stuff before the '_' (eg. "Minion"), and the display instance string
  567.  * is the stuff afterwards (eg. "67 BLD 2 CND"). The "family name" could be
  568.  * "AdobeSans", "Adobe Sans" or "AdobeSan", as the only criteria is that the
  569.  * PostScript filename ("AdobeSan") can be derived from it according to the
  570.  * 533 rule (use first 5 letters from the first word, and first 3 letters from
  571.  * every word afterwards.
  572.  *
  573.  * You may pass NULL for any of the return parameters.
  574.  *
  575.  */
  576. ATMErr decodeBlendedFontNameATM(StringPtr blendName, StringPtr familyName,
  577.                                 short *numAxes, Fixed *coords, StringPtr displayInstanceStr);
  578.  
  579. /*
  580.  * When the BOLD bit is set on a multiple master font, we may add a calculated amount
  581.  * to the WEIGHT axis (if any). This routines returns the new coordinates for any given
  582.  * Mac style for this font. Note that a font designer may not choose to modify the
  583.  * coordinates for the Bold, Condensed or Expanded bits, so these will return unchanged.
  584.  *
  585.  * Whatever styles a blended font design can't handle is returned in "stylesLeft", though
  586.  * these styles might be handled by QuickDraw (like Outline, Shadow, etc).
  587.  */
  588. ATMErr  addMacStyleToCoordsATM(Fixed *coords, short macStyle, Fixed *newCoords, short *stylesLeft);
  589.  
  590. /*
  591.  * Convert the design coordinates for the current font to a blend vector. This is necessary
  592.  * for those who need to output PostScript directlyÑthis is suitable for passing to
  593.  * the PostScript operator "makeBlendedFont".
  594.  */
  595. ATMErr convertCoordsToBlendATM(Fixed *coords, Fixed *weightVector);
  596.  
  597. /*
  598.  * Convert the design coordinates to a range usermin..usermax instead of 0.0..1.0.
  599.  */
  600. ATMErr normToUserCoordsATM(Fixed *normalCoords, Fixed *coords);
  601.  
  602. /*
  603.  * Convert the design coordinates to a range 0.0..1.0 instead of usermin..usermax.
  604.  */
  605. ATMErr userToNormCoordsATM(Fixed *coords, Fixed *normalCoords);
  606.  
  607. /*
  608.  * Create a temporary blended font for user interface purposes (so users can choose a blend).
  609.  * The first time, initialize "*useFondID" to zero and a new fondID will be returned.
  610.  * While displaying various blends, use the returned value in "*useFondID" until the user
  611.  * is satisfied. Then dispose of this font with disposeTempBlendedFontATM().
  612.  * Don't expect the name of the font to be what you gave it, we may change it for internal reasons.
  613.  */
  614. ATMErr createTempBlendedFontATM(short numAxes, Fixed *coords, short *useFondID);
  615. ATMErr disposeTempBlendedFontATM(short fondID);
  616.  
  617. /*
  618.  * Create a permanent blended font, of a given size in the given font file.
  619.  * Note that the zero-sized case is the only one supported, which will create a "dummy"
  620.  * 10 point font.
  621.  */
  622. ATMErr createPermBlendedFontATM(StringPtr fontName, short fontSize, short fontFileID, short *retFondID);
  623. ATMErr disposePermBlendedFontATM(short fondID);
  624.  
  625. /*
  626.  * We store newly created fonts in a temporary file. If you wish to use it (ie, for the
  627.  * above routines), feel free.
  628.  */
  629. ATMErr getTempBlendedFontFileIDATM(short *fileID);
  630.  
  631. /*
  632.  * Given the family name (eg. "Minion") and axis ID, return the number of axes.
  633.  */
  634. ATMErr getNumAxesATM(short *numAxes);
  635.  
  636. /*
  637.  * Get the number of base designs (useful for the "CopyFit" routine, below).
  638.  */
  639. ATMErr getNumMastersATM(short *numMasters);
  640.  
  641. /*
  642.  * Get the i'th base design for the given multiple master font (useful for the "CopyFit"
  643.  * routine, below).
  644.  */
  645. ATMErr getMasterFONDATM(short i, short *masterFOND);
  646.  
  647. /*
  648.  * Used to choose a multiple-master instance that will match the given widths.
  649.  * First, fill in the baseWidths array with the width of the string for each one of
  650.  * the base designs. Then choose a method for us to follow (default, constantStems, varStems).
  651.  * Give us the targetWidth you want your string and the "beginDesign", which says what your
  652.  * original coords were. We will return the best fit we could find in resultDesign, and
  653.  * the actual width in resultWidth.
  654.  */
  655. ATMErr copyFitATM(short method, Fixed TargetWidth, Fixed *beginDesign,
  656.                                         Fixed *baseWidths, Fixed *resultWidth, Fixed *resultDesign);
  657.  
  658. /*
  659.  * This extends previous "ShowText" calls so that we can display strings without ever
  660.  * creating an explicit FOND (eventually). For the moment, "fontFamily" is ignored, and
  661.  * should be passed NULL (this is for future expansion).  Pass NULL for "coords" unless
  662.  * this is a multiple master font. If "displacements" is NULL then we use the widths from
  663.  * the FOND/NFNT; otherwise "displacements" gives us the x and y deltas between each
  664.  * character.
  665.  */
  666. ATMErr showTextDesignATM(StringPtr fontFamily, Byte *text, short len, ATMFixedMatrix *matrix,
  667.                                 Fixed *coords, Fixed *displacements, short *lenDisplayed);
  668.  
  669. /*
  670.  * Given the family name (eg. "Minion") and axis ID, return information about the axis.
  671.  * Axis numbers start with 1.
  672.  *              userMin, userMax -      Lowest and highest values allowed on this axis.
  673.  *              axisType -                      Type of axis. Examples are "Weight" for the weight axis and
  674.  *                                                      "Width" for the axis modifying width.
  675.  *              axisLabel -                     What to label the axis (eg. "Weight").
  676.  *              numSubranges -          How many labels for subranges there are (ie. Light, Medium, Bold).
  677.  * NOTE: passing NULL for any of the parameters ignores that parameter. Thus you don't always
  678.  * have to get ALL the information if you only want a little.
  679.  */
  680. ATMErr getAxisBlendInfoATM(short axis, short *userMin, short *userMax, StringPtr axisType,
  681.                                         StringPtr axisLabel, StringPtr axisShortLabel);
  682.  
  683. /*
  684.  * Get the specifications about the current font; this information can be used with
  685.  * fontFitATM(), below.
  686.  */
  687. ATMErr getFontSpecsATM(FontSpecs *specs);
  688.  
  689. /*
  690.  * This routine does some amazing calculations, and is the center of the code for dealing
  691.  * with copyfitting and other of the fancier multiple master operations. The current font
  692.  * and the "origCoords" is given to, for example, adjust a line typed in a multiple master
  693.  * typeface so that it exactly matches a given set of dimensions; here we will use string length
  694.  * and stem width.
  695.  *
  696.  * The numTargets is 2 (one for string length and one for stem width). The first entry in
  697.  * "targetMetrics" is the length you want the text to be (ie. the width of a column), and the
  698.  * second what you want the stem width to be (get this information from getFontSpecsATM(), above).
  699.  * The first entry in masterMetrics is a pointer to the widths of the strings at each master
  700.  * design (loop through the masters using getMasterFONDATM()). The second entry in masterMetrics
  701.  * is the stemwidths for each master design. fontFitATM tries to find the closest match
  702.  * possible by adjusting the axes given in varyAxes, and returns the results in retCoords
  703.  * and retWeightVector--if either argument is NULL, it is ignored. To get the axis id's, use
  704.  * getAxisBlendInfoATM and look for the "axisType". A list of type strings will be given (soon?).
  705.  */
  706. ATMErr fontFitATM(Fixed *origCoords, short numTargets, short *varyAxes,
  707.                                 Fixed *targetMetrics, Fixed **masterMetrics,
  708.                                 Fixed *retCoords, Fixed *retWeightVector);
  709.  
  710. /*
  711.  * There are a number of font instances for each multiple-master family that have been
  712.  * "blessed" by our Type group to go well together. The font names for this group can be
  713.  * gotten through the following calls: getNumBlessedFonts, getBlessedFontName, and
  714.  * getRegularBlessedFont. Most applications will not need these calls....
  715.  *
  716.  * getNumBlessedFontsATM() finds how many "blessed" fonts exist.
  717.  */
  718. ATMErr getNumBlessedFontsATM(short *numBlessedFonts);
  719.  
  720. /*
  721.  * Get the nth "blessed" font name (see above discussion). "i" is indexed from 1.
  722.  */
  723. ATMErr getBlessedFontNameATM(short i, StringPtr blessedFontName, Fixed *coords);
  724.  
  725. /*
  726.  * When Adobe Illustrator and Adobe Type Reunion display a list of instances for a
  727.  * multiple master family, a "reasonable" choice for the default is chosen. The choice
  728.  * is given by this call. Essentially, this finds the equivalent of "Helvetica Regular"
  729.  * for multiple master fonts.
  730.  *
  731.  * The returned value "regularID" is to be used as input to getBlessedFontName.
  732.  */
  733. ATMErr getRegularBlessedFontATM(short *regularID);
  734.  
  735. /*
  736.  * This flushes ATM's font cache. This is basically the counterpart for System 7's
  737.  * FlushFonts function.
  738.  */
  739. ATMErr flushCacheATM(void);
  740.  
  741. /*
  742.  * When using many of the above calls for working with multiple master fonts, ATM
  743.  * expects the current font to be set to a font in the font family. What happens if
  744.  * you only have a font family name?  This routine will return a fondID that is usable
  745.  * to handle information for that font family.
  746.  */
  747. ATMErr getFontFamilyFONDATM(StringPtr familyName, short *retFondID);
  748.  
  749. /*
  750.  * Multiple Master Font Picker/Creator interface.
  751.  *
  752.  * This call displays a dialog allowing the user to navigate through the
  753.  * design space of any installed Multiple Master font and to pick and/or
  754.  * create an instance within that design space.  The caller receives
  755.  * information about the user's selection, if any.
  756.  *
  757.  * See MMFP_Parms and MMFP_Reply definitions, above, for a full description.
  758.  */
  759. ATMErr MMFontPickerATM( MMFP_Parms *parms, MMFP_Reply *reply );
  760.  
  761. /* Used internally by ATM, don't use.  */
  762. void disableATM(void);
  763. void reenableATM(void);
  764.  
  765. /* ****************************** end of ATMProcs5Version routines ****************************** */
  766.  
  767. /* **************** The following routines are available under ATMProcs8Version: **************** */
  768. /*
  769.  * Returns TRUE if this is a substitute font.
  770.  * If TRUE and fontSpecs != NULL, fontSpecs will return a handle to the
  771.  * fontSpecs record in the file. It is up to the caller to dispose of this
  772.  * handle when done.
  773.  * if TRUE and chamName != NULL, chamName will return a handle containing the
  774.  * PostScript name of the chameleon font used for substitution. It is up to
  775.  * the caller to dispose of this handle when done.
  776.  * If fontName is NULL, we use the "fondID" parameter; otherwise, the fondID
  777.  * parameter is ignored.
  778.  */
  779. Boolean isSubstFontATM(StringPtr fontName, short fondID, short style, FontSpecs ***fontSpecs, Handle *chamName);
  780.  
  781. /*
  782.  * If the PostScript name is in our database then create its FOND if the parameter
  783.  * "doCreate" is TRUE. It's expected that doCreate will generally be TRUE, but we've
  784.  * added the flexibility just in case an application wants to ask permission
  785.  * before creating the file.
  786.  *
  787.  * The application MUST check to see if a matching FOND already exists as this
  788.  * function will create a FOND every time.
  789.  *
  790.  * Note that this function does NOT provide a mapping between PostScript names and
  791.  * their associated FOND id and style--this must be implemented by the application.
  792.  */
  793. ATMErr getPSNumATM(StringPtr psName, short *retFondID, Boolean doCreate);
  794.  
  795. #ifdef __cplusplus
  796. }
  797. #endif
  798.  
  799. /* ****************************** end of ATMProcs8Version routines ****************************** */
  800.  
  801. #endif  /* _H_ATMInterface */
  802.