home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: SysTools / SysTools.zip / ft-beta.zip / freetype / lib / ttobjs.h < prev    next >
C/C++ Source or Header  |  1997-10-06  |  30KB  |  738 lines

  1. /*******************************************************************
  2.  *
  3.  *  ttobjs.h                                                     1.0
  4.  *
  5.  *    Objects definition unit.
  6.  *
  7.  *  Copyright 1996, 1997 by
  8.  *  David Turner, Robert Wilhelm, and Werner Lemberg.
  9.  *
  10.  *  This file is part of the FreeType project, and may only be used
  11.  *  modified and distributed under the terms of the FreeType project
  12.  *  license, LICENSE.TXT. By continuing to use, modify or distribute
  13.  *  this file you indicate that you have read the license and
  14.  *  understand and accept it fully.
  15.  *
  16.  ******************************************************************/
  17.  
  18. #ifndef TTOBJS_H
  19. #define TTOBJS_H
  20.  
  21. #include "ttcommon.h"
  22. #include "ttengine.h"
  23. #include "tterror.h"
  24. #include "ttmutex.h"
  25. #include "ttcache.h"
  26. #include "tttables.h"
  27. #include "ttcmap.h"
  28.  
  29.   #ifdef __cplusplus
  30.   extern "C" {
  31.   #endif
  32.  
  33. /*                                                                       */
  34. /*  This files contains the definitions and methods of the four          */
  35. /*  kinds of objects managed by the FreeType engine. These are :         */
  36. /*                                                                       */
  37. /*                                                                       */
  38. /*   Face objects :                                                      */
  39. /*                                                                       */
  40. /*     There is always one face object per opened TrueType font          */
  41. /*     file, and only one. The face object contains data that is         */
  42. /*     independent of current transform/scaling/rotation and             */
  43. /*     pointsize, or glyph index. This data is made of several           */
  44. /*     critical tables that are loaded on face object creation.          */
  45. /*                                                                       */
  46. /*     A face object tracks all active and recycled objects of           */
  47. /*     the instance and execution context classes. Destroying a face     */
  48. /*     object will automatically destroy all associated instances        */
  49. /*                                                                       */
  50. /*                                                                       */
  51. /*   Instance objects :                                                  */
  52. /*                                                                       */
  53. /*     An instance object always relates to a given face object,         */
  54. /*     known as its 'parent' or 'owner', and contains only the           */
  55. /*     data that is specific to one given pointsize/transform of         */
  56. /*     the face. You can only create an instance from a face object.     */
  57. /*                                                                       */
  58. /*     An instance's current transform/pointsize can be changed          */
  59. /*     any time using a singly high-level API call.                      */
  60. /*     ( TT_Reset_Instance )                                             */
  61. /*                                                                       */
  62. /*   Execution Context objects :                                         */
  63. /*                                                                       */
  64. /*     An execution context (or context in short) relates to a face      */
  65. /*     It contains the data and tables that are necessary to load        */
  66. /*     and hint (i.e. execute the glyph instructions of) one glyph.      */
  67. /*     A context is a transient object that is queried/created on        */
  68. /*     the fly : client applications never deal with them directly.      */
  69. /*                                                                       */
  70. /*                                                                       */
  71. /*   Glyph objects :                                                     */
  72. /*                                                                       */
  73. /*     A glyph object contains only the minimal glyph information        */
  74. /*     needed to render one glyph correctly. This means that a glyph     */
  75. /*     object really contains tables that are sized to hold the          */
  76. /*     contents of _any_ glyph of a given face. A client application     */
  77. /*     can usually create one glyph object for a given face, then use    */
  78. /*     it for all subsequent loads.                                      */
  79. /*                                                                       */
  80. /*   Here is an example of a client application :                        */
  81. /*   ( NOTE : No error checking performed here !! )                      */
  82. /*                                                                       */
  83. /*                                                                       */
  84. /*     TT_Face       face;         -- face handle                        */
  85. /*     TT_Instance   ins1, ins2;   -- two instance handles               */
  86. /*     TT_Glyph      glyph;        -- glyph handle                       */
  87. /*                                                                       */
  88. /*     TT_Init_FreeType();                                               */
  89. /*                                                                       */
  90. /*     -- Initialize the engine. This must be done prior to _any_        */
  91. /*     -- operation.                                                     */
  92. /*                                                                       */
  93. /*     TT_Open_Face( "/some/face/name.ttf", &face );                     */
  94. /*                                                                       */
  95. /*     -- create the face object. This call opens the font file          */
  96. /*                                                                       */
  97. /*     TT_New_Instance( face, &ins1 );                                   */
  98. /*     TT_New_Instance( face, &ins2 );                                   */
  99. /*                                                                       */
  100. /*     TT_Set_Instance_PointSize( ins1, 8 );                             */
  101. /*     TT_Set_Instance_PointSize( ins2, 12 );                            */
  102. /*                                                                       */
  103. /*     -- creates two distinct instances of the same face                */
  104. /*     -- ins1  is pointsize 8 at resolution 96 dpi                      */
  105. /*     -- ins2  is pointsize 12 at resolution 96 dpi                     */
  106. /*                                                                       */
  107. /*     TT_New_Glyph( face, &glyph );                                     */
  108. /*                                                                       */
  109. /*     -- create a new glyph object which will receive the contents      */
  110. /*     -- of any glyph of 'face'                                         */
  111. /*                                                                       */
  112. /*     TT_Load_Glyph( ins1, glyph, 64, DEFAULT_GLYPH_LOAD );             */
  113. /*                                                                       */
  114. /*     -- load glyph indexed 64 at pointsize 8 in the 'glyph' object     */
  115. /*     -- NOTE : This call will fail if the instance and the glyph       */
  116. /*     --        do not relate to the same face object.                  */
  117. /*                                                                       */
  118. /*     TT_Get_Outline( glyph, &outline );                                */
  119. /*                                                                       */
  120. /*     -- extracts the glyph outline from the object and copies it       */
  121. /*     -- to the 'outline' record..                                      */
  122. /*                                                                       */
  123. /*     TT_Get_Metrics( glyph, &metrics );                                */
  124. /*                                                                       */
  125. /*     -- extracts the glyph metrics and put them into the 'metrics'     */
  126. /*     -- record                                                         */
  127. /*                                                                       */
  128. /*     TT_Load_Glyph( ins2, glyph, 64, DEFAULT_GLYPH_LOAD );             */
  129. /*                                                                       */
  130. /*     -- load the same glyph at pointsize 12 in the 'glyph' object      */
  131. /*                                                                       */
  132. /*                                                                       */
  133. /*     TT_Close_Face( &face );                                           */
  134. /*                                                                       */
  135. /*     -- destroys the face object. This will destroy 'ins1' and         */
  136. /*     -- 'ins2'. However, the glyph object will still be available      */
  137. /*                                                                       */
  138. /*     TT_Done_FreeType();                                               */
  139. /*                                                                       */
  140. /*     -- Finalize the engine. This will also destroy all pending        */
  141. /*     -- glyph objects (here 'glyph').                                  */
  142. /*                                                                       */
  143. /*                                                                       */
  144.  
  145.   struct _TFace;
  146.   struct _TInstance;
  147.   struct _TExecution_Context;
  148.   struct _TGlyph;
  149.  
  150.   typedef struct _TFace  TFace, 
  151.                         *PFace;
  152.  
  153.   typedef struct _TInstance  TInstance, 
  154.                             *PInstance;
  155.  
  156.   typedef struct _TExecution_Context  TExecution_Context, 
  157.                                      *PExecution_Context;
  158.  
  159.   typedef struct _TGlyph  TGlyph,
  160.                          *PGlyph;
  161.  
  162.   /*************************************************************/
  163.   /*                                                           */
  164.   /*  ADDITIONAL SUBTABLES                                     */
  165.   /*                                                           */
  166.   /*  These tables are not precisely defined by the specs      */
  167.   /*  but their structures is implied by the TrueType font     */
  168.   /*  file layout..                                            */
  169.   /*                                                           */
  170.   /*************************************************************/
  171.  
  172.   /* Graphics State                            */
  173.   /*                                           */
  174.   /* The Graphics State (GS) is managed by the */
  175.   /* instruction field, but does not come from */
  176.   /* the font file. Thus, we can use 'int's    */
  177.   /* where needed.                             */
  178.  
  179.   typedef struct  _TGraphicsState
  180.   {
  181.     Int         rp0;
  182.     Int         rp1;
  183.     Int         rp2;
  184.  
  185.     TT_UnitVector  dualVector;
  186.     TT_UnitVector  projVector;
  187.     TT_UnitVector  freeVector;
  188.  
  189.     Long        loop;
  190.     TT_F26Dot6  minimum_distance;
  191.     Int         round_state;
  192.  
  193.     Bool        auto_flip;
  194.     TT_F26Dot6  control_value_cutin;
  195.     TT_F26Dot6  single_width_cutin;
  196.     TT_F26Dot6  single_width_value;
  197.     Int         delta_base;
  198.     Int         delta_shift;
  199.  
  200.     Byte        instruct_control;
  201.     Bool        scan_control;
  202.     Int         scan_type;
  203.  
  204.     Int         gep0;
  205.     Int         gep1;
  206.     Int         gep2;
  207.  
  208.   } TGraphicsState;
  209.  
  210.   extern const TGraphicsState  Default_GraphicsState;
  211.  
  212.   /*************************************************************/
  213.   /*                                                           */
  214.   /*  EXECUTION SUBTABLES                                      */
  215.   /*                                                           */
  216.   /*  These sub-tables relate to instruction execution         */
  217.   /*                                                           */
  218.   /*************************************************************/
  219.  
  220.   #define MAX_CODE_RANGES   3
  221.  
  222.   /* There can only be 3 active code ranges at once:   */
  223.   /*   - the Font Program                              */
  224.   /*   - the CVT Program                               */
  225.   /*   - a glyph's instructions set                    */
  226.  
  227.   #define TT_CodeRange_Font  1
  228.   #define TT_CodeRange_Cvt   2
  229.   #define TT_CodeRange_Glyph 3
  230.  
  231.   typedef struct  _TCodeRange
  232.   {
  233.     PByte  Base;
  234.     Int    Size;
  235.   } TCodeRange;
  236.  
  237.   typedef TCodeRange*  PCodeRange;
  238.  
  239.   /* Defintion of a code range                                       */
  240.   /*                                                                 */
  241.   /* Code ranges can be resident to a glyph (i.e. the Font Program)  */
  242.   /* while some others are volatile (Glyph instructions).            */
  243.   /* Tracking the state and presence of code ranges allows function  */
  244.   /* and instruction definitions within a code range to be forgotten */
  245.   /* when the range is discarded.                                    */
  246.  
  247.   typedef TCodeRange  TCodeRangeTable[MAX_CODE_RANGES];
  248.  
  249.   /* defines a function/instruction definition record */
  250.  
  251.   typedef struct  _TDefRecord
  252.   {
  253.     Int   Range;      /* in which code range is it located ? */
  254.     Int   Start;      /* where does it start ?               */
  255.     Byte  Opc;        /* function #, or instruction code     */
  256.     Bool  Active;     /* is it active ?                      */
  257.   } TDefRecord;
  258.  
  259.   typedef TDefRecord*  PDefArray;
  260.  
  261.   /* defines a call record, used to manage function calls. */
  262.   typedef struct  _TCallRecord
  263.   {
  264.     Int  Caller_Range;
  265.     Int  Caller_IP;
  266.     Int  Cur_Count;
  267.     Int  Cur_Restart;
  268.   } TCallRecord;
  269.  
  270.   /* defines a simple call stack */
  271.   typedef TCallRecord*  PCallStack;
  272.  
  273.   
  274. #ifndef TT_STATIC_INTEPRETER  /* indirect implementation */
  275.  
  276.   #define EXEC_OPS   PExecution_Context exc,
  277.   #define EXEC_OP    PExecution_Context exc
  278.   #define EXEC_ARGS  exc,
  279.   #define EXEC_ARG   exc
  280.   
  281. #else                          /* static implementation */
  282.  
  283.   #define EXEC_OPS   /* void */
  284.   #define EXEC_OP    /* void */
  285.   #define EXEC_ARGS  /* void */
  286.   #define EXEC_ARG   /* void */
  287.   
  288. #endif
  289.  
  290.   typedef  TT_F26Dot6 (*TRound_Function)( EXEC_OPS TT_F26Dot6 distance,
  291.                                                    TT_F26Dot6 compensation );
  292.   /* Rounding function, as used by the interpreter */
  293.  
  294.   typedef  void (*TMove_Function)( EXEC_OPS PVecRecord  zone,
  295.                                             Int         point,
  296.                                             TT_F26Dot6  distance );
  297.   /* Point displacement along the freedom vector routine, as */
  298.   /* used by the interpreter                                 */
  299.  
  300.   typedef  TT_F26Dot6 (*TProject_Function)( EXEC_OPS TT_F26Dot6 Vx,
  301.                                                      TT_F26Dot6 Vy );
  302.   /* Distance projection along one of the proj. vectors, as used */
  303.   /* by the interpreter                                          */
  304.   
  305.   struct _TGlyph_Transform
  306.   {
  307.     TT_Fixed    xx, xy; /* transofrmation */
  308.     TT_Fixed    yx, yy; /*     matrix     */
  309.     TT_F26Dot6  ox, oy; /*    offsets     */
  310.   };
  311.   /* subglyph transformation record */
  312.  
  313.   typedef struct _TGlyph_Transform  TGlyph_Transform;
  314.   typedef TGlyph_Transform         *PGlyph_Transform;
  315.  
  316.   struct _TSubglyph_Record
  317.   {
  318.     Int           index;      /* subglyph index */
  319.     Bool          is_scaled;  /* is the subglyph scaled ? */
  320.     Bool          is_hinted;  /* should it be hinted ?    */
  321.  
  322.     Int           xMin, xMax, yMin, yMax;
  323.  
  324.     Long          file_offset;
  325.  
  326.     Int           n_contours; /* number of contours                        */
  327.     Int           n_points;   /* number of points (excluding phantom ones) */
  328.  
  329.     PCoordinates  org_x;
  330.     PCoordinates  org_y;
  331.     PCoordinates  cur_x;
  332.     PCoordinates  cur_y;
  333.     PTouchTable   flag;
  334.     PUShort       contours;
  335.  
  336.     Int           arg1;  /* first argument  */
  337.     Int           arg2;  /* second argument */
  338.  
  339.     Int           element_flag;  /* loaded element flag */
  340.  
  341.     TGlyph_Transform   transform;  /* transform */
  342.  
  343.     Int           leftSideBearing; /* in FUnits */
  344.     Int           advanceWidth;    /* in FUnits */
  345.   };
  346.   /* subglyph loading record. Used to load composite components */
  347.  
  348.   typedef struct _TSubglyph_Record  TSubglyph_Record;
  349.   typedef TSubglyph_Record*         PSubglyph_Record;
  350.   typedef TSubglyph_Record*         PSubglyph_Stack;
  351.  
  352.  
  353.   struct _TIns_Metrics
  354.   {
  355.     TT_F26Dot6   pointSize;      /* point size. 1 point = 1/72 inch. */
  356.  
  357.     Int          x_resolution;   /* device horizontal resolution in dpi. */
  358.     Int          y_resolution;   /* device vertical   resolution in dpi. */
  359.  
  360.     Int          x_ppem;         /* horizontal pixels per EM */
  361.     Int          y_ppem;         /* vertical   pixels per EM */
  362.  
  363.     Long         x_scale1;
  364.     Long         x_scale2; /* used to scale FUnits to fractional pixels */
  365.  
  366.     Long         y_scale1;
  367.     Long         y_scale2; /* used to scale FUnits to fractional pixels */
  368.  
  369.     TT_F26Dot6   compensations[4];  /* device-specific compensations */
  370.  
  371.     Bool         rotated;        /* is the glyph rotated ? flag   */
  372.     Bool         stretched;      /* is the glyph stretched ? flag */
  373.   };
  374.   typedef struct _TIns_Metrics  TIns_Metrics;
  375.   /* metrics used by the instance and execution context objects */
  376.  
  377.   /***********************************************************************/
  378.   /*                                                                     */
  379.   /*                         FreeType Face Type                          */
  380.   /*                                                                     */
  381.   /***********************************************************************/
  382.  
  383.   struct _TFace
  384.   {
  385.     PList_Element  element;
  386.     /* list element node, used by the library to track */
  387.     /* all opened faces, as well as recycled resident  */
  388.     /* records..                                       */
  389.  
  390.     TT_Stream      stream;
  391.     /* i/o stream */
  392.  
  393.     TMutex         lock;
  394.     /* used only by the threaded builds of the library */
  395.  
  396.     TTTCHeader     ttcHeader;
  397.     /* TrueType collection header, if any was found */
  398.  
  399.     TMaxProfile    maxProfile;
  400.     /* maximum profile table, as found in the TrueType file */
  401.  
  402.     /* Note :                                         */
  403.     /*  it seems that some maximum values cannot be   */
  404.     /*  taken directly from this table, but rather by */
  405.     /*  combining some of its fields ( e.g. the max.  */
  406.     /*  number of points seems to be given by         */
  407.     /*   MAX( maxPoints, maxCompositePoints )         */
  408.     /*                                                */
  409.     /*  For this reason, we define later our own      */
  410.     /*  max values that are used to load and allocate */
  411.     /*  further tables..                              */
  412.  
  413.     TT_Header             fontHeader;
  414.     /* the font header, as found in the trueType file */
  415.  
  416.     TT_Horizontal_Header  horizontalHeader;
  417.     /* the horizontal header */
  418.  
  419.     TT_OS2                os2;
  420.     /* 'OS/2' table */
  421.  
  422.     TT_Postscript         postscript;
  423.     /* 'Post' table */
  424.  
  425.     TName_Table       nameTable;
  426.     /* name table */
  427.  
  428.     Int               numTables;
  429.     PTableDirEntry    dirTables;
  430.     /* The directory of TrueType tables for this typeface */
  431.  
  432.     Int          numCMaps;
  433.     PCMapTable   cMaps;
  434.     /* The directory of character mappings table for */
  435.     /* this typeface                                 */
  436.  
  437.     Int       numLocations;
  438.     PStorage  glyphLocations;
  439.     /* The glyph locations table */
  440.  
  441.     PTableHorMetrics  longHMetrics;
  442.     PShort            shortMetrics;
  443.     /* The HMTX table data, used to compute both left */
  444.     /* side bearing and advance width for all glyphs  */
  445.  
  446.     Int    fontPgmSize;
  447.     PByte  fontProgram;
  448.     /* the font program, if any */
  449.  
  450.     Int    cvtPgmSize;
  451.     PByte  cvtProgram;
  452.     /* the cvt program, if any */
  453.  
  454.     Int    cvtSize;
  455.     PShort cvt;
  456.     /* the original, unscaled, control value table */
  457.  
  458.     TGasp  gasp;
  459.     /* the 'gasp' table */
  460.  
  461.     /* The following values _must_ be set by the */
  462.     /* maximum progile loader                    */
  463.  
  464.     Int   numGlyphs;
  465.     /* the face's total number of glyphs */
  466.  
  467.     Int   maxPoints;
  468.     /* max glyph points number, simple and composite */
  469.  
  470.     Int   maxContours;
  471.     /* max glyph contours number, simple and composite */
  472.  
  473.     Int   maxComponents;
  474.     /* max components in a composite glyph */
  475.  
  476.     /* the following are object caches to track active */
  477.     /* and recycled instances and execution contexts   */
  478.     /* objects. See 'ttcache.h'                        */
  479.  
  480.     TCache  instances;
  481.     /* current instances for this face */
  482.  
  483.     TCache  contexts;
  484.     /* current execution contexts for this face */
  485.  
  486.     void*   extension;
  487.     /* A typeless pointer to the face object extensions defined */
  488.     /* in the 'c/lib/extend/ttext.*' files.                     */
  489.  
  490.     /* Use extensions to provide additional capabilities to the */
  491.     /* engine. Read the developer's guide in the documentation  */
  492.     /* dirctory to known how to do that..                       */
  493.   };
  494.  
  495.  
  496.   /***********************************************************************/
  497.   /*                                                                     */
  498.   /*                       FreeType Instance Type                        */
  499.   /*                                                                     */
  500.   /***********************************************************************/
  501.  
  502.  
  503.   struct  _TInstance
  504.   {
  505.     PFace            owner;     /* face object */
  506.  
  507.     Bool             valid;
  508.  
  509.     TIns_Metrics     metrics;
  510.  
  511.     Int              numFDefs; /* number of function definitions */
  512.     PDefArray        FDefs;    /* table of FDefs entries         */
  513.  
  514.     Int              numIDefs; /* number of instruction definitions */
  515.     PDefArray        IDefs;    /* table if IDefs entries            */
  516.  
  517.     TCodeRangeTable  codeRangeTable;
  518.  
  519.     TGraphicsState   GS;
  520.     TGraphicsState   default_GS;
  521.  
  522.     Int              cvtSize;
  523.     PLong            cvt;
  524.     /* the scaled control value table */
  525.  
  526.     /* debugging variables */
  527.  
  528.     Bool                debug;
  529.     PExecution_Context  context;
  530.  
  531.     /* When using the debugger, we must keep the */
  532.     /* execution context tied to the instance    */
  533.     /* object rather than asking it on demand    */
  534.   };
  535.  
  536.   /***********************************************************************/
  537.   /*                                                                     */
  538.   /*                  FreeType Execution Context Type                    */
  539.   /*                                                                     */
  540.   /***********************************************************************/
  541.  
  542.   struct _TExecution_Context 
  543.   {
  544.     PFace       owner;
  545.     PInstance   instance;
  546.  
  547.     /* instructions state */
  548.  
  549.     Int          error;     /* last execution error */
  550.   
  551.     Int          curRange;  /* current code range number   */
  552.     PByte        code;      /* current code range          */
  553.     Int          IP;        /* current instruction pointer */
  554.     Int          codeSize;  /* size of current range       */
  555.   
  556.     Byte         opcode;    /* current opcode              */
  557.     Int          length;    /* length of current opcode    */
  558.   
  559.     Bool         step_ins;  /* true if the interpreter must */
  560.                             /* increment IP after ins. exec */
  561.   
  562.     Int          numFDefs;  /* number of function defs */
  563.     TDefRecord*  FDefs;     /* table of FDefs entries  */
  564.   
  565.     Int          numIDefs;  /* number of instruction defs */
  566.     TDefRecord*  IDefs;     /* table of IDefs entries     */
  567.  
  568.     PByte        glyphIns;  /* glyph instructions buffer */
  569.     Int          glyphSize; /* glyph instructions buffer size */
  570.   
  571.     Int          callTop,    /* top of call stack during execution */
  572.                  callSize;   /* size of call stack */
  573.     TCallRecord* callStack;  /* call stack */
  574.   
  575.     TCodeRangeTable codeRangeTable;  /* table of valid coderanges */
  576.                                      /* useful for the debugger   */
  577.   
  578.     Int          storeSize;  /* size of current storage */
  579.     PStorage     storage;    /* storage area            */
  580.   
  581.     Int          stackSize;  /* size of exec. stack */
  582.     Int          top;        /* top of exec. stack  */
  583.     PStorage     stack;      /* current exec. stack */
  584.   
  585.     Int          args,
  586.                  new_top;    /* new top after exec.    */
  587.   
  588.     TT_F26Dot6   period;     /* values used for the */
  589.     TT_F26Dot6   phase;      /* 'SuperRounding'     */
  590.     TT_F26Dot6   threshold;
  591.  
  592.     TIns_Metrics metrics;       /* instance metrics */
  593.  
  594.     Int          cur_ppem;       /* ppem along the current proj vector */
  595.     Long         scale1;         /* scaling values along the current   */
  596.     Long         scale2;         /* projection vector too..            */
  597.     Bool         cached_metrics; /* the ppem is computed lazily. used  */
  598.                                   /* to trigger computation when needed */
  599.  
  600.     TVecRecord   zp0,  /* zone records */
  601.                  zp1,
  602.                  zp2,
  603.                  pts,
  604.                  twilight;
  605.   
  606.     Int          numContours; /* number of contours in current glyph */
  607.     PUShort      endContours; /* array of contours' end-points       */
  608.   
  609.     Bool         instruction_trap;  /* If True, the interpreter will */
  610.                                     /* exit after each instruction   */
  611.  
  612.     TGraphicsState  GS;          /* current graphics state */
  613.  
  614.     TGraphicsState  default_GS;  /* graphics state resulting from */
  615.                                  /* the prep program              */
  616.     Int          cvtSize;
  617.     PLong        cvt;
  618.   
  619.     /* latest interpreter additions */
  620.   
  621.     Long         F_dot_P; /* dot product of freedom and projection vectors */
  622.   
  623.     TRound_Function   func_round;     /* current rounding function */
  624.     
  625.     TProject_Function func_project,   /* current projection function */
  626.                       func_dualproj,  /* current dual proj. function */
  627.                       func_freeProj;  /* current freedom proj. func  */
  628.  
  629.     TMove_Function    func_move;      /* current point move function */
  630.  
  631.     PSubglyph_Stack   loadStack;      /* loading subglyph stack */
  632.   };
  633.  
  634.   /***********************************************************************/
  635.   /*                                                                     */
  636.   /*                  FreeType Glyph Object Type                         */
  637.   /*                                                                     */
  638.   /***********************************************************************/
  639.  
  640.   struct _TGlyph
  641.   {
  642.     PFace       face;
  643.  
  644.     TT_F26Dot6  xMin;  /* glyph bounding box */
  645.     TT_F26Dot6  yMin;
  646.     TT_F26Dot6  xMax;
  647.     TT_F26Dot6  yMax;
  648.  
  649.     TT_F26Dot6  leftSideBearing;
  650.     TT_F26Dot6  advanceWidth;
  651.  
  652.     Int         scan_type;
  653.     Int         high_precision;
  654.  
  655.     Int           num_points;
  656.     Int           num_contours;
  657.     PCoordinates  x_coord;
  658.     PCoordinates  y_coord;
  659.     PTouchTable   touch;
  660.     PUShort       endContours;
  661.   };
  662.  
  663.  
  664.   /* The following type is used to load a font from a collection */
  665.   /* See Face_Create in ttobjs.c                                 */
  666.  
  667.   typedef struct _TFont_Input
  668.   {
  669.     TT_Stream  stream;     /* input stream                */
  670.     Int        fontIndex;  /* index of font in collection */
  671.  
  672.   } TFont_Input;
  673.  
  674.  
  675.   /********************************************************************/
  676.   /*                                                                  */
  677.   /*   Code Range Functions                                           */
  678.   /*                                                                  */
  679.   /********************************************************************/
  680.  
  681.   TT_Error  Goto_CodeRange( PExecution_Context exec, Int range, Int IP );
  682.   /* Goto a specified coderange */
  683.  
  684.   PCodeRange  Get_CodeRange( PExecution_Context exec, Int range );
  685.   /* Return a pointer to a given coderange record */
  686.   /* Used only by the debugger                    */
  687.  
  688.   TT_Error  Set_CodeRange( PExecution_Context exec,
  689.                            Int                range,
  690.                            void*              base,
  691.                            Int                length );
  692.   /* Set a given code range properties */
  693.  
  694.   TT_Error  Clear_CodeRange( PExecution_Context exec, Int range );
  695.   /* Clear a given coderange */
  696.  
  697.  
  698.  
  699.  
  700.   PExecution_Context  New_Context( PFace  face );
  701.  
  702.   TT_Error  Done_Context( PExecution_Context  exec );
  703.  
  704.  
  705.   TT_Error  Context_Load( PExecution_Context  exec,
  706.                           PInstance           ins );
  707.  
  708.   TT_Error  Context_Save( PExecution_Context  exec,
  709.                           PInstance           ins );
  710.  
  711.   TT_Error  Context_Run( PExecution_Context  exec,
  712.                          Bool                debug );
  713.  
  714.   TT_Error  Instance_Init( PInstance  ins );
  715.  
  716.   TT_Error  Instance_Reset( PInstance  ins,
  717.                             Bool       debug );
  718.  
  719.   /********************************************************************/
  720.   /*                                                                  */
  721.   /*   Component Initializer/Finalizer                                */
  722.   /*                                                                  */
  723.   /*   Called from 'freetype.c'                                       */
  724.   /*   The component must create and register the face, instance and  */
  725.   /*   execution context cache classes before any object can be       */
  726.   /*   managed.                                                       */
  727.   /*                                                                  */
  728.   /********************************************************************/
  729.  
  730.   TT_Error  TTObjs_Init();
  731.   TT_Error  TTObjs_Done();
  732.  
  733.   #ifdef __cplusplus
  734.   }
  735.   #endif
  736.  
  737. #endif /* TTOBJS_H */
  738.