freetype-devel
[Top][All Lists]
Advanced

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

[Devel] FTLayout


From: Masatake YAMATO
Subject: [Devel] FTLayout
Date: Wed, 14 Jan 2004 16:39:16 +0900 (JST)

/* My mail address address@hidden is down now. So I'm late to post in the 
   most important situation  ...sigh */

As I wrote ago, people at RedHat K,K. are developing GX engine.

Features
- The engine is written as a service(FTLayout) of FT2.
- Not only GXLayout but also OTLayout(stolen again from pango) will be 
  covered FTLayout.

I know FTLayout is reserved name by FT develpers.
But I cannot find any good name than FTLayout.

I'll post more soon.
We also have the implementation.

Masatake YAMATO
/***************************************************************************/
/*                                                                         */
/*  ftltypes.h                                                             */
/*                                                                         */
/*    FreeType Layout API  (specification)                                 */   
 
/*                                                                         */
/***************************************************************************/

#ifndef __FTL_LAYOUT_H_
#define __FTL_LAYOUT_H_

#include <ft2build.h>
#include FT_FREETYPE_H

FT_BEGIN_HEADER

  typedef struct FTL_FeaturesRequestRec_ * FTL_FeaturesRequest;
  typedef struct FTL_FontRec_            * FTL_Font;
  typedef struct FTL_Glyphs_ArrayRec_    * FTL_Glyphs_Array;

  typedef enum
  {
    FTL_NO_ENGINE         = 0,
    FTL_OPENTYPE_ENGINE   = 1,          /* Use otlayout.h */
    FTL_TRUETYPEGX_ENGINE = 2           /* Use gxlayout.h */
  } FTL_EngineType;
      
  typedef enum 
  { 
    FTL_HORIZONTAL = 0,  
    FTL_VERTICAL   = 1
  } FTL_Direction;

  typedef struct FTL_GlyphRec_
  {
    FT_UShort gid;
    FT_ULong  ot_prop;
  } FTL_GlyphRec, * FTL_Glyph;

  typedef struct FTL_Glyphs_ArrayRec_
  {
    FT_Memory   memory;
    FTL_Glyph   glyphs;
    FT_ULong    pos;
    FT_ULong    length;
    FT_ULong    allocated;
  } FTL_Glyphs_ArrayRec;

  FT_EXPORT( FT_Error )
  FTL_Query_EngineType                  ( FT_Face face, 
                                          FTL_EngineType * engine_type);

  FT_EXPORT( FT_Error )
  FTL_New_FeaturesRequest               ( FT_Face face, 
                                          FTL_FeaturesRequest* request);
  FT_EXPORT( FT_Error )
  FTL_Done_FeaturesRequest              ( FTL_FeaturesRequest request );

  FT_EXPORT ( FT_Error )
  FTL_Activate_FeaturesRequest          ( FTL_FeaturesRequest request );

  FT_EXPORT( FT_Error )
  FTL_Copy_FeaturesRequest              ( FTL_FeaturesRequest from,  
FTL_FeaturesRequest to );

  FT_EXPORT( FT_Error )
  FTL_Reset_FeaturesRequest             ( FTL_FeaturesRequest request );


  FT_EXPORT ( FTL_Direction )
  FTL_Get_FeaturesRequest_Direction     ( FTL_FeaturesRequest request );

  FT_EXPORT ( void )
  FTL_Set_FeaturesRequest_Direction     ( FTL_FeaturesRequest request,  
                                          FTL_Direction direction);

  FT_EXPORT( FT_UShort )
  FTL_Get_LigatureCaret_Count           ( FT_Face face, FT_UShort glyphID );

  FT_EXPORT( FT_UShort )
  FTL_Get_LigatureCaret_Division        ( FT_Face face, 
                                          FT_UShort glyphID, 
                                          FT_UShort nth );

  FT_EXPORT( FT_Error )
  FTL_New_Glyphs_Array                  ( FT_Memory memory,
                                          FTL_Glyphs_Array * garray );

  FT_EXPORT( FT_Error )
  FTL_Set_Glyphs_Array_Length           ( FTL_Glyphs_Array garray,
                                          FT_ULong new_length );

  FT_EXPORT( FT_Error )
  FTL_Copy_Glyphs_Array                 ( FTL_Glyphs_Array in,
                                          FTL_Glyphs_Array out );

  FT_EXPORT( FT_Error )
  FTL_Done_Glyphs_Array                 ( FTL_Glyphs_Array garray );

  FT_EXPORT( FT_Error )
  FTL_Substitute_Glyphs                 ( FT_Face face,
                                          FTL_Glyphs_Array in,
                                          FTL_Glyphs_Array out );

