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

📄 ttpost.c

📁 奇趣公司比较新的qt/emd版本
💻 C
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************//*                                                                         *//*  ttpost.c                                                               *//*                                                                         *//*    Postcript name table processing for TrueType and OpenType fonts      *//*    (body).                                                              *//*                                                                         *//*  Copyright 1996-2001, 2002, 2003, 2006, 2007 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.                                        *//*                                                                         *//***************************************************************************/  /*************************************************************************/  /*                                                                       */  /* The post table is not completely loaded by the core engine.  This     */  /* file loads the missing PS glyph names and implements an API to access */  /* them.                                                                 */  /*                                                                       */  /*************************************************************************/#include <ft2build.h>#include FT_INTERNAL_STREAM_H#include FT_TRUETYPE_TAGS_H#include "ttpost.h"#include "ttload.h"#include "sferrors.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_ttpost  /* If this configuration macro is defined, we rely on the `PSNames' */  /* module to grab the glyph names.                                  */#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES#include FT_SERVICE_POSTSCRIPT_CMAPS_H#define MAC_NAME( x )  ( (FT_String*)psnames->macintosh_name( x ) )#else /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */   /* Otherwise, we ignore the `PSNames' module, and provide our own  */   /* table of Mac names.  Thus, it is possible to build a version of */   /* FreeType without the Type 1 driver & PSNames module.            */#define MAC_NAME( x )  tt_post_default_names[x]  /* the 258 default Mac PS glyph names */  static const FT_String*  tt_post_default_names[258] =  {    /*   0 */    ".notdef", ".null", "CR", "space", "exclam",    "quotedbl", "numbersign", "dollar", "percent", "ampersand",    /*  10 */    "quotesingle", "parenleft", "parenright", "asterisk", "plus",    "comma", "hyphen", "period", "slash", "zero",    /*  20 */    "one", "two", "three", "four", "five",    "six", "seven", "eight", "nine", "colon",    /*  30 */    "semicolon", "less", "equal", "greater", "question",    "at", "A", "B", "C", "D",    /*  40 */    "E", "F", "G", "H", "I",    "J", "K", "L", "M", "N",    /*  50 */    "O", "P", "Q", "R", "S",    "T", "U", "V", "W", "X",    /*  60 */    "Y", "Z", "bracketleft", "backslash", "bracketright",    "asciicircum", "underscore", "grave", "a", "b",    /*  70 */    "c", "d", "e", "f", "g",    "h", "i", "j", "k", "l",    /*  80 */    "m", "n", "o", "p", "q",    "r", "s", "t", "u", "v",    /*  90 */    "w", "x", "y", "z", "braceleft",    "bar", "braceright", "asciitilde", "Adieresis", "Aring",    /* 100 */    "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis",    "aacute", "agrave", "acircumflex", "adieresis", "atilde",    /* 110 */    "aring", "ccedilla", "eacute", "egrave", "ecircumflex",    "edieresis", "iacute", "igrave", "icircumflex", "idieresis",    /* 120 */    "ntilde", "oacute", "ograve", "ocircumflex", "odieresis",    "otilde", "uacute", "ugrave", "ucircumflex", "udieresis",    /* 130 */    "dagger", "degree", "cent", "sterling", "section",    "bullet", "paragraph", "germandbls", "registered", "copyright",    /* 140 */    "trademark", "acute", "dieresis", "notequal", "AE",    "Oslash", "infinity", "plusminus", "lessequal", "greaterequal",    /* 150 */    "yen", "mu", "partialdiff", "summation", "product",    "pi", "integral", "ordfeminine", "ordmasculine", "Omega",    /* 160 */    "ae", "oslash", "questiondown", "exclamdown", "logicalnot",    "radical", "florin", "approxequal", "Delta", "guillemotleft",    /* 170 */    "guillemotright", "ellipsis", "nbspace", "Agrave", "Atilde",    "Otilde", "OE", "oe", "endash", "emdash",    /* 180 */    "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide",    "lozenge", "ydieresis", "Ydieresis", "fraction", "currency",    /* 190 */    "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl",    "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex",    /* 200 */    "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute",    "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex",    /* 210 */    "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave",    "dotlessi", "circumflex", "tilde", "macron", "breve",    /* 220 */    "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek",    "caron", "Lslash", "lslash", "Scaron", "scaron",    /* 230 */    "Zcaron", "zcaron", "brokenbar", "Eth", "eth",    "Yacute", "yacute", "Thorn", "thorn", "minus",    /* 240 */    "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf",    "onequarter", "threequarters", "franc", "Gbreve", "gbreve",    /* 250 */    "Idot", "Scedilla", "scedilla", "Cacute", "cacute",    "Ccaron", "ccaron", "dmacron",  };#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */  static FT_Error  load_format_20( TT_Face    face,                  FT_Stream  stream )  {    FT_Memory   memory = stream->memory;    FT_Error    error;    FT_Int      num_glyphs;    FT_UShort   num_names;    FT_UShort*  glyph_indices = 0;    FT_Char**   name_strings  = 0;    if ( FT_READ_USHORT( num_glyphs ) )      goto Exit;    /* UNDOCUMENTED!  The number of glyphs in this table can be smaller */    /* than the value in the maxp table (cf. cyberbit.ttf).             */    /* There already exist fonts which have more than 32768 glyph names */    /* in this table, so the test for this threshold has been dropped.  */    if ( num_glyphs > face->max_profile.numGlyphs )    {      error = SFNT_Err_Invalid_File_Format;      goto Exit;    }    /* load the indices */    {      FT_Int  n;      if ( FT_NEW_ARRAY ( glyph_indices, num_glyphs ) ||           FT_FRAME_ENTER( num_glyphs * 2L )          )        goto Fail;      for ( n = 0; n < num_glyphs; n++ )        glyph_indices[n] = FT_GET_USHORT();      FT_FRAME_EXIT();    }    /* compute number of names stored in table */    {      FT_Int  n;      num_names = 0;      for ( n = 0; n < num_glyphs; n++ )      {        FT_Int  idx;        idx = glyph_indices[n];        if ( idx >= 258 )        {          idx -= 257;          if ( idx > num_names )            num_names = (FT_UShort)idx;        }      }    }    /* now load the name strings */    {      FT_UShort  n;      if ( FT_NEW_ARRAY( name_strings, num_names ) )        goto Fail;      for ( n = 0; n < num_names; n++ )      {        FT_UInt  len;        if ( FT_READ_BYTE  ( len )                    ||             FT_NEW_ARRAY( name_strings[n], len + 1 ) ||             FT_STREAM_READ  ( name_strings[n], len ) )          goto Fail1;        name_strings[n][len] = '\0';      }    }    /* all right, set table fields and exit successfully */    {      TT_Post_20  table = &face->postscript_names.names.format_20;      table->num_glyphs    = (FT_UShort)num_glyphs;      table->num_names     = (FT_UShort)num_names;      table->glyph_indices = glyph_indices;      table->glyph_names   = name_strings;    }    return SFNT_Err_Ok;  Fail1:    {      FT_UShort  n;      for ( n = 0; n < num_names; n++ )        FT_FREE( name_strings[n] );

⌨️ 快捷键说明

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