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

📄 t1gload.c

📁 奇趣公司比较新的qt/emd版本
💻 C
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************//*                                                                         *//*  t1gload.c                                                              *//*                                                                         *//*    Type 1 Glyph Loader (body).                                          *//*                                                                         *//*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 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 <ft2build.h>#include "t1gload.h"#include FT_INTERNAL_DEBUG_H#include FT_INTERNAL_STREAM_H#include FT_OUTLINE_H#include FT_INTERNAL_POSTSCRIPT_AUX_H#include "t1errors.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_t1gload  /*************************************************************************/  /*************************************************************************/  /*************************************************************************/  /**********                                                      *********/  /**********            COMPUTE THE MAXIMUM ADVANCE WIDTH         *********/  /**********                                                      *********/  /**********    The following code is in charge of computing      *********/  /**********    the maximum advance width of the font.  It        *********/  /**********    quickly processes each glyph charstring to        *********/  /**********    extract the value from either a `sbw' or `seac'   *********/  /**********    operator.                                         *********/  /**********                                                      *********/  /*************************************************************************/  /*************************************************************************/  /*************************************************************************/  FT_LOCAL_DEF( FT_Error )  T1_Parse_Glyph_And_Get_Char_String( T1_Decoder  decoder,                                      FT_UInt     glyph_index,                                      FT_Data*    char_string )  {    T1_Face   face  = (T1_Face)decoder->builder.face;    T1_Font   type1 = &face->type1;    FT_Error  error = T1_Err_Ok;    decoder->font_matrix = type1->font_matrix;    decoder->font_offset = type1->font_offset;#ifdef FT_CONFIG_OPTION_INCREMENTAL    /* For incremental fonts get the character data using the */    /* callback function.                                     */    if ( face->root.internal->incremental_interface )      error = face->root.internal->incremental_interface->funcs->get_glyph_data(                face->root.internal->incremental_interface->object,                glyph_index, char_string );    else#endif /* FT_CONFIG_OPTION_INCREMENTAL */    /* For ordinary fonts get the character data stored in the face record. */    {      char_string->pointer = type1->charstrings[glyph_index];      char_string->length  = (FT_Int)type1->charstrings_len[glyph_index];    }    if ( !error )      error = decoder->funcs.parse_charstrings(                decoder, (FT_Byte*)char_string->pointer,                char_string->length );#ifdef FT_CONFIG_OPTION_INCREMENTAL    /* Incremental fonts can optionally override the metrics. */    if ( !error && face->root.internal->incremental_interface                 &&         face->root.internal->incremental_interface->funcs->get_glyph_metrics )    {      FT_Incremental_MetricsRec  metrics;      metrics.bearing_x = decoder->builder.left_bearing.x;      metrics.bearing_y = decoder->builder.left_bearing.y;      metrics.advance   = decoder->builder.advance.x;      error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(                face->root.internal->incremental_interface->object,                glyph_index, FALSE, &metrics );      decoder->builder.left_bearing.x = metrics.bearing_x;      decoder->builder.left_bearing.y = metrics.bearing_y;      decoder->builder.advance.x      = metrics.advance;      decoder->builder.advance.y      = 0;    }#endif /* FT_CONFIG_OPTION_INCREMENTAL */    return error;  }  FT_CALLBACK_DEF( FT_Error )  T1_Parse_Glyph( T1_Decoder  decoder,                  FT_UInt     glyph_index )  {    FT_Data   glyph_data;    FT_Error  error = T1_Parse_Glyph_And_Get_Char_String(                        decoder, glyph_index, &glyph_data );#ifdef FT_CONFIG_OPTION_INCREMENTAL    if ( !error )    {      T1_Face  face = (T1_Face)decoder->builder.face;      if ( face->root.internal->incremental_interface )        face->root.internal->incremental_interface->funcs->free_glyph_data(          face->root.internal->incremental_interface->object,          &glyph_data );    }#endif /* FT_CONFIG_OPTION_INCREMENTAL */    return error;  }  FT_LOCAL_DEF( FT_Error )  T1_Compute_Max_Advance( T1_Face  face,                          FT_Pos*  max_advance )  {    FT_Error       error;    T1_DecoderRec  decoder;    FT_Int         glyph_index;    T1_Font        type1 = &face->type1;    PSAux_Service  psaux = (PSAux_Service)face->psaux;    FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );    *max_advance = 0;    /* initialize load decoder */    error = psaux->t1_decoder_funcs->init( &decoder,                                           (FT_Face)face,                                           0, /* size       */                                           0, /* glyph slot */                                           (FT_Byte**)type1->glyph_names,                                           face->blend,                                           0,                                           FT_RENDER_MODE_NORMAL,                                           T1_Parse_Glyph );    if ( error )      return error;    decoder.builder.metrics_only = 1;    decoder.builder.load_points  = 0;    decoder.num_subrs     = type1->num_subrs;    decoder.subrs         = type1->subrs;    decoder.subrs_len     = type1->subrs_len;    decoder.buildchar     = face->buildchar;    decoder.len_buildchar = face->len_buildchar;    *max_advance = 0;    /* for each glyph, parse the glyph charstring and extract */    /* the advance width                                      */    for ( glyph_index = 0; glyph_index < type1->num_glyphs; glyph_index++ )    {      /* now get load the unscaled outline */      error = T1_Parse_Glyph( &decoder, glyph_index );      if ( glyph_index == 0 || decoder.builder.advance.x > *max_advance )        *max_advance = decoder.builder.advance.x;      /* ignore the error if one occurred - skip to next glyph */    }    psaux->t1_decoder_funcs->done( &decoder );    return T1_Err_Ok;  }  FT_LOCAL_DEF( FT_Error )  T1_Load_Glyph( T1_GlyphSlot  glyph,                 T1_Size       size,                 FT_UInt       glyph_index,                 FT_Int32      load_flags )  {    FT_Error                error;    T1_DecoderRec           decoder;

⌨️ 快捷键说明

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