⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ttobjs.c

📁 Trolltech公司发布的基于C++图形开发环境
💻 C
📖 第 1 页 / 共 3 页
字号:
/***************************************************************************//*                                                                         *//*  ttobjs.c                                                               *//*                                                                         *//*    Objects manager (body).                                              *//*                                                                         *//*  Copyright 1996-2000 by                                                 *//*  David Turner, Robert Wilhelm, and Werner Lemberg.                      *//*                                                                         *//*  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.                                        *//*                                                                         *//***************************************************************************/#include <freetype/internal/ftdebug.h>#include <freetype/internal/ftcalc.h>#include <freetype/internal/ftstream.h>#include <freetype/ttnameid.h>#include <freetype/tttags.h>#include <freetype/internal/sfnt.h>#include <freetype/internal/psnames.h>#ifdef FT_FLAT_COMPILE#include "ttgload.h"#include "ttpload.h"#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER#include "ttinterp.h"#endif#else /* FT_FLAT_COMPILE */#include <truetype/ttgload.h>#include <truetype/ttpload.h>#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER#include <truetype/ttinterp.h>#endif#endif /* FT_FLAT_COMPILE */#include <freetype/internal/tterrors.h>  /*************************************************************************/  /*                                                                       */  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */  /* messages during execution.                                            */  /*                                                                       */#undef  FT_COMPONENT#define FT_COMPONENT  trace_ttobjs#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER  /*************************************************************************/  /*                                                                       */  /*                       GLYPH ZONE FUNCTIONS                            */  /*                                                                       */  /*************************************************************************/  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    TT_Done_GlyphZone                                                  */  /*                                                                       */  /* <Description>                                                         */  /*    Deallocates a glyph zone.                                          */  /*                                                                       */  /* <Input>                                                               */  /*    zone :: A pointer to the target glyph zone.                        */  /*                                                                       */  FT_LOCAL_DEF  void  TT_Done_GlyphZone( TT_GlyphZone*  zone )  {    FT_Memory  memory = zone->memory;    FREE( zone->contours );    FREE( zone->tags );    FREE( zone->cur );    FREE( zone->org );    zone->max_points   = zone->n_points   = 0;    zone->max_contours = zone->n_contours = 0;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    TT_New_GlyphZone                                                   */  /*                                                                       */  /* <Description>                                                         */  /*    Allocates a new glyph zone.                                        */  /*                                                                       */  /* <Input>                                                               */  /*    memory      :: A handle to the current memory object.              */  /*                                                                       */  /*    maxPoints   :: The capacity of glyph zone in points.               */  /*                                                                       */  /*    maxContours :: The capacity of glyph zone in contours.             */  /*                                                                       */  /* <Output>                                                              */  /*    zone        :: A pointer to the target glyph zone record.          */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  FT_LOCAL_DEF  FT_Error TT_New_GlyphZone( FT_Memory      memory,                             FT_UShort      maxPoints,                             FT_Short       maxContours,                             TT_GlyphZone*  zone )  {    FT_Error  error;    if ( maxPoints > 0 )      maxPoints += 2;    MEM_Set( zone, 0, sizeof ( *zone ) );    zone->memory = memory;    if ( ALLOC_ARRAY( zone->org,      maxPoints * 2, FT_F26Dot6 ) ||         ALLOC_ARRAY( zone->cur,      maxPoints * 2, FT_F26Dot6 ) ||         ALLOC_ARRAY( zone->tags,     maxPoints,     FT_Byte    ) ||         ALLOC_ARRAY( zone->contours, maxContours,   FT_UShort  ) )    {      TT_Done_GlyphZone( zone );    }    return error;  }#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    TT_Init_Face                                                       */  /*                                                                       */  /* <Description>                                                         */  /*    Initializes a given TrueType face object.                          */  /*                                                                       */  /* <Input>                                                               */  /*    stream     :: The source font stream.                              */  /*                                                                       */  /*    face_index :: The index of the font face in the resource.          */  /*                                                                       */  /*    num_params :: Number of additional generic parameters.  Ignored.   */  /*                                                                       */  /*    params     :: Additional generic parameters.  Ignored.             */  /*                                                                       */  /* <InOut>                                                               */  /*    face       :: The newly built face object.                         */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  FT_LOCAL  FT_Error  TT_Init_Face( FT_Stream      stream,                          TT_Face        face,                          FT_Int         face_index,                          FT_Int         num_params,                          FT_Parameter*  params )  {    FT_Error         error;    FT_Library       library;    SFNT_Interface*  sfnt;    library = face->root.driver->root.library;    sfnt    = (SFNT_Interface*)FT_Get_Module_Interface( library, "sfnt" );    if ( !sfnt )      goto Bad_Format;    /* create input stream from resource */    if ( FILE_Seek( 0 ) )      goto Exit;    /* check that we have a valid TrueType file */    error = sfnt->init_face( stream, face, face_index, num_params, params );    if ( error )      goto Exit;    /* We must also be able to accept Mac/GX fonts, as well as OT ones */    if ( face->format_tag != 0x00010000L &&    /* MS fonts  */         face->format_tag != TTAG_true   )     /* Mac fonts */    {      FT_TRACE2(( "[not a valid TTF font]\n" ));      goto Bad_Format;    }    /* If we are performing a simple font format check, exit immediately */    if ( face_index < 0 )      return TT_Err_Ok;    /* Load font directory */    error = sfnt->load_face( stream, face, face_index, num_params, params );    if ( error )      goto Exit;    if ( face->root.face_flags & FT_FACE_FLAG_SCALABLE )      error = TT_Load_Locations( face, stream ) ||              TT_Load_CVT      ( face, stream ) ||              TT_Load_Programs ( face, stream );    /* initialize standard glyph loading routines */    TT_Init_Glyph_Loading( face );  Exit:    return error;  Bad_Format:    error = FT_Err_Unknown_File_Format;    goto Exit;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    TT_Done_Face                                                       */  /*                                                                       */  /* <Description>                                                         */  /*    Finalizes a given face object.                                     */  /*                                                                       */  /* <Input>                                                               */  /*    face :: A pointer to the face object to destroy.                   */  /*                                                                       */  FT_LOCAL  void  TT_Done_Face( TT_Face  face )  {    FT_Memory  memory = face->root.memory;    FT_Stream  stream = face->root.stream;    SFNT_Interface*  sfnt = (SFNT_Interface*)face->sfnt;    /* for `extended TrueType formats' (i.e. compressed versions) */    if ( face->extra.finalizer )      face->extra.finalizer( face->extra.data );    if ( sfnt )      sfnt->done_face( face );    /* freeing the locations table */    FREE( face->glyph_locations );    face->num_locations = 0;    /* freeing the CVT */    FREE( face->cvt );    face->cvt_size = 0;    /* freeing the programs */    RELEASE_Frame( face->font_program );    RELEASE_Frame( face->cvt_program );    face->font_program_size = 0;    face->cvt_program_size  = 0;  }  /*************************************************************************/  /*                                                                       */  /*                           SIZE  FUNCTIONS                             */  /*                                                                       */  /*************************************************************************/  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    TT_Init_Size                                                       */  /*                                                                       */  /* <Description>                                                         */  /*    Initializes a new TrueType size object.                            */  /*                                                                       */  /* <InOut>                                                               */  /*    size :: A handle to the size object.                               */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -