freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Devel] Apple's 'gvar' table and friends


From: Masatake YAMATO
Subject: Re: [Devel] Apple's 'gvar' table and friends
Date: Wed, 21 Apr 2004 20:24:36 +0900 (JST)

George, 

I'm reviewing your gxvar patch.

(gxvar5-jet.patch): I found a wrong memory freeing code in ttgxvar.c.
(truetype-jet.patch): I need this patch to compile ttgxvar.c.
(ttgxvar.h.toomuchtypedef): Please comparer this with your ttgxvar.h.
                            Rather I like much typedef and struct because
                            comparing the coad and spec is made easier
                            even if the symbol becomes too long.
                            Give your comment.

Tell me if you could use tla/arch version control system. With the version
control system, patch trakcing becomes much easier.

Masatake YAMATO
*** ttgxvar.c.orig      2004-04-21 19:54:07.000000000 +0900
--- ttgxvar.c   2004-04-21 20:10:59.000000000 +0900
***************
*** 1,3 ****
--- 1,10 ----
+ /* This comment should be removed in the future.
+  * ---------------------------------------------
+  * Patch info:
+  * 1. George's gvar[2-4].patch is applied.
+  * 2. Masatake's gvar5-jet.patch is applied.
+  */
+ 
  /***************************************************************************/
  /*                                                                         */
  /*  ttgxvar.c                                                              */
***************
*** 275,282 ****
        {
          for ( j=0; j<=i; ++j )
        {
!         FT_FREE(blend->avar[i].orig);
!         FT_FREE(blend->avar[i].final);
        }
        FT_FREE(blend->avar);
        blend->avar = NULL;
--- 282,289 ----
        {
          for ( j=0; j<=i; ++j )
        {
!         FT_FREE(blend->avar[j].orig);
!         FT_FREE(blend->avar[j].final);
        }
        FT_FREE(blend->avar);
        blend->avar = NULL;
Index: src/truetype/truetype.c
===================================================================
RCS file: /cvs/freetype/freetype2/src/truetype/truetype.c,v
retrieving revision 1.11
diff -u -r1.11 truetype.c
--- truetype.c  2001/06/28 17:48:59     1.11
+++ truetype.c  2004/04/21 11:14:51
@@ -23,6 +23,7 @@
 #include "ttpload.c"    /* tables loader    */
 #include "ttgload.c"    /* glyph loader     */
 #include "ttobjs.c"     /* object manager   */
+#include "ttgxvar.c"   /* gx distortable font */
 
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 #include "ttinterp.c"
/* This comment should be removed in the future.
 * Patch info: George's gvar4.patch is applied.
 * Masatake's gvar5.patch is applied.
 */


/***************************************************************************/
/*                                                                         */
/*  ttgxvar.h                                                              */
/*                                                                         */
/*    TrueType GX Font Variation loader  (Specification)                   */
/*                                                                         */
/*  Copyright 2004 by                                                      */
/*  David Turner, Robert Wilhelm, Werner Lemberg and George Williams.      */
/*                                                                         */
/*  This file is part of the FreeType project, and may only be used,       */
/*  modified, and distributed under the terms of the FreeType project      */
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
/*  this file you indicate that you have read the license and              */
/*  understand and accept it fully.                                        */
/*                                                                         */
/***************************************************************************/
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT


#ifndef __TTGXVAR_H__
#define __TTGXVAR_H__


#include <ft2build.h>
#include "ttobjs.h"


FT_BEGIN_HEADER


  /*************************************************************************/
  /*                                                                       */
  /* <Struct>                                                              */
  /*    GX_AVarCorrespondenceRec                                           */
  /*                                                                       */
  /* <Description>                                                         */  
  /*    A data structure represents `shortFracCorrespondence in `avar'     */
  /*     spec from apple.                                                  */

  typedef struct GX_AVarCorrespondenceRec_
  {
    FT_Fixed fromCoord;
    FT_Fixed toCoord;
  } GX_AVarCorrespondenceRec_, *GX_AVarCorrespondence;

  /*************************************************************************/
  /*                                                                       */
  /* <Struct>                                                              */
  /*    GX_AVarRec                                                         */
  /*                                                                       */
  /* <Description>                                                         */
  /*    Data from the segment field of 'avar' table.                       */
  /*    There's one of these for each axis                                 */
  /*                                                                       */
  /* <Fields>                                                              */
  /*************************************************************************/

  typedef struct  GX_AVarSegmentRec_
  {
    FT_UShort pairCount;
    GX_AVarCorrespondence correspondence; /* array with pairCount entries */
  } GX_AVarSegmentRec, *GX_AVarSegment;



  /*************************************************************************/
  /*                                                                       */
  /* <Struct>                                                              */
  /*    GX_BlendRec                                                        */
  /*                                                                       */
  /* <Description>                                                         */
  /*    Data for interpolating a font from a distortable font specified    */
  /*    by the GX *var tables ([fgca]var).                                 */
  /*                                                                       */
  /* <Fields>                                                              */
  /*    num_axis         :: The number of axes along which interpolation   */
  /*                         may happen                                    */
  /*    normalizedcoords :: A normalized value (between [-1,1]) indicating */
  /*                         the contribution along each axis to the final */
  /*                         interpolated font.                            */
  /*************************************************************************/

  typedef struct  GS_BlendRec_
  {
    FT_UInt          num_axis;
    FT_Fixed        *normalizedcoords;

    FT_MM_Var       *mmvar;
    FT_Int           mmvar_len;

    FT_Bool          avar_checked;
    GX_AVarSegment   avar_segment;

    FT_Int           tuplecount;         /* shared tuples in 'gvar' */
    FT_Fixed        *tuplecoords;        /* tuplecoords[tuplecount][num_axis] */

    FT_Int           gv_glyphcnt;
    FT_ULong        *glyphoffsets;
    
  } GX_BlendRec;



  /*************************************************************************/
  /*                                                                       */
  /* <enum>                                                                */
  /*    GX_TupleCountFlags                                                 */
  /*                                                                       */
  /* <Description>                                                         */
  /*    Flags used within the TupleCount field of gvar.                    */
  /*                                                                       */
  /*************************************************************************/
  typedef enum
  {
    GX_TC_TUPLES_SHARE_POINT_NUMBERS   = 0x8000,
    GX_TC_RESERVED_TUPLE_FLAGS         = 0x7000,
    GX_TC_TUPLE_COUNT_MASK             = 0x0FFF
  } GX_TupleCountFlags ;


  /*************************************************************************/
  /*                                                                       */
  /* <enum>                                                                */
  /*    GX_TupleIndexFlags                                                 */
  /*                                                                       */
  /* <Description>                                                         */
  /*    Flags used within the TupleIndex field of gvar/cvar.               */
  /*                                                                       */
  /*************************************************************************/
  typedef enum
  {
    GX_TI_EMBEDDED_TUPLE_COORD   = 0x8000,
    GX_TI_INTERMEDIATE_TUPLE     = 0x4000,
    GX_TI_PRIVATE_POINT_NUMBERS  = 0x2000,
    GX_TI_RESERVED_TUPLE_FLAG    = 0x1000,
    GX_TI_TUPLE_INDEX_MASK       = 0x0FFF
  } GX_TupleIndexFlags ;


#define TTAG_wght              FT_MAKE_TAG( 'w', 'g', 'h', 't' )
#define TTAG_wdth              FT_MAKE_TAG( 'w', 'd', 't', 'h' )
#define TTAG_opsz              FT_MAKE_TAG( 'o', 'p', 's', 'z' )
#define TTAG_slnt              FT_MAKE_TAG( 's', 'l', 'n', 't' )

  FT_LOCAL_DEF( FT_Error )
  TT_Set_MM_Blend( TT_Face    face,
                   FT_UInt    num_coords,
                   FT_Fixed*  coords );

  FT_LOCAL_DEF( FT_Error )
  TT_Set_Var_Design( TT_Face   face,
                     FT_UInt   num_coords,
                     FT_Fixed* coords );

  FT_LOCAL_DEF( FT_Error )
  TT_Get_MM_Var( TT_Face      face,
                 FT_MM_Var**  master );


  FT_LOCAL_DEF( FT_Error )
  tt_face_vary_cvt( TT_Face    face,
                    FT_Stream  stream );

  FT_LOCAL_DEF( FT_Error )
  TT_Vary_Get_Glyph_Deltas( TT_Face    face,
                            FT_UInt    glyph_index,
                            FT_Vector  **deltas,
                            FT_UInt    n_points);

  FT_LOCAL_DEF( void )
  tt_done_blend( FT_Memory,
                 GX_Blend    blend );

FT_END_HEADER

#endif /* __TTGXVAR_H__ */

#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */


/* END */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]