FT_END_HEADER

#endif  /* Not def: __FTL_LAYOUT_H_ */



/***************************************************************************/
/*                                                                         */
/*  gxlayout.h                                                             */
/*                                                                         */
/*    AAT/TrueTypeGX based layout engine                                   */
/*    (For application developers, specification only).                    */
/*                                                                         */
/***************************************************************************/


#ifndef __GXLAYOUT_H__
#define __GXLAYOUT_H__ 

#include <ft2build.h>
#include FT_SFNT_NAMES_H

  typedef struct GXL_SettingRec_         *GXL_Setting;
  typedef struct GXL_FeatureRec_         *GXL_Feature;
  typedef struct GXL_FeaturesRequestRec_ *GXL_FeaturesRequest;

  typedef enum
  {
    GXL_START_OF_TEXT_STATE = 0,
    GXL_START_OF_LINE_STATE = 1
  } GXL_Initial_State;

/*
 * Features
 */

  FT_EXPORT ( void )
  GXL_FeaturesRequest_Set_Initial_State ( GXL_FeaturesRequest request,
                                          GXL_Initial_State   initial_state );

  FT_EXPORT ( GXL_Initial_State )
  GXL_FeaturesRequest_Get_Initial_State ( GXL_FeaturesRequest request );
                                          
  FT_EXPORT ( FT_ULong )
  GXL_FeaturesRequest_Get_Feature_Count ( GXL_FeaturesRequest request );

  FT_EXPORT ( GXL_Feature )
  GXL_FeaturesRequest_Get_Feature       ( GXL_FeaturesRequest request, 
                                          FT_ULong index);

  FT_EXPORT( FT_Error ) 
  GXL_Feature_Get_Name                  ( GXL_Feature feature ,
                                          FT_SfntName  *aname );

  FT_EXPORT( FT_UShort )
  GXL_Feature_Get_Setting_Count         ( GXL_Feature feature );

  FT_EXPORT( GXL_Setting )
  GXL_Feature_Get_Setting               ( GXL_Feature feature,
                                          FT_ULong index );

  FT_EXPORT( FT_Bool )
  GXL_Feature_Is_Setting_Exclusive      ( GXL_Feature feature );

  FT_EXPORT( FT_Bool )
  GXL_Setting_Get_State                 ( GXL_Setting setting );

  FT_EXPORT( FT_Error )
  GXL_Setting_Get_Name                  ( GXL_Setting setting, 
                                          FT_SfntName  *aname );

  FT_EXPORT( void )
  GXL_Setting_Set_State                 ( GXL_Setting setting, FT_Bool state );

#endif /* Not def: __GXLAYOUT_H__ */

/***************************************************************************/
/*                                                                         */
/*  otlayout.h                                                             */
/*                                                                         */
/*    OpenType based layout engine                                         */
/*    (For application developers, specification only).                    */
/*                                                                         */
/***************************************************************************/


#ifndef __OTLAYOUT_H__
#define __OTLAYOUT_H__ 

#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER

  typedef FT_ULong OTTag;
  typedef enum {
    OT_TABLE_GSUB,
    OT_TABLE_GPOS
  } OTTableType;

  typedef struct OTL_FeaturesRequestRec_ *OTL_FeaturesRequest;
  typedef struct OTL_Tag_ListRec_
  {
    OTL_FeaturesRequest request;
    OTTag * tags;                       /* 0 is terminator. */
  } OTL_Tag_ListRec, *OTL_Tag_List;

  FT_EXPORT( FT_Bool )
  OTL_FeaturesRequest_Find_Script    ( OTL_FeaturesRequest request,
                                       OTTableType table_type,
                                       OTTag       script_tag,
                                       FT_UInt    *script_index);

  FT_EXPORT( FT_Bool )
  OTL_FeaturesRequest_Find_Language  ( OTL_FeaturesRequest request,
                                       OTTableType table_type,
                                       FT_UInt     script_index,
                                       OTTag       language_tag,
                                       FT_UInt    *language_index,
                                       FT_UInt    *required_feature_index );

  FT_EXPORT ( FT_Bool )
  OTL_FeaturesRequest_Find_Feature   ( OTL_FeaturesRequest request,
                                       OTTableType         table_type,
                                       OTTag               feature_tag,
                                       FT_UInt             script_index,
                                       FT_UInt             language_index,
                                       FT_UInt            *feature_index );

  FT_EXPORT ( OTL_Tag_List )
  OTL_FeaturesRequest_List_Scripts   ( OTL_FeaturesRequest request,
                                       OTTableType         table_type );

  FT_EXPORT ( OTL_Tag_List ) 
  OTL_FeaturesRequest_List_Languages ( OTL_FeaturesRequest request,
                                       OTTableType         table_type,
                                       FT_UInt             script_index );

  FT_EXPORT ( OTL_Tag_List )
  OTL_FeaturesRequest_List_Features  ( OTL_FeaturesRequest request,
                                       OTTableType         table_type,
                                       FT_UInt             script_index,
                                       FT_UInt             language_index );

  FT_EXPORT ( FT_Error )
  OTL_Tag_List_Done                  ( OTL_Tag_List taglist );

  FT_EXPORT ( FT_Error )
  OTL_FeaturesRequest_Add_Feature  ( OTL_FeaturesRequest request,
                                     OTTableType         table_type,
                                     FT_UInt             feature_index,
                                     FT_ULong            property_bit);

FT_END_HEADER

#endif /* Not def: __OTLAYOUT_H__ */

/***************************************************************************/
/*                                                                         */
/*  svlayout.h                                                             */
/*                                                                         */
/*    The FreeType Layout services (specification).                        */
/*                                                                         */
/***************************************************************************/


#ifndef __SVLAYOUT_H__
#define __SVLAYOUT_H__

#include FT_INTERNAL_SERVICE_H
#include FT_LAYOUT_H
#include FT_INTERNAL_FTL_TYPES_H

FT_BEGIN_HEADER

#define FT_SERVICE_ID_LAYOUT  "layout"

  typedef FT_Error
  (*FTL_Get_Font_Func)( FT_Face face,
                        FTL_Font* font );

  typedef FTL_EngineType
  (*FTL_Get_EngineType_Func) ( FT_Face face );
                               
  typedef FT_Error
  (*FTL_New_FeaturesRequest_Func)( FT_Face face,
                                   FTL_FeaturesRequest* request );
  typedef FT_Error
  (*FTL_Done_FeaturesRequest_Func)( FTL_FeaturesRequest request );

  typedef FT_Error
  (*FTL_Copy_FeaturesRequest_Func)( FTL_FeaturesRequest from,
                                    FTL_FeaturesRequest to );

  typedef FT_UShort
  (*FTL_Get_LigatureCaret_Count_Func)  ( FT_Face face, FT_UShort glyphID );
  
  typedef FT_UShort
  (*FTL_Get_LigatureCaret_Division_Func) ( FT_Face face, 
                                           FT_UShort glyphID, 
                                           FT_UShort nth );
  typedef FT_Error
  (*FTL_Substitute_Glyphs_Func) ( FT_Face face,
                                  FTL_FeaturesRequest request,
                                  FTL_Glyphs_Array in,
                                  FTL_Glyphs_Array out );

  FT_DEFINE_SERVICE( Layout )
  {
    FTL_Get_Font_Func                   get_font;
    FTL_Get_EngineType_Func             get_engine_type;
    FTL_New_FeaturesRequest_Func        new_features_request;
    FTL_Done_FeaturesRequest_Func       done_features_request;
    FTL_Copy_FeaturesRequest_Func       copy_features_request;
    FTL_Get_LigatureCaret_Count_Func    get_ligature_caret_count;
    FTL_Get_LigatureCaret_Division_Func get_ligature_caret_division;
    FTL_Substitute_Glyphs_Func          substitute_glyphs;
  };

  /* */


FT_END_HEADER

#endif /* __SVLAYOUT_H__ */


/* END */



reply via email to

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