ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

ttobjs.h
Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  ttobjs.h                                                               */
00004 /*                                                                         */
00005 /*    Objects manager (specification).                                     */
00006 /*                                                                         */
00007 /*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
00008 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00009 /*                                                                         */
00010 /*  This file is part of the FreeType project, and may only be used,       */
00011 /*  modified, and distributed under the terms of the FreeType project      */
00012 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00013 /*  this file you indicate that you have read the license and              */
00014 /*  understand and accept it fully.                                        */
00015 /*                                                                         */
00016 /***************************************************************************/
00017 
00018 
00019 #ifndef __TTOBJS_H__
00020 #define __TTOBJS_H__
00021 
00022 
00023 #include <ft2build.h>
00024 #include FT_INTERNAL_OBJECTS_H
00025 #include FT_INTERNAL_TRUETYPE_TYPES_H
00026 
00027 
00028 FT_BEGIN_HEADER
00029 
00030 
00031   /*************************************************************************/
00032   /*                                                                       */
00033   /* <Type>                                                                */
00034   /*    TT_Driver                                                          */
00035   /*                                                                       */
00036   /* <Description>                                                         */
00037   /*    A handle to a TrueType driver object.                              */
00038   /*                                                                       */
00039   typedef struct TT_DriverRec_*  TT_Driver;
00040 
00041 
00042   /*************************************************************************/
00043   /*                                                                       */
00044   /* <Type>                                                                */
00045   /*    TT_Instance                                                        */
00046   /*                                                                       */
00047   /* <Description>                                                         */
00048   /*    A handle to a TrueType size object.                                */
00049   /*                                                                       */
00050   typedef struct TT_SizeRec_*  TT_Size;
00051 
00052 
00053   /*************************************************************************/
00054   /*                                                                       */
00055   /* <Type>                                                                */
00056   /*    TT_GlyphSlot                                                       */
00057   /*                                                                       */
00058   /* <Description>                                                         */
00059   /*    A handle to a TrueType glyph slot object.                          */
00060   /*                                                                       */
00061   /* <Note>                                                                */
00062   /*    This is a direct typedef of FT_GlyphSlot, as there is nothing      */
00063   /*    specific about the TrueType glyph slot.                            */
00064   /*                                                                       */
00065   typedef FT_GlyphSlot  TT_GlyphSlot;
00066 
00067 
00068   /*************************************************************************/
00069   /*                                                                       */
00070   /* <Struct>                                                              */
00071   /*    TT_GraphicsState                                                   */
00072   /*                                                                       */
00073   /* <Description>                                                         */
00074   /*    The TrueType graphics state used during bytecode interpretation.   */
00075   /*                                                                       */
00076   typedef struct  TT_GraphicsState_
00077   {
00078     FT_UShort      rp0;
00079     FT_UShort      rp1;
00080     FT_UShort      rp2;
00081 
00082     FT_UnitVector  dualVector;
00083     FT_UnitVector  projVector;
00084     FT_UnitVector  freeVector;
00085 
00086 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
00087     FT_Bool        both_x_axis;
00088 #endif
00089 
00090     FT_Long        loop;
00091     FT_F26Dot6     minimum_distance;
00092     FT_Int         round_state;
00093 
00094     FT_Bool        auto_flip;
00095     FT_F26Dot6     control_value_cutin;
00096     FT_F26Dot6     single_width_cutin;
00097     FT_F26Dot6     single_width_value;
00098     FT_Short       delta_base;
00099     FT_Short       delta_shift;
00100 
00101     FT_Byte        instruct_control;
00102     /* According to Greg Hitchcock from Microsoft, the `scan_control'     */
00103     /* variable as documented in the TrueType specification is a 32-bit   */
00104     /* integer; the high-word part holds the SCANTYPE value, the low-word */
00105     /* part the SCANCTRL value.  We separate it into two fields.          */
00106     FT_Bool        scan_control;
00107     FT_Int         scan_type;
00108 
00109     FT_UShort      gep0;
00110     FT_UShort      gep1;
00111     FT_UShort      gep2;
00112 
00113   } TT_GraphicsState;
00114 
00115 
00116 #ifdef TT_USE_BYTECODE_INTERPRETER
00117 
00118   FT_LOCAL( void )
00119   tt_glyphzone_done( TT_GlyphZone  zone );
00120 
00121   FT_LOCAL( FT_Error )
00122   tt_glyphzone_new( FT_Memory     memory,
00123                     FT_UShort     maxPoints,
00124                     FT_Short      maxContours,
00125                     TT_GlyphZone  zone );
00126 
00127 #endif /* TT_USE_BYTECODE_INTERPRETER */
00128 
00129 
00130 
00131   /*************************************************************************/
00132   /*                                                                       */
00133   /*  EXECUTION SUBTABLES                                                  */
00134   /*                                                                       */
00135   /*  These sub-tables relate to instruction execution.                    */
00136   /*                                                                       */
00137   /*************************************************************************/
00138 
00139 
00140 #define TT_MAX_CODE_RANGES  3
00141 
00142 
00143   /*************************************************************************/
00144   /*                                                                       */
00145   /* There can only be 3 active code ranges at once:                       */
00146   /*   - the Font Program                                                  */
00147   /*   - the CVT Program                                                   */
00148   /*   - a glyph's instructions set                                        */
00149   /*                                                                       */
00150   typedef enum  TT_CodeRange_Tag_
00151   {
00152     tt_coderange_none = 0,
00153     tt_coderange_font,
00154     tt_coderange_cvt,
00155     tt_coderange_glyph
00156 
00157   } TT_CodeRange_Tag;
00158 
00159 
00160   typedef struct  TT_CodeRange_
00161   {
00162     FT_Byte*  base;
00163     FT_ULong  size;
00164 
00165   } TT_CodeRange;
00166 
00167   typedef TT_CodeRange  TT_CodeRangeTable[TT_MAX_CODE_RANGES];
00168 
00169 
00170   /*************************************************************************/
00171   /*                                                                       */
00172   /* Defines a function/instruction definition record.                     */
00173   /*                                                                       */
00174   typedef struct  TT_DefRecord_
00175   {
00176     FT_Int   range;      /* in which code range is it located? */
00177     FT_Long  start;      /* where does it start?               */
00178     FT_UInt  opc;        /* function #, or instruction code    */
00179     FT_Bool  active;     /* is it active?                      */
00180 
00181   } TT_DefRecord, *TT_DefArray;
00182 
00183 
00184   /*************************************************************************/
00185   /*                                                                       */
00186   /* Subglyph transformation record.                                       */
00187   /*                                                                       */
00188   typedef struct  TT_Transform_
00189   {
00190     FT_Fixed    xx, xy;     /* transformation matrix coefficients */
00191     FT_Fixed    yx, yy;
00192     FT_F26Dot6  ox, oy;     /* offsets        */
00193 
00194   } TT_Transform;
00195 
00196 
00197   /*************************************************************************/
00198   /*                                                                       */
00199   /* A note regarding non-squared pixels:                                  */
00200   /*                                                                       */
00201   /* (This text will probably go into some docs at some time; for now, it  */
00202   /* is kept here to explain some definitions in the TT_Size_Metrics       */
00203   /* record).                                                              */
00204   /*                                                                       */
00205   /* The CVT is a one-dimensional array containing values that control     */
00206   /* certain important characteristics in a font, like the height of all   */
00207   /* capitals, all lowercase letter, default spacing or stem width/height. */
00208   /*                                                                       */
00209   /* These values are found in FUnits in the font file, and must be scaled */
00210   /* to pixel coordinates before being used by the CVT and glyph programs. */
00211   /* Unfortunately, when using distinct x and y resolutions (or distinct x */
00212   /* and y pointsizes), there are two possible scalings.                   */
00213   /*                                                                       */
00214   /* A first try was to implement a `lazy' scheme where all values were    */
00215   /* scaled when first used.  However, while some values are always used   */
00216   /* in the same direction, some others are used under many different      */
00217   /* circumstances and orientations.                                       */
00218   /*                                                                       */
00219   /* I have found a simpler way to do the same, and it even seems to work  */
00220   /* in most of the cases:                                                 */
00221   /*                                                                       */
00222   /* - All CVT values are scaled to the maximum ppem size.                 */
00223   /*                                                                       */
00224   /* - When performing a read or write in the CVT, a ratio factor is used  */
00225   /*   to perform adequate scaling.  Example:                              */
00226   /*                                                                       */
00227   /*     x_ppem = 14                                                       */
00228   /*     y_ppem = 10                                                       */
00229   /*                                                                       */
00230   /*   We choose ppem = x_ppem = 14 as the CVT scaling size.  All cvt      */
00231   /*   entries are scaled to it.                                           */
00232   /*                                                                       */
00233   /*     x_ratio = 1.0                                                     */
00234   /*     y_ratio = y_ppem/ppem (< 1.0)                                     */
00235   /*                                                                       */
00236   /*   We compute the current ratio like:                                  */
00237   /*                                                                       */
00238   /*   - If projVector is horizontal,                                      */
00239   /*       ratio = x_ratio = 1.0                                           */
00240   /*                                                                       */
00241   /*   - if projVector is vertical,                                        */
00242   /*       ratio = y_ratio                                                 */
00243   /*                                                                       */
00244   /*   - else,                                                             */
00245   /*       ratio = sqrt( (proj.x * x_ratio) ^ 2 + (proj.y * y_ratio) ^ 2 ) */
00246   /*                                                                       */
00247   /*   Reading a cvt value returns                                         */
00248   /*     ratio * cvt[index]                                                */
00249   /*                                                                       */
00250   /*   Writing a cvt value in pixels:                                      */
00251   /*     cvt[index] / ratio                                                */
00252   /*                                                                       */
00253   /*   The current ppem is simply                                          */
00254   /*     ratio * ppem                                                      */
00255   /*                                                                       */
00256   /*************************************************************************/
00257 
00258 
00259   /*************************************************************************/
00260   /*                                                                       */
00261   /* Metrics used by the TrueType size and context objects.                */
00262   /*                                                                       */
00263   typedef struct  TT_Size_Metrics_
00264   {
00265     /* for non-square pixels */
00266     FT_Long     x_ratio;
00267     FT_Long     y_ratio;
00268 
00269     FT_UShort   ppem;               /* maximum ppem size              */
00270     FT_Long     ratio;              /* current ratio                  */
00271     FT_Fixed    scale;
00272 
00273     FT_F26Dot6  compensations[4];   /* device-specific compensations  */
00274 
00275     FT_Bool     valid;
00276 
00277     FT_Bool     rotated;            /* `is the glyph rotated?'-flag   */
00278     FT_Bool     stretched;          /* `is the glyph stretched?'-flag */
00279 
00280   } TT_Size_Metrics;
00281 
00282 
00283   /*************************************************************************/
00284   /*                                                                       */
00285   /* TrueType size class.                                                  */
00286   /*                                                                       */
00287   typedef struct  TT_SizeRec_
00288   {
00289     FT_SizeRec         root;
00290 
00291     /* we have our own copy of metrics so that we can modify */
00292     /* it without affecting auto-hinting (when used)         */
00293     FT_Size_Metrics    metrics;
00294 
00295     TT_Size_Metrics    ttmetrics;
00296 
00297     FT_ULong           strike_index;      /* 0xFFFFFFFF to indicate invalid */
00298 
00299 #ifdef TT_USE_BYTECODE_INTERPRETER
00300 
00301     FT_UInt            num_function_defs; /* number of function definitions */
00302     FT_UInt            max_function_defs;
00303     TT_DefArray        function_defs;     /* table of function definitions  */
00304 
00305     FT_UInt            num_instruction_defs;  /* number of ins. definitions */
00306     FT_UInt            max_instruction_defs;
00307     TT_DefArray        instruction_defs;      /* table of ins. definitions  */
00308 
00309     FT_UInt            max_func;
00310     FT_UInt            max_ins;
00311 
00312     TT_CodeRangeTable  codeRangeTable;
00313 
00314     TT_GraphicsState   GS;
00315 
00316     FT_ULong           cvt_size;      /* the scaled control value table */
00317     FT_Long*           cvt;
00318 
00319     FT_UShort          storage_size; /* The storage area is now part of */
00320     FT_Long*           storage;      /* the instance                    */
00321 
00322     TT_GlyphZoneRec    twilight;     /* The instance's twilight zone    */
00323 
00324     /* debugging variables */
00325 
00326     /* When using the debugger, we must keep the */
00327     /* execution context tied to the instance    */
00328     /* object rather than asking it on demand.   */
00329 
00330     FT_Bool            debug;
00331     TT_ExecContext     context;
00332 
00333     FT_Bool            bytecode_ready;
00334     FT_Bool            cvt_ready;
00335 
00336 #endif /* TT_USE_BYTECODE_INTERPRETER */
00337 
00338   } TT_SizeRec;
00339 
00340 
00341   /*************************************************************************/
00342   /*                                                                       */
00343   /* TrueType driver class.                                                */
00344   /*                                                                       */
00345   typedef struct  TT_DriverRec_
00346   {
00347     FT_DriverRec     root;
00348     TT_ExecContext   context;  /* execution context        */
00349     TT_GlyphZoneRec  zone;     /* glyph loader points zone */
00350 
00351     void*            extension_component;
00352 
00353   } TT_DriverRec;
00354 
00355 
00356   /* Note: All of the functions below (except tt_size_reset()) are used    */
00357   /* as function pointers in a FT_Driver_ClassRec.  Therefore their        */
00358   /* parameters are of types FT_Face, FT_Size, etc., rather than TT_Face,  */
00359   /* TT_Size, etc., so that the compiler can confirm that the types and    */
00360   /* number of parameters are correct.  In all cases the FT_xxx types are  */
00361   /* cast to their TT_xxx counterparts inside the functions since FreeType */
00362   /* will always use the TT driver to create them.                         */
00363 
00364 
00365   /*************************************************************************/
00366   /*                                                                       */
00367   /* Face functions                                                        */
00368   /*                                                                       */
00369   FT_LOCAL( FT_Error )
00370   tt_face_init( FT_Stream      stream,
00371                 FT_Face        ttface,      /* TT_Face */
00372                 FT_Int         face_index,
00373                 FT_Int         num_params,
00374                 FT_Parameter*  params );
00375 
00376   FT_LOCAL( void )
00377   tt_face_done( FT_Face  ttface );          /* TT_Face */
00378 
00379 
00380   /*************************************************************************/
00381   /*                                                                       */
00382   /* Size functions                                                        */
00383   /*                                                                       */
00384   FT_LOCAL( FT_Error )
00385   tt_size_init( FT_Size  ttsize );          /* TT_Size */
00386 
00387   FT_LOCAL( void )
00388   tt_size_done( FT_Size  ttsize );          /* TT_Size */
00389 
00390 #ifdef TT_USE_BYTECODE_INTERPRETER
00391 
00392   FT_LOCAL( FT_Error )
00393   tt_size_run_fpgm( TT_Size  size );
00394 
00395   FT_LOCAL( FT_Error )
00396   tt_size_run_prep( TT_Size  size );
00397 
00398   FT_LOCAL( FT_Error )
00399   tt_size_ready_bytecode( TT_Size  size );
00400 
00401 #endif /* TT_USE_BYTECODE_INTERPRETER */
00402 
00403   FT_LOCAL( FT_Error )
00404   tt_size_reset( TT_Size  size );
00405 
00406 
00407   /*************************************************************************/
00408   /*                                                                       */
00409   /* Driver functions                                                      */
00410   /*                                                                       */
00411   FT_LOCAL( FT_Error )
00412   tt_driver_init( FT_Module  ttdriver );    /* TT_Driver */
00413 
00414   FT_LOCAL( void )
00415   tt_driver_done( FT_Module  ttdriver );    /* TT_Driver */
00416 
00417 
00418   /*************************************************************************/
00419   /*                                                                       */
00420   /* Slot functions                                                        */
00421   /*                                                                       */
00422   FT_LOCAL( FT_Error )
00423   tt_slot_init( FT_GlyphSlot  slot );
00424 
00425 
00426 FT_END_HEADER
00427 
00428 #endif /* __TTOBJS_H__ */
00429 
00430 
00431 /* END */

Generated on Sat May 26 2012 04:32:58 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.