home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 21 / macformat_21.iso / Shareware / Programación / VideoToolbox / VideoToolboxSources / ATMInterface.3.h < prev    next >
Text File  |  1994-11-15  |  38KB  |  808 lines

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