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

📄 harfbuzz-dump.c

📁 奇趣公司比较新的qt/emd版本
💻 C
📖 第 1 页 / 共 2 页
字号:
/* harfbuzz-dump.c: Dump OpenType layout tables * * Copyright (C) 2000 Red Hat Software * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */#include "harfbuzz-impl.h"#include "harfbuzz-dump.h"#include "harfbuzz-gdef-private.h"#include "harfbuzz-gsub-private.h"#include "harfbuzz-gpos-private.h"#include "harfbuzz-open-private.h"#include <stdarg.h>#define DUMP(format) dump (stream, indent, format)#define DUMP1(format, arg1) dump (stream, indent, format, arg1)#define DUMP2(format, arg1, arg2) dump (stream, indent, format, arg1, arg2)#define DUMP3(format, arg1, arg2, arg3) dump (stream, indent, format, arg1, arg2, arg3)#define DUMP_FINT(strct,fld) dump (stream, indent, "<" #fld ">%d</" #fld ">\n", (strct)->fld)#define DUMP_FUINT(strct,fld) dump (stream, indent, "<" #fld ">%u</" #fld ">\n", (strct)->fld)#define DUMP_FGLYPH(strct,fld) dump (stream, indent, "<" #fld ">%#06x</" #fld ">\n", (strct)->fld)#define DUMP_FGLYPH(strct,fld) dump (stream, indent, "<" #fld ">%#06x</" #fld ">\n", (strct)->fld)#define DUMP_USHORT_ARRAY(strct,fld,cnt) Dump_UShort_Array ((strct)->fld, cnt, #fld, stream, indent);#define DEF_DUMP(type) static void Dump_ ## type (HB_ ## type *type, FILE *stream, int indent, HB_Type hb_type)#define RECURSE(name, type, val) do {  DUMP ("<" #name ">\n"); Dump_ ## type (val, stream, indent + 1, hb_type); DUMP ("</" #name ">\n"); } while (0)#define RECURSE_NUM(name, i, type, val) do {  DUMP1 ("<" #name "> <!-- %d -->\n", i); Dump_ ## type (val, stream, indent + 1, hb_type); DUMP ("</" #name ">\n"); } while (0)#define DUMP_VALUE_RECORD(val, frmt) do {  DUMP ("<ValueRecord>\n"); Dump_ValueRecord (val, stream, indent + 1, hb_type, frmt); DUMP ("</ValueRecord>\n"); } while (0)static voiddo_indent (FILE *stream, int indent){  fprintf (stream, "%*s", indent * 3, "");}static voiddump (FILE *stream, int indent, const char *format, ...){  va_list list;  do_indent (stream, indent);  va_start (list, format);  vfprintf (stream, format, list);  va_end (list);}static voidDump_UShort_Array (FT_UShort *array, int count, const char *name, FILE *stream, int indent){  int i;  do_indent (stream, indent);  fprintf (stream, "<%s>", name);  for (i = 0; i < count; i++)    fprintf (stream, "%d%s", array[i], i == 0 ? "" : " ");  fprintf (stream, "</%s>\n", name);}static voidPrint_Tag (FT_ULong tag, FILE *stream){  fprintf (stream, "%c%c%c%c",	   (unsigned char)(tag >> 24),	   (unsigned char)((tag >> 16) & 0xff),	   (unsigned char)((tag >> 8) & 0xff),	   (unsigned char)(tag & 0xff));}DEF_DUMP (LangSys){  int i;  FT_UNUSED(hb_type);  DUMP_FUINT (LangSys, LookupOrderOffset);  DUMP_FUINT (LangSys, ReqFeatureIndex);  DUMP_FUINT (LangSys, FeatureCount);  for (i=0; i < LangSys->FeatureCount; i++)    DUMP1("<FeatureIndex>%d</FeatureIndex>\n", LangSys->FeatureIndex[i]);}DEF_DUMP (Script){  int i;  RECURSE (DefaultLangSys, LangSys, &Script->DefaultLangSys);  DUMP_FUINT (Script, LangSysCount);  for (i=0; i < Script->LangSysCount; i++)    {      do_indent (stream, indent);      fprintf (stream, "<LangSysTag>");      Print_Tag (Script->LangSysRecord[i].LangSysTag, stream);      fprintf (stream, "</LangSysTag>\n");      RECURSE_NUM (LangSys, i, LangSys, &Script->LangSysRecord[i].LangSys);    }}DEF_DUMP (ScriptList){  int i;  DUMP_FUINT (ScriptList, ScriptCount);  for (i=0; i < ScriptList->ScriptCount; i++)    {      do_indent (stream, indent);      fprintf (stream, "<ScriptTag>");      Print_Tag (ScriptList->ScriptRecord[i].ScriptTag, stream);      fprintf (stream, "</ScriptTag>\n");      RECURSE_NUM (Script, i, Script, &ScriptList->ScriptRecord[i].Script);    }}DEF_DUMP (Feature){  int i;  FT_UNUSED(hb_type);  DUMP_FUINT (Feature, FeatureParams);  DUMP_FUINT (Feature, LookupListCount);  for (i=0; i < Feature->LookupListCount; i++)    DUMP1("<LookupIndex>%d</LookupIndex>\n", Feature->LookupListIndex[i]);}DEF_DUMP (MarkRecord){  FT_UNUSED(hb_type);  DUMP_FUINT (MarkRecord, Class);  DUMP1("<Anchor>%d</Anchor>\n", MarkRecord->MarkAnchor.PosFormat );}DEF_DUMP (MarkArray){  int i;  DUMP_FUINT (MarkArray, MarkCount);  for (i=0; i < MarkArray->MarkCount; i++)    RECURSE_NUM (MarkRecord, i, MarkRecord, &MarkArray->MarkRecord[i]);}DEF_DUMP (FeatureList){  int i;  DUMP_FUINT (FeatureList, FeatureCount);  for (i=0; i < FeatureList->FeatureCount; i++)    {      do_indent (stream, indent);      fprintf (stream, "<FeatureTag>");      Print_Tag (FeatureList->FeatureRecord[i].FeatureTag, stream);      fprintf (stream, "</FeatureTag> <!-- %d -->\n", i);      RECURSE_NUM (Feature, i, Feature, &FeatureList->FeatureRecord[i].Feature);    }}DEF_DUMP (Coverage){  FT_UNUSED(hb_type);  DUMP_FUINT (Coverage, CoverageFormat);  if (Coverage->CoverageFormat == 1)    {      int i;      DUMP_FUINT (&Coverage->cf.cf1, GlyphCount);      for (i = 0; i < Coverage->cf.cf1.GlyphCount; i++)	DUMP2("<Glyph>%#06x</Glyph> <!-- %d -->\n",	      Coverage->cf.cf1.GlyphArray[i], i);    }  else    {      int i;      DUMP_FUINT (&Coverage->cf.cf2, RangeCount);      for ( i = 0; i < Coverage->cf.cf2.RangeCount; i++ )	  DUMP3("<Glyph>%#06x - %#06x</Glyph> <!-- %d -->\n",	        Coverage->cf.cf2.RangeRecord[i].Start,	        Coverage->cf.cf2.RangeRecord[i].End, i);    }}DEF_DUMP (ClassRangeRecord){  FT_UNUSED(hb_type);  DUMP_FGLYPH (ClassRangeRecord, Start);  DUMP_FGLYPH (ClassRangeRecord, End);  DUMP_FUINT (ClassRangeRecord, Class);}DEF_DUMP (ClassDefinition){  FT_UNUSED(hb_type);  DUMP_FUINT( ClassDefinition, ClassFormat);  DUMP_FUINT( ClassDefinition, loaded);  if (ClassDefinition->ClassFormat == 1)    {      int i;      HB_ClassDefFormat1 *ClassDefFormat1 = &ClassDefinition->cd.cd1;      DUMP("<ClassDefinition>\n");      DUMP_FUINT (ClassDefFormat1, StartGlyph );      DUMP_FUINT (ClassDefFormat1, GlyphCount );      for (i = 0; i < ClassDefFormat1->GlyphCount; i++)	DUMP2(" <Class>%d</Class> <!-- %#06x -->", ClassDefFormat1->ClassValueArray[i],	      ClassDefFormat1->StartGlyph+i );    }  else if (ClassDefinition->ClassFormat == 2)    {      int i;      HB_ClassDefFormat2 *ClassDefFormat2 = &ClassDefinition->cd.cd2;      DUMP_FUINT (ClassDefFormat2, ClassRangeCount);      for (i = 0; i < ClassDefFormat2->ClassRangeCount; i++)	RECURSE_NUM (ClassRangeRecord, i, ClassRangeRecord, &ClassDefFormat2->ClassRangeRecord[i]);    }  else    fprintf(stderr, "invalid class def table!!!\n");}DEF_DUMP (SubstLookupRecord){  FT_UNUSED(hb_type);  DUMP_FUINT (SubstLookupRecord, SequenceIndex);  DUMP_FUINT (SubstLookupRecord, LookupListIndex);}DEF_DUMP (ChainSubClassRule){  int i;  DUMP_USHORT_ARRAY (ChainSubClassRule, Backtrack, ChainSubClassRule->BacktrackGlyphCount);  DUMP_USHORT_ARRAY (ChainSubClassRule, Input, ChainSubClassRule->InputGlyphCount - 1);  DUMP_USHORT_ARRAY (ChainSubClassRule, Lookahead, ChainSubClassRule->LookaheadGlyphCount);  for (i = 0; i < ChainSubClassRule->SubstCount; i++)    RECURSE_NUM (SubstLookupRecord, i, SubstLookupRecord, &ChainSubClassRule->SubstLookupRecord[i]);  indent--;}DEF_DUMP (ChainSubClassSet){  int i;  DUMP_FUINT( ChainSubClassSet, ChainSubClassRuleCount );  for (i = 0; i < ChainSubClassSet->ChainSubClassRuleCount; i++)    RECURSE_NUM (ChainSubClassRule, i, ChainSubClassRule, &ChainSubClassSet->ChainSubClassRule[i]);}static voidDump_GSUB_Lookup_Single (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type){  HB_SingleSubst *SingleSubst = &subtable->st.gsub.single;  DUMP_FUINT (SingleSubst, SubstFormat);  RECURSE (Coverage, Coverage, &SingleSubst->Coverage);  if (SingleSubst->SubstFormat == 1)    {      DUMP_FINT (&SingleSubst->ssf.ssf1, DeltaGlyphID);    }  else    {      int i;      DUMP_FINT (&SingleSubst->ssf.ssf2, GlyphCount);      for (i=0; i < SingleSubst->ssf.ssf2.GlyphCount; i++)	DUMP2("<Substitute>%#06x</Substitute> <!-- %d -->\n", SingleSubst->ssf.ssf2.Substitute[i], i);    }}DEF_DUMP (Ligature){  int i;  FT_UNUSED(hb_type);  DUMP_FGLYPH (Ligature, LigGlyph);  DUMP_FUINT (Ligature, ComponentCount);  for (i=0; i < Ligature->ComponentCount - 1; i++)    DUMP1("<Component>%#06x</Component>\n", Ligature->Component[i]);}DEF_DUMP (LigatureSet){  int i;  DUMP_FUINT (LigatureSet, LigatureCount);  for (i=0; i < LigatureSet->LigatureCount; i++)    RECURSE_NUM (Ligature, i, Ligature, &LigatureSet->Ligature[i]);}static voidDump_GSUB_Lookup_Ligature (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type){  int i;  HB_LigatureSubst *LigatureSubst = &subtable->st.gsub.ligature;  DUMP_FUINT (LigatureSubst, SubstFormat);  RECURSE (Coverage, Coverage, &LigatureSubst->Coverage);  DUMP_FUINT (LigatureSubst, LigatureSetCount);  for (i=0; i < LigatureSubst->LigatureSetCount; i++)    RECURSE_NUM (LigatureSet, i, LigatureSet, &LigatureSubst->LigatureSet[i]);}DEF_DUMP (ContextSubstFormat1){  FT_UNUSED(hb_type);  FT_UNUSED(ContextSubstFormat1);  DUMP("<!-- Not implemented!!! -->\n");}DEF_DUMP (ContextSubstFormat2){  DUMP_FUINT (ContextSubstFormat2, MaxContextLength);  RECURSE (Coverage, Coverage, &ContextSubstFormat2->Coverage);  RECURSE (ClassDefinition, ClassDefinition, &ContextSubstFormat2->ClassDef);}DEF_DUMP (ContextSubstFormat3){  FT_UNUSED(hb_type);  FT_UNUSED(ContextSubstFormat3);  DUMP("<!-- Not implemented!!! -->\n");}static voidDump_GSUB_Lookup_Context (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type){  HB_ContextSubst *ContextSubst = &subtable->st.gsub.context;  DUMP_FUINT (ContextSubst, SubstFormat);  switch( ContextSubst->SubstFormat )    {    case 1:      Dump_ContextSubstFormat1 (&ContextSubst->csf.csf1, stream, indent+2, hb_type);      break;    case 2:      Dump_ContextSubstFormat2 (&ContextSubst->csf.csf2, stream, indent+2, hb_type);

⌨️ 快捷键说明

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