[HB] Remove old code!

Goodbye 16 thousand lines of ten-year old code!
This commit is contained in:
Behdad Esfahbod 2009-05-24 14:22:22 -04:00
parent e5372f1621
commit da2c52abcd
22 changed files with 0 additions and 16691 deletions

View File

@ -1,97 +0,0 @@
/*
* Copyright (C) 2000 Red Hat, Inc.
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Owen Taylor
*/
#include <stdio.h>
#include <stdlib.h>
#include "harfbuzz.h"
#include "harfbuzz-dump.h"
#define N_ELEMENTS(arr) (sizeof(arr)/ sizeof((arr)[0]))
static int
croak (const char *situation, HB_Error error)
{
fprintf (stderr, "%s: Error %d\n", situation, error);
exit (1);
}
int
main (int argc, char **argv)
{
HB_Error error;
FT_Library library;
HB_Font font;
HB_GSUB gsub;
HB_GPOS gpos;
if (argc != 2)
{
fprintf (stderr, "Usage: harfbuzz-dump MYFONT.TTF\n");
exit(1);
}
if ((error = FT_Init_FreeType (&library)))
croak ("FT_Init_FreeType", error);
if ((error = FT_New_Face (library, argv[1], 0, &font)))
croak ("FT_New_Face", error);
printf ("<?xml version=\"1.0\"?>\n");
printf ("<OpenType>\n");
if (!(error = HB_Load_GSUB_Table (font, &gsub, NULL)))
{
HB_Dump_GSUB_Table (gsub, stdout);
if ((error = HB_Done_GSUB_Table (gsub)))
croak ("HB_Done_GSUB_Table", error);
}
else if (error != HB_Err_Not_Covered)
fprintf (stderr, "HB_Load_GSUB_Table: error 0x%x\n", error);
if (!(error = HB_Load_GPOS_Table (font, &gpos, NULL)))
{
HB_Dump_GPOS_Table (gpos, stdout);
if ((error = HB_Done_GPOS_Table (gpos)))
croak ("HB_Done_GPOS_Table", error);
}
else if (error != HB_Err_Not_Covered)
fprintf (stderr, "HB_Load_GPOS_Table: error 0x%x\n", error);
printf ("</OpenType>\n");
if ((error = FT_Done_Face (font)))
croak ("FT_Done_Face", error);
if ((error = FT_Done_FreeType (library)))
croak ("FT_Done_FreeType", error);
return 0;
}

View File

@ -1,768 +0,0 @@
/*
* Copyright (C) 2000, 2007 Red Hat, Inc.
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Owen Taylor, Behdad Esfahbod
*/
#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 void
do_indent (FILE *stream, int indent)
{
fprintf (stream, "%*s", indent * 3, "");
}
#if __GNUC__ >= 3
__attribute__((__format__(__printf__, 3, 4)))
#endif
static void
dump (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 void
Dump_UShort_Array (HB_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 void
Print_Tag (HB_UInt 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;
HB_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 (ScriptTable)
{
int i;
RECURSE (DefaultLangSys, LangSys, &ScriptTable->DefaultLangSys);
DUMP_FUINT (ScriptTable, LangSysCount);
for (i=0; i < ScriptTable->LangSysCount; i++)
{
do_indent (stream, indent);
fprintf (stream, "<LangSysTag>");
Print_Tag (ScriptTable->LangSysRecord[i].LangSysTag, stream);
fprintf (stream, "</LangSysTag>\n");
RECURSE_NUM (LangSys, i, LangSys, &ScriptTable->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, ScriptTable, &ScriptList->ScriptRecord[i].Script);
}
}
DEF_DUMP (Feature)
{
int i;
HB_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)
{
HB_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)
{
HB_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)
{
HB_UNUSED(hb_type);
DUMP_FGLYPH (ClassRangeRecord, Start);
DUMP_FGLYPH (ClassRangeRecord, End);
DUMP_FUINT (ClassRangeRecord, Class);
}
DEF_DUMP (ClassDefinition)
{
HB_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)
{
HB_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 void
Dump_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;
HB_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 void
Dump_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)
{
HB_UNUSED(hb_type);
HB_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)
{
HB_UNUSED(hb_type);
HB_UNUSED(ContextSubstFormat3);
DUMP("<!-- Not implemented!!! -->\n");
}
static void
Dump_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);
break;
case 3:
Dump_ContextSubstFormat3 (&ContextSubst->csf.csf3, stream, indent+2, hb_type);
break;
default:
fprintf(stderr, "invalid subformat!!!!!\n");
}
}
DEF_DUMP (ChainContextSubstFormat1)
{
HB_UNUSED(hb_type);
HB_UNUSED(ChainContextSubstFormat1);
DUMP("<!-- Not implemented!!! -->\n");
}
DEF_DUMP (ChainContextSubstFormat2)
{
int i;
RECURSE (Coverage, Coverage, &ChainContextSubstFormat2->Coverage);
DUMP_FUINT (ChainContextSubstFormat2, MaxBacktrackLength);
RECURSE (ClassDefinition, ClassDefinition, &ChainContextSubstFormat2->BacktrackClassDef);
DUMP_FUINT (ChainContextSubstFormat2, MaxInputLength);
RECURSE (ClassDefinition, ClassDefinition, &ChainContextSubstFormat2->InputClassDef);
DUMP_FUINT (ChainContextSubstFormat2, MaxLookaheadLength);
RECURSE (ClassDefinition, ClassDefinition, &ChainContextSubstFormat2->LookaheadClassDef);
DUMP_FUINT (ChainContextSubstFormat2, ChainSubClassSetCount);
for (i = 0; i < ChainContextSubstFormat2->ChainSubClassSetCount; i++)
RECURSE (ChainSubClassSet, ChainSubClassSet, &ChainContextSubstFormat2->ChainSubClassSet[i]);
}
DEF_DUMP (ChainContextSubstFormat3)
{
int i;
DUMP_FUINT (ChainContextSubstFormat3, BacktrackGlyphCount);
for (i = 0; i < ChainContextSubstFormat3->BacktrackGlyphCount; i++)
RECURSE (BacktrackCoverage, Coverage, &ChainContextSubstFormat3->BacktrackCoverage[i]);
DUMP_FUINT (ChainContextSubstFormat3, InputGlyphCount);
for (i = 0; i < ChainContextSubstFormat3->InputGlyphCount; i++)
RECURSE (InputCoverage, Coverage, &ChainContextSubstFormat3->InputCoverage[i]);
DUMP_FUINT (ChainContextSubstFormat3, LookaheadGlyphCount);
for (i = 0; i < ChainContextSubstFormat3->LookaheadGlyphCount; i++)
RECURSE (LookaheadCoverage, Coverage, &ChainContextSubstFormat3->LookaheadCoverage[i]);
for (i = 0; i < ChainContextSubstFormat3->SubstCount; i++)
RECURSE_NUM (SubstLookupRecord, i, SubstLookupRecord, &ChainContextSubstFormat3->SubstLookupRecord[i]);
}
static void
Dump_GSUB_Lookup_Chain (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type)
{
HB_ChainContextSubst *chain = &subtable->st.gsub.chain;
DUMP_FUINT (chain, SubstFormat);
switch (chain->SubstFormat)
{
case 1:
Dump_ChainContextSubstFormat1 (&chain->ccsf.ccsf1, stream, indent+2, hb_type);
break;
case 2:
Dump_ChainContextSubstFormat2 (&chain->ccsf.ccsf2, stream, indent+2, hb_type);
break;
case 3:
Dump_ChainContextSubstFormat3 (&chain->ccsf.ccsf3, stream, indent+2, hb_type);
break;
default:
fprintf(stderr, "invalid subformat!!!!!\n");
}
}
static void
Dump_Device (HB_Device *Device, FILE *stream, int indent, HB_Type hb_type)
{
int i;
int bits;
int n_per;
unsigned int mask;
HB_UNUSED(hb_type);
DUMP_FUINT (Device, StartSize);
DUMP_FUINT (Device, EndSize);
DUMP_FUINT (Device, DeltaFormat);
switch (Device->DeltaFormat)
{
case 1:
bits = 2;
break;
case 2:
bits = 4;
break;
case 3:
bits = 8;
break;
default:
bits = 0;
break;
}
DUMP ("<DeltaValue>");
if (!bits)
{
fprintf(stderr, "invalid DeltaFormat!!!!!\n");
}
else
{
n_per = 16 / bits;
mask = (1 << bits) - 1;
mask = mask << (16 - bits);
for (i = Device->StartSize; i <= Device->EndSize ; i++)
{
HB_UShort val = Device->DeltaValue[i / n_per];
HB_Short signed_val = ((val << ((i % n_per) * bits)) & mask);
dump (stream, indent, "%d", signed_val >> (16 - bits));
if (i != Device->EndSize)
DUMP (", ");
}
}
DUMP ("</DeltaValue>\n");
}
static void
Dump_ValueRecord (HB_ValueRecord *ValueRecord, FILE *stream, int indent, HB_Type hb_type, HB_UShort value_format)
{
if (value_format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT)
DUMP_FINT (ValueRecord, XPlacement);
if (value_format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT)
DUMP_FINT (ValueRecord, YPlacement);
if (value_format & HB_GPOS_FORMAT_HAVE_X_ADVANCE)
DUMP_FINT (ValueRecord, XAdvance);
if (value_format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE)
DUMP_FINT (ValueRecord, XAdvance);
if (value_format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE)
RECURSE (Device, Device, &ValueRecord->XPlacementDevice);
if (value_format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE)
RECURSE (Device, Device, &ValueRecord->YPlacementDevice);
if (value_format & HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE)
RECURSE (Device, Device, &ValueRecord->XAdvanceDevice);
if (value_format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE)
RECURSE (Device, Device, &ValueRecord->YAdvanceDevice);
if (value_format & HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT)
DUMP_FUINT (ValueRecord, XIdPlacement);
if (value_format & HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT)
DUMP_FUINT (ValueRecord, YIdPlacement);
if (value_format & HB_GPOS_FORMAT_HAVE_X_ID_ADVANCE)
DUMP_FUINT (ValueRecord, XIdAdvance);
if (value_format & HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE)
DUMP_FUINT (ValueRecord, XIdAdvance);
}
static void
Dump_GPOS_Lookup_Single (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type)
{
HB_SinglePos *SinglePos = &subtable->st.gpos.single;
DUMP_FUINT (SinglePos, PosFormat);
RECURSE (Coverage, Coverage, &SinglePos->Coverage);
DUMP_FUINT (SinglePos, ValueFormat);
if (SinglePos->PosFormat == 1)
{
DUMP_VALUE_RECORD (&SinglePos->spf.spf1.Value, SinglePos->ValueFormat);
}
else
{
int i;
DUMP_FUINT (&SinglePos->spf.spf2, ValueCount);
for (i = 0; i < SinglePos->spf.spf2.ValueCount; i++)
DUMP_VALUE_RECORD (&SinglePos->spf.spf2.Value[i], SinglePos->ValueFormat);
}
}
static void
Dump_PairValueRecord (HB_PairValueRecord *PairValueRecord, FILE *stream, int indent, HB_Type hb_type, HB_UShort ValueFormat1, HB_UShort ValueFormat2)
{
DUMP_FUINT (PairValueRecord, SecondGlyph);
DUMP_VALUE_RECORD (&PairValueRecord->Value1, ValueFormat1);
DUMP_VALUE_RECORD (&PairValueRecord->Value2, ValueFormat2);
}
static void
Dump_PairSet (HB_PairSet *PairSet, FILE *stream, int indent, HB_Type hb_type, HB_UShort ValueFormat1, HB_UShort ValueFormat2)
{
int i;
DUMP_FUINT (PairSet, PairValueCount);
for (i = 0; i < PairSet->PairValueCount; i++)
{
DUMP ("<PairValueRecord>\n");
Dump_PairValueRecord (&PairSet->PairValueRecord[i], stream, indent + 1, hb_type, ValueFormat1, ValueFormat2);
DUMP ("</PairValueRecord>\n");
}
}
static void
Dump_GPOS_Lookup_Pair (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type)
{
HB_PairPos *PairPos = &subtable->st.gpos.pair;
DUMP_FUINT (PairPos, PosFormat);
RECURSE (Coverage, Coverage, &PairPos->Coverage);
DUMP_FUINT (PairPos, ValueFormat1);
DUMP_FUINT (PairPos, ValueFormat2);
if (PairPos->PosFormat == 1)
{
int i;
DUMP_FUINT (&PairPos->ppf.ppf1, PairSetCount);
for (i = 0; i < PairPos->ppf.ppf1.PairSetCount; i++)
{
DUMP ("<PairSet>\n");
Dump_PairSet (&PairPos->ppf.ppf1.PairSet[i], stream, indent + 1, hb_type, PairPos->ValueFormat1, PairPos->ValueFormat2);
DUMP ("</PairSet>\n");
}
}
else
{
}
}
static void
Dump_GPOS_Lookup_Markbase (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type)
{
int i;
HB_MarkBasePos *markbase = &subtable->st.gpos.markbase;
DUMP_FUINT (markbase, PosFormat);
RECURSE (Coverage, Coverage, &markbase->MarkCoverage);
RECURSE (Coverage, Coverage, &markbase->BaseCoverage);
DUMP_FUINT (markbase, ClassCount);
RECURSE (MarkArray, MarkArray, &markbase->MarkArray);
DUMP ("<BaseArray>\n");
indent++;
DUMP_FUINT (&markbase->BaseArray, BaseCount);
for (i = 0; i < markbase->BaseArray.BaseCount; i++)
{
int j;
HB_BaseRecord *r = &markbase->BaseArray.BaseRecord[i];
DUMP1 ("<BaseRecord> <!-- %d -->\n", i);
for (j = 0; j < markbase->ClassCount; j++)
DUMP1 (" <Anchor>%d</Anchor>\n", r->BaseAnchor->PosFormat);
DUMP ("<BaseRecord>\n");
}
indent--;
DUMP ("</BaseArray>\n");
}
DEF_DUMP (Lookup)
{
int i;
const char *lookup_name;
void (*lookup_func) (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type) = NULL;
if (hb_type == HB_Type_GSUB)
{
switch (Lookup->LookupType)
{
case HB_GSUB_LOOKUP_SINGLE:
lookup_name = "SINGLE";
lookup_func = Dump_GSUB_Lookup_Single;
break;
case HB_GSUB_LOOKUP_MULTIPLE:
lookup_name = "MULTIPLE";
break;
case HB_GSUB_LOOKUP_ALTERNATE:
lookup_name = "ALTERNATE";
break;
case HB_GSUB_LOOKUP_LIGATURE:
lookup_name = "LIGATURE";
lookup_func = Dump_GSUB_Lookup_Ligature;
break;
case HB_GSUB_LOOKUP_CONTEXT:
lookup_name = "CONTEXT";
lookup_func = Dump_GSUB_Lookup_Context;
break;
case HB_GSUB_LOOKUP_CHAIN:
lookup_name = "CHAIN";
lookup_func = Dump_GSUB_Lookup_Chain;
break;
default:
lookup_name = "(unknown)";
lookup_func = NULL;
break;
}
}
else
{
switch (Lookup->LookupType)
{
case HB_GPOS_LOOKUP_SINGLE:
lookup_name = "SINGLE";
lookup_func = Dump_GPOS_Lookup_Single;
break;
case HB_GPOS_LOOKUP_PAIR:
lookup_name = "PAIR";
lookup_func = Dump_GPOS_Lookup_Pair;
break;
case HB_GPOS_LOOKUP_CURSIVE:
lookup_name = "CURSIVE";
break;
case HB_GPOS_LOOKUP_MARKBASE:
lookup_name = "MARKBASE";
lookup_func = Dump_GPOS_Lookup_Markbase;
break;
case HB_GPOS_LOOKUP_MARKLIG:
lookup_name = "MARKLIG";
break;
case HB_GPOS_LOOKUP_MARKMARK:
lookup_name = "MARKMARK";
break;
case HB_GPOS_LOOKUP_CONTEXT:
lookup_name = "CONTEXT";
break;
case HB_GPOS_LOOKUP_CHAIN:
lookup_name = "CHAIN";
break;
default:
lookup_name = "(unknown)";
lookup_func = NULL;
break;
}
}
DUMP2("<LookupType>%s</LookupType> <!-- %d -->\n", lookup_name, Lookup->LookupType);
DUMP1("<LookupFlag>%#06x</LookupFlag>\n", Lookup->LookupFlag);
for (i=0; i < Lookup->SubTableCount; i++)
{
DUMP ("<Subtable>\n");
if (lookup_func)
(*lookup_func) (&Lookup->SubTable[i], stream, indent + 1, hb_type);
DUMP ("</Subtable>\n");
}
}
DEF_DUMP (LookupList)
{
int i;
DUMP_FUINT (LookupList, LookupCount);
for (i=0; i < LookupList->LookupCount; i++)
RECURSE_NUM (Lookup, i, Lookup, &LookupList->Lookup[i]);
}
void
HB_Dump_GSUB_Table (HB_GSUB gsub, FILE *stream)
{
int indent = 1;
HB_Type hb_type = HB_Type_GSUB;
do_indent (stream, indent);
fprintf(stream, "<!-- GSUB -->\n");
RECURSE (ScriptList, ScriptList, &gsub->ScriptList);
RECURSE (FeatureList, FeatureList, &gsub->FeatureList);
RECURSE (LookupList, LookupList, &gsub->LookupList);
}
void
HB_Dump_GPOS_Table (HB_GPOS gpos, FILE *stream)
{
int indent = 1;
HB_Type hb_type = HB_Type_GPOS;
do_indent (stream, indent);
fprintf(stream, "<!-- GPOS -->\n");
RECURSE (ScriptList, ScriptList, &gpos->ScriptList);
RECURSE (FeatureList, FeatureList, &gpos->FeatureList);
RECURSE (LookupList, LookupList, &gpos->LookupList);
}

View File

@ -1,41 +0,0 @@
/*
* Copyright (C) 2000, 2007 Red Hat, Inc.
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Owen Taylor, Behdad Esfahbod
*/
#ifndef HARFBUZZ_DUMP_H
#define HARFBUZZ_DUMP_H
#include <stdio.h>
#include "harfbuzz-gsub.h"
#include "harfbuzz-gpos.h"
HB_BEGIN_HEADER
void HB_Dump_GSUB_Table (HB_GSUB gsub, FILE *stream);
void HB_Dump_GPOS_Table (HB_GPOS gpos, FILE *stream);
HB_END_HEADER
#endif /* HARFBUZZ_DUMP_H */

View File

@ -1,124 +0,0 @@
/*
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
* Copyright (C) 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HARFBUZZ_GDEF_PRIVATE_H
#define HARFBUZZ_GDEF_PRIVATE_H
#include "harfbuzz-impl.h"
#include "harfbuzz-stream-private.h"
#include "harfbuzz-buffer-private.h"
#include "harfbuzz-gdef.h"
HB_BEGIN_HEADER
/* Attachment related structures */
struct HB_AttachPoint_
{
HB_UShort PointCount; /* size of the PointIndex array */
HB_UShort* PointIndex; /* array of contour points */
};
/* Ligature Caret related structures */
struct HB_CaretValueFormat1_
{
HB_Short Coordinate; /* x or y value (in design units) */
};
typedef struct HB_CaretValueFormat1_ HB_CaretValueFormat1;
struct HB_CaretValueFormat2_
{
HB_UShort CaretValuePoint; /* contour point index on glyph */
};
typedef struct HB_CaretValueFormat2_ HB_CaretValueFormat2;
struct HB_CaretValueFormat3_
{
HB_Short Coordinate; /* x or y value (in design units) */
HB_Device Device; /* Device table for x or y value */
};
typedef struct HB_CaretValueFormat3_ HB_CaretValueFormat3;
struct HB_CaretValueFormat4_
{
HB_UShort IdCaretValue; /* metric ID */
};
typedef struct HB_CaretValueFormat4_ HB_CaretValueFormat4;
struct HB_CaretValue_
{
HB_UShort CaretValueFormat; /* 1, 2, 3, or 4 */
union
{
HB_CaretValueFormat1 cvf1;
HB_CaretValueFormat2 cvf2;
HB_CaretValueFormat3 cvf3;
HB_CaretValueFormat4 cvf4;
} cvf;
};
typedef struct HB_CaretValue_ HB_CaretValue;
struct HB_LigGlyph_
{
HB_Bool loaded;
HB_UShort CaretCount; /* number of caret values */
HB_CaretValue* CaretValue; /* array of caret values */
};
HB_INTERNAL HB_Error
_HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef,
HB_UShort glyphID,
HB_UShort properties );
HB_INTERNAL HB_Error
_HB_GDEF_Check_Property( HB_GDEFHeader* gdef,
HB_GlyphItem item,
HB_UShort flags,
HB_UShort* properties );
HB_INTERNAL HB_Error
_HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags( HB_GDEFHeader* gdef,
HB_Stream input,
HB_Lookup* lo,
HB_UShort num_lookups );
HB_END_HEADER
#endif /* HARFBUZZ_GDEF_PRIVATE_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,135 +0,0 @@
/*
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
* Copyright (C) 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HARFBUZZ_GDEF_H
#define HARFBUZZ_GDEF_H
#include "harfbuzz-open.h"
HB_BEGIN_HEADER
/* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding
* flag in the LookupFlag field. */
#define HB_GDEF_BASE_GLYPH 0x0002
#define HB_GDEF_LIGATURE 0x0004
#define HB_GDEF_MARK 0x0008
#define HB_GDEF_COMPONENT 0x0010
typedef struct HB_AttachPoint_ HB_AttachPoint;
struct HB_AttachList_
{
HB_Bool loaded;
HB_Coverage Coverage; /* Coverage table */
HB_UShort GlyphCount; /* number of glyphs with
attachments */
HB_AttachPoint* AttachPoint; /* array of AttachPoint tables */
};
typedef struct HB_AttachList_ HB_AttachList;
typedef struct HB_LigGlyph_ HB_LigGlyph;
struct HB_LigCaretList_
{
HB_Bool loaded;
HB_Coverage Coverage; /* Coverage table */
HB_UShort LigGlyphCount; /* number of ligature glyphs */
HB_LigGlyph* LigGlyph; /* array of LigGlyph tables */
};
typedef struct HB_LigCaretList_ HB_LigCaretList;
/* The `NewGlyphClasses' field is not defined in the TTO specification.
We use it for fonts with a constructed `GlyphClassDef' structure
(i.e., which don't have a GDEF table) to collect glyph classes
assigned during the lookup process. The number of arrays in this
pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth
array then contains the glyph class values of the glyphs not covered
by the ClassRangeRecords structures with index n-1 and n. We store
glyph class values for four glyphs in a single array element.
`LastGlyph' is identical to the number of glyphs minus one in the
font; we need it only if `NewGlyphClasses' is not NULL (to have an
upper bound for the last array).
Note that we first store the file offset to the `MarkAttachClassDef'
field (which has been introduced in OpenType 1.2) -- since the
`Version' field value hasn't been increased to indicate that we have
one more field for some obscure reason, we must parse the GSUB table
to find out whether class values refer to this table. Only then we
can finally load the MarkAttachClassDef structure if necessary. */
struct HB_GDEFHeader_
{
HB_UInt offset;
HB_16Dot16 Version;
HB_ClassDefinition GlyphClassDef;
HB_AttachList AttachList;
HB_LigCaretList LigCaretList;
HB_UInt MarkAttachClassDef_offset;
HB_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */
HB_UShort LastGlyph;
HB_UShort** NewGlyphClasses;
};
typedef struct HB_GDEFHeader_ HB_GDEFHeader;
typedef struct HB_GDEFHeader_* HB_GDEF;
HB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr );
HB_Error HB_Load_GDEF_Table( HB_Font font,
HB_GDEFHeader** gdef );
HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef );
HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
HB_UShort glyphID,
HB_UShort* properties );
HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
HB_UShort num_glyphs,
HB_UShort glyph_count,
HB_UShort* glyph_array,
HB_UShort* class_array );
HB_END_HEADER
#endif /* HARFBUZZ_GDEF_H */

View File

@ -1,84 +0,0 @@
/*
* Copyright (C) 2007 Trolltech ASA
* Copyright (C) 2007 Red Hat, Inc.
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Behdad Esfahbod
*/
#ifndef HARFBUZZ_GLOBAL_H
#define HARFBUZZ_GLOBAL_H
/* XXX */
#include "hb-ot-layout.h"
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef __cplusplus
#define HB_BEGIN_HEADER extern "C" {
#define HB_END_HEADER }
#else
#define HB_BEGIN_HEADER /* nothing */
#define HB_END_HEADER /* nothing */
#endif
HB_BEGIN_HEADER
#define HB_MAKE_TAG(a,b,c,d) FT_MAKE_TAG(a,b,c,d)
typedef FT_Pos HB_Fixed; /* 26.6 */
typedef FT_Fixed HB_16Dot16; /* 16.6 */
typedef FT_Face HB_Font;
typedef unsigned char HB_Byte;
typedef signed char HB_Char;
typedef unsigned short HB_UShort;
typedef signed short HB_Short;
typedef unsigned int HB_UInt;
typedef signed int HB_Int;
typedef int HB_Bool;
typedef void * HB_Pointer;
typedef enum {
/* no error */
HB_Err_Ok = 0x0000,
HB_Err_Not_Covered = 0xFFFF,
/* _hb_err() is called whenever returning the following errors,
* and in a couple places for HB_Err_Not_Covered too. */
/* programmer error */
HB_Err_Invalid_Argument = 0x1A66,
/* font error */
HB_Err_Invalid_SubTable_Format = 0x157F,
HB_Err_Invalid_SubTable = 0x1570,
HB_Err_Read_Error = 0x6EAD,
/* system error */
HB_Err_Out_Of_Memory = 0xDEAD
} HB_Error;
HB_END_HEADER
#endif

View File

@ -1,712 +0,0 @@
/*
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
* Copyright (C) 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HARFBUZZ_GPOS_PRIVATE_H
#define HARFBUZZ_GPOS_PRIVATE_H
#include "harfbuzz-impl.h"
#include "harfbuzz-stream-private.h"
#include "harfbuzz-gpos.h"
HB_BEGIN_HEADER
/* shared tables */
struct HB_ValueRecord_
{
HB_Short XPlacement; /* horizontal adjustment for
placement */
HB_Short YPlacement; /* vertical adjustment for
placement */
HB_Short XAdvance; /* horizontal adjustment for
advance */
HB_Short YAdvance; /* vertical adjustment for
advance */
HB_Device XPlacementDevice; /* device table for horizontal
placement */
HB_Device YPlacementDevice; /* device table for vertical
placement */
HB_Device XAdvanceDevice; /* device table for horizontal
advance */
HB_Device YAdvanceDevice; /* device table for vertical
advance */
HB_UShort XIdPlacement; /* horizontal placement metric ID */
HB_UShort YIdPlacement; /* vertical placement metric ID */
HB_UShort XIdAdvance; /* horizontal advance metric ID */
HB_UShort YIdAdvance; /* vertical advance metric ID */
};
typedef struct HB_ValueRecord_ HB_ValueRecord;
/* Mask values to scan the value format of the ValueRecord structure.
We always expand compressed ValueRecords of the font. */
#define HB_GPOS_FORMAT_HAVE_X_PLACEMENT 0x0001
#define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT 0x0002
#define HB_GPOS_FORMAT_HAVE_X_ADVANCE 0x0004
#define HB_GPOS_FORMAT_HAVE_Y_ADVANCE 0x0008
#define HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE 0x0010
#define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE 0x0020
#define HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE 0x0040
#define HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE 0x0080
#define HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT 0x0100
#define HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT 0x0200
#define HB_GPOS_FORMAT_HAVE_X_ID_ADVANCE 0x0400
#define HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE 0x0800
struct HB_AnchorFormat1_
{
HB_Short XCoordinate; /* horizontal value */
HB_Short YCoordinate; /* vertical value */
};
typedef struct HB_AnchorFormat1_ HB_AnchorFormat1;
struct HB_AnchorFormat2_
{
HB_Short XCoordinate; /* horizontal value */
HB_Short YCoordinate; /* vertical value */
HB_UShort AnchorPoint; /* index to glyph contour point */
};
typedef struct HB_AnchorFormat2_ HB_AnchorFormat2;
struct HB_AnchorFormat3_
{
HB_Short XCoordinate; /* horizontal value */
HB_Short YCoordinate; /* vertical value */
HB_Device XDeviceTable; /* device table for X coordinate */
HB_Device YDeviceTable; /* device table for Y coordinate */
};
typedef struct HB_AnchorFormat3_ HB_AnchorFormat3;
struct HB_AnchorFormat4_
{
HB_UShort XIdAnchor; /* horizontal metric ID */
HB_UShort YIdAnchor; /* vertical metric ID */
};
typedef struct HB_AnchorFormat4_ HB_AnchorFormat4;
struct HB_Anchor_
{
HB_UShort PosFormat; /* 1, 2, 3, or 4 -- 0 indicates
that there is no Anchor table */
union
{
HB_AnchorFormat1 af1;
HB_AnchorFormat2 af2;
HB_AnchorFormat3 af3;
HB_AnchorFormat4 af4;
} af;
};
typedef struct HB_Anchor_ HB_Anchor;
struct HB_MarkRecord_
{
HB_UShort Class; /* mark class */
HB_Anchor MarkAnchor; /* anchor table */
};
typedef struct HB_MarkRecord_ HB_MarkRecord;
struct HB_MarkArray_
{
HB_UShort MarkCount; /* number of MarkRecord tables */
HB_MarkRecord* MarkRecord; /* array of MarkRecord tables */
};
typedef struct HB_MarkArray_ HB_MarkArray;
/* LookupType 1 */
struct HB_SinglePosFormat1_
{
HB_ValueRecord Value; /* ValueRecord for all covered
glyphs */
};
typedef struct HB_SinglePosFormat1_ HB_SinglePosFormat1;
struct HB_SinglePosFormat2_
{
HB_UShort ValueCount; /* number of ValueRecord tables */
HB_ValueRecord* Value; /* array of ValueRecord tables */
};
typedef struct HB_SinglePosFormat2_ HB_SinglePosFormat2;
struct HB_SinglePos_
{
HB_UShort PosFormat; /* 1 or 2 */
HB_Coverage Coverage; /* Coverage table */
HB_UShort ValueFormat; /* format of ValueRecord table */
union
{
HB_SinglePosFormat1 spf1;
HB_SinglePosFormat2 spf2;
} spf;
};
typedef struct HB_SinglePos_ HB_SinglePos;
/* LookupType 2 */
struct HB_PairValueRecord_
{
HB_UShort SecondGlyph; /* glyph ID for second glyph */
HB_ValueRecord Value1; /* pos. data for first glyph */
HB_ValueRecord Value2; /* pos. data for second glyph */
};
typedef struct HB_PairValueRecord_ HB_PairValueRecord;
struct HB_PairSet_
{
HB_UShort PairValueCount;
/* number of PairValueRecord tables */
HB_PairValueRecord* PairValueRecord;
/* array of PairValueRecord tables */
};
typedef struct HB_PairSet_ HB_PairSet;
struct HB_PairPosFormat1_
{
HB_UShort PairSetCount; /* number of PairSet tables */
HB_PairSet* PairSet; /* array of PairSet tables */
};
typedef struct HB_PairPosFormat1_ HB_PairPosFormat1;
struct HB_Class2Record_
{
HB_ValueRecord Value1; /* pos. data for first glyph */
HB_ValueRecord Value2; /* pos. data for second glyph */
};
typedef struct HB_Class2Record_ HB_Class2Record;
struct HB_Class1Record_
{
HB_Class2Record* Class2Record; /* array of Class2Record tables */
};
typedef struct HB_Class1Record_ HB_Class1Record;
struct HB_PairPosFormat2_
{
HB_ClassDefinition ClassDef1; /* class def. for first glyph */
HB_ClassDefinition ClassDef2; /* class def. for second glyph */
HB_UShort Class1Count; /* number of classes in ClassDef1
table */
HB_UShort Class2Count; /* number of classes in ClassDef2
table */
HB_Class1Record* Class1Record; /* array of Class1Record tables */
};
typedef struct HB_PairPosFormat2_ HB_PairPosFormat2;
struct HB_PairPos_
{
HB_UShort PosFormat; /* 1 or 2 */
HB_Coverage Coverage; /* Coverage table */
HB_UShort ValueFormat1; /* format of ValueRecord table
for first glyph */
HB_UShort ValueFormat2; /* format of ValueRecord table
for second glyph */
union
{
HB_PairPosFormat1 ppf1;
HB_PairPosFormat2 ppf2;
} ppf;
};
typedef struct HB_PairPos_ HB_PairPos;
/* LookupType 3 */
struct HB_EntryExitRecord_
{
HB_Anchor EntryAnchor; /* entry Anchor table */
HB_Anchor ExitAnchor; /* exit Anchor table */
};
typedef struct HB_EntryExitRecord_ HB_EntryExitRecord;
struct HB_CursivePos_
{
HB_UShort PosFormat; /* always 1 */
HB_Coverage Coverage; /* Coverage table */
HB_UShort EntryExitCount;
/* number of EntryExitRecord tables */
HB_EntryExitRecord* EntryExitRecord;
/* array of EntryExitRecord tables */
};
typedef struct HB_CursivePos_ HB_CursivePos;
/* LookupType 4 */
struct HB_BaseRecord_
{
HB_Anchor* BaseAnchor; /* array of base glyph anchor
tables */
};
typedef struct HB_BaseRecord_ HB_BaseRecord;
struct HB_BaseArray_
{
HB_UShort BaseCount; /* number of BaseRecord tables */
HB_BaseRecord* BaseRecord; /* array of BaseRecord tables */
};
typedef struct HB_BaseArray_ HB_BaseArray;
struct HB_MarkBasePos_
{
HB_UShort PosFormat; /* always 1 */
HB_Coverage MarkCoverage; /* mark glyph coverage table */
HB_Coverage BaseCoverage; /* base glyph coverage table */
HB_UShort ClassCount; /* number of mark classes */
HB_MarkArray MarkArray; /* mark array table */
HB_BaseArray BaseArray; /* base array table */
};
typedef struct HB_MarkBasePos_ HB_MarkBasePos;
/* LookupType 5 */
struct HB_ComponentRecord_
{
HB_Anchor* LigatureAnchor; /* array of ligature glyph anchor
tables */
};
typedef struct HB_ComponentRecord_ HB_ComponentRecord;
struct HB_LigatureAttach_
{
HB_UShort ComponentCount;
/* number of ComponentRecord tables */
HB_ComponentRecord* ComponentRecord;
/* array of ComponentRecord tables */
};
typedef struct HB_LigatureAttach_ HB_LigatureAttach;
struct HB_LigatureArray_
{
HB_UShort LigatureCount; /* number of LigatureAttach tables */
HB_LigatureAttach* LigatureAttach;
/* array of LigatureAttach tables */
};
typedef struct HB_LigatureArray_ HB_LigatureArray;
struct HB_MarkLigPos_
{
HB_UShort PosFormat; /* always 1 */
HB_Coverage MarkCoverage; /* mark glyph coverage table */
HB_Coverage LigatureCoverage;
/* ligature glyph coverage table */
HB_UShort ClassCount; /* number of mark classes */
HB_MarkArray MarkArray; /* mark array table */
HB_LigatureArray LigatureArray; /* ligature array table */
};
typedef struct HB_MarkLigPos_ HB_MarkLigPos;
/* LookupType 6 */
struct HB_Mark2Record_
{
HB_Anchor* Mark2Anchor; /* array of mark glyph anchor
tables */
};
typedef struct HB_Mark2Record_ HB_Mark2Record;
struct HB_Mark2Array_
{
HB_UShort Mark2Count; /* number of Mark2Record tables */
HB_Mark2Record* Mark2Record; /* array of Mark2Record tables */
};
typedef struct HB_Mark2Array_ HB_Mark2Array;
struct HB_MarkMarkPos_
{
HB_UShort PosFormat; /* always 1 */
HB_Coverage Mark1Coverage; /* first mark glyph coverage table */
HB_Coverage Mark2Coverage; /* second mark glyph coverave table */
HB_UShort ClassCount; /* number of combining mark classes */
HB_MarkArray Mark1Array; /* MarkArray table for first mark */
HB_Mark2Array Mark2Array; /* MarkArray table for second mark */
};
typedef struct HB_MarkMarkPos_ HB_MarkMarkPos;
/* needed by both lookup type 7 and 8 */
struct HB_PosLookupRecord_
{
HB_UShort SequenceIndex; /* index into current
glyph sequence */
HB_UShort LookupListIndex; /* Lookup to apply to that pos. */
};
typedef struct HB_PosLookupRecord_ HB_PosLookupRecord;
/* LookupType 7 */
struct HB_PosRule_
{
HB_UShort GlyphCount; /* total number of input glyphs */
HB_UShort PosCount; /* number of PosLookupRecord tables */
HB_UShort* Input; /* array of input glyph IDs */
HB_PosLookupRecord* PosLookupRecord;
/* array of PosLookupRecord tables */
};
typedef struct HB_PosRule_ HB_PosRule;
struct HB_PosRuleSet_
{
HB_UShort PosRuleCount; /* number of PosRule tables */
HB_PosRule* PosRule; /* array of PosRule tables */
};
typedef struct HB_PosRuleSet_ HB_PosRuleSet;
struct HB_ContextPosFormat1_
{
HB_Coverage Coverage; /* Coverage table */
HB_UShort PosRuleSetCount; /* number of PosRuleSet tables */
HB_PosRuleSet* PosRuleSet; /* array of PosRuleSet tables */
};
typedef struct HB_ContextPosFormat1_ HB_ContextPosFormat1;
struct HB_PosClassRule_
{
HB_UShort GlyphCount; /* total number of context classes */
HB_UShort PosCount; /* number of PosLookupRecord tables */
HB_UShort* Class; /* array of classes */
HB_PosLookupRecord* PosLookupRecord;
/* array of PosLookupRecord tables */
};
typedef struct HB_PosClassRule_ HB_PosClassRule;
struct HB_PosClassSet_
{
HB_UShort PosClassRuleCount;
/* number of PosClassRule tables */
HB_PosClassRule* PosClassRule; /* array of PosClassRule tables */
};
typedef struct HB_PosClassSet_ HB_PosClassSet;
/* The `MaxContextLength' field is not defined in the TTO specification
but simplifies the implementation of this format. It holds the
maximal context length used in the context rules. */
struct HB_ContextPosFormat2_
{
HB_UShort MaxContextLength;
/* maximal context length */
HB_Coverage Coverage; /* Coverage table */
HB_ClassDefinition ClassDef; /* ClassDef table */
HB_UShort PosClassSetCount;
/* number of PosClassSet tables */
HB_PosClassSet* PosClassSet; /* array of PosClassSet tables */
};
typedef struct HB_ContextPosFormat2_ HB_ContextPosFormat2;
struct HB_ContextPosFormat3_
{
HB_UShort GlyphCount; /* number of input glyphs */
HB_UShort PosCount; /* number of PosLookupRecord tables */
HB_Coverage* Coverage; /* array of Coverage tables */
HB_PosLookupRecord* PosLookupRecord;
/* array of PosLookupRecord tables */
};
typedef struct HB_ContextPosFormat3_ HB_ContextPosFormat3;
struct HB_ContextPos_
{
HB_UShort PosFormat; /* 1, 2, or 3 */
union
{
HB_ContextPosFormat1 cpf1;
HB_ContextPosFormat2 cpf2;
HB_ContextPosFormat3 cpf3;
} cpf;
};
typedef struct HB_ContextPos_ HB_ContextPos;
/* LookupType 8 */
struct HB_ChainPosRule_
{
HB_UShort BacktrackGlyphCount;
/* total number of backtrack glyphs */
HB_UShort* Backtrack; /* array of backtrack glyph IDs */
HB_UShort InputGlyphCount;
/* total number of input glyphs */
HB_UShort* Input; /* array of input glyph IDs */
HB_UShort LookaheadGlyphCount;
/* total number of lookahead glyphs */
HB_UShort* Lookahead; /* array of lookahead glyph IDs */
HB_UShort PosCount; /* number of PosLookupRecords */
HB_PosLookupRecord* PosLookupRecord;
/* array of PosLookupRecords */
};
typedef struct HB_ChainPosRule_ HB_ChainPosRule;
struct HB_ChainPosRuleSet_
{
HB_UShort ChainPosRuleCount;
/* number of ChainPosRule tables */
HB_ChainPosRule* ChainPosRule; /* array of ChainPosRule tables */
};
typedef struct HB_ChainPosRuleSet_ HB_ChainPosRuleSet;
struct HB_ChainContextPosFormat1_
{
HB_Coverage Coverage; /* Coverage table */
HB_UShort ChainPosRuleSetCount;
/* number of ChainPosRuleSet tables */
HB_ChainPosRuleSet* ChainPosRuleSet;
/* array of ChainPosRuleSet tables */
};
typedef struct HB_ChainContextPosFormat1_ HB_ChainContextPosFormat1;
struct HB_ChainPosClassRule_
{
HB_UShort BacktrackGlyphCount;
/* total number of backtrack
classes */
HB_UShort* Backtrack; /* array of backtrack classes */
HB_UShort InputGlyphCount;
/* total number of context classes */
HB_UShort* Input; /* array of context classes */
HB_UShort LookaheadGlyphCount;
/* total number of lookahead
classes */
HB_UShort* Lookahead; /* array of lookahead classes */
HB_UShort PosCount; /* number of PosLookupRecords */
HB_PosLookupRecord* PosLookupRecord;
/* array of substitution lookups */
};
typedef struct HB_ChainPosClassRule_ HB_ChainPosClassRule;
struct HB_ChainPosClassSet_
{
HB_UShort ChainPosClassRuleCount;
/* number of ChainPosClassRule
tables */
HB_ChainPosClassRule* ChainPosClassRule;
/* array of ChainPosClassRule
tables */
};
typedef struct HB_ChainPosClassSet_ HB_ChainPosClassSet;
/* The `MaxXXXLength' fields are not defined in the TTO specification
but simplifies the implementation of this format. It holds the
maximal context length used in the specific context rules. */
struct HB_ChainContextPosFormat2_
{
HB_Coverage Coverage; /* Coverage table */
HB_UShort MaxBacktrackLength;
/* maximal backtrack length */
HB_ClassDefinition BacktrackClassDef;
/* BacktrackClassDef table */
HB_UShort MaxInputLength;
/* maximal input length */
HB_ClassDefinition InputClassDef;
/* InputClassDef table */
HB_UShort MaxLookaheadLength;
/* maximal lookahead length */
HB_ClassDefinition LookaheadClassDef;
/* LookaheadClassDef table */
HB_UShort ChainPosClassSetCount;
/* number of ChainPosClassSet
tables */
HB_ChainPosClassSet* ChainPosClassSet;
/* array of ChainPosClassSet
tables */
};
typedef struct HB_ChainContextPosFormat2_ HB_ChainContextPosFormat2;
struct HB_ChainContextPosFormat3_
{
HB_UShort BacktrackGlyphCount;
/* number of backtrack glyphs */
HB_Coverage* BacktrackCoverage;
/* array of backtrack Coverage
tables */
HB_UShort InputGlyphCount;
/* number of input glyphs */
HB_Coverage* InputCoverage;
/* array of input coverage
tables */
HB_UShort LookaheadGlyphCount;
/* number of lookahead glyphs */
HB_Coverage* LookaheadCoverage;
/* array of lookahead coverage
tables */
HB_UShort PosCount; /* number of PosLookupRecords */
HB_PosLookupRecord* PosLookupRecord;
/* array of substitution lookups */
};
typedef struct HB_ChainContextPosFormat3_ HB_ChainContextPosFormat3;
struct HB_ChainContextPos_
{
HB_UShort PosFormat; /* 1, 2, or 3 */
union
{
HB_ChainContextPosFormat1 ccpf1;
HB_ChainContextPosFormat2 ccpf2;
HB_ChainContextPosFormat3 ccpf3;
} ccpf;
};
typedef struct HB_ChainContextPos_ HB_ChainContextPos;
#if 0
/* LookupType 10 */
struct HB_ExtensionPos_
{
HB_UShort PosFormat; /* always 1 */
HB_UShort LookuptType; /* lookup-type of referenced subtable */
HB_GPOS_SubTable *subtable; /* referenced subtable */
};
typedef struct HB_ExtensionPos_ HB_ExtensionPos;
#endif
union HB_GPOS_SubTable_
{
HB_SinglePos single;
HB_PairPos pair;
HB_CursivePos cursive;
HB_MarkBasePos markbase;
HB_MarkLigPos marklig;
HB_MarkMarkPos markmark;
HB_ContextPos context;
HB_ChainContextPos chain;
};
typedef union HB_GPOS_SubTable_ HB_GPOS_SubTable;
HB_INTERNAL HB_Error
_HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st,
HB_Stream stream,
HB_UShort lookup_type );
HB_INTERNAL void
_HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st,
HB_UShort lookup_type );
HB_END_HEADER
#endif /* HARFBUZZ_GPOS_PRIVATE_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,174 +0,0 @@
/*
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
* Copyright (C) 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HARFBUZZ_GPOS_H
#define HARFBUZZ_GPOS_H
#include "harfbuzz-open.h"
#include "harfbuzz-buffer.h"
HB_BEGIN_HEADER
/* Lookup types for glyph positioning */
#define HB_GPOS_LOOKUP_SINGLE 1
#define HB_GPOS_LOOKUP_PAIR 2
#define HB_GPOS_LOOKUP_CURSIVE 3
#define HB_GPOS_LOOKUP_MARKBASE 4
#define HB_GPOS_LOOKUP_MARKLIG 5
#define HB_GPOS_LOOKUP_MARKMARK 6
#define HB_GPOS_LOOKUP_CONTEXT 7
#define HB_GPOS_LOOKUP_CHAIN 8
#define HB_GPOS_LOOKUP_EXTENSION 9
/* A pointer to a function which loads a glyph. Its parameters are
the same as in a call to Load_Glyph() -- if no glyph loading
function will be registered with HB_GPOS_Register_Glyph_Function(),
Load_Glyph() will be called indeed. The purpose of this function
pointer is to provide a hook for caching glyph outlines and sbits
(using the instance's generic pointer to hold the data).
If for some reason no outline data is available (e.g. for an
embedded bitmap glyph), _glyph->outline.n_points should be set to
zero. */
typedef HB_Error (*HB_GlyphFunction)(HB_Font font,
HB_UInt glyphIndex,
HB_Int loadFlags );
/* A pointer to a function which accesses the PostScript interpreter.
Multiple Master fonts need this interface to convert a metric ID
(as stored in an OpenType font version 1.2 or higher) `metric_id'
into a metric value (returned in `metric_value').
`data' points to the user-defined structure specified during a
call to HB_GPOS_Register_MM_Function().
`metric_value' must be returned as a scaled value (but shouldn't
be rounded). */
typedef HB_Error (*HB_MMFunction)(HB_Font font,
HB_UShort metric_id,
HB_Fixed* metric_value,
void* data );
struct HB_GPOSHeader_
{
HB_16Dot16 Version;
HB_ScriptList ScriptList;
HB_FeatureList FeatureList;
HB_LookupList LookupList;
hb_ot_layout_t *layout;
/* the next field is used for a callback function to get the
glyph outline. */
HB_GlyphFunction gfunc;
/* this is OpenType 1.2 -- Multiple Master fonts need this
callback function to get various metric values from the
PostScript interpreter. */
HB_MMFunction mmfunc;
void* data;
};
typedef struct HB_GPOSHeader_ HB_GPOSHeader;
typedef HB_GPOSHeader* HB_GPOS;
HB_Error HB_Load_GPOS_Table( HB_Font font,
HB_GPOSHeader** gpos,
hb_ot_layout_t *layout );
HB_Error HB_Done_GPOS_Table( HB_GPOSHeader* gpos );
HB_Error HB_GPOS_Select_Script( HB_GPOSHeader* gpos,
HB_UInt script_tag,
HB_UShort* script_index );
HB_Error HB_GPOS_Select_Language( HB_GPOSHeader* gpos,
HB_UInt language_tag,
HB_UShort script_index,
HB_UShort* language_index,
HB_UShort* req_feature_index );
HB_Error HB_GPOS_Select_Feature( HB_GPOSHeader* gpos,
HB_UInt feature_tag,
HB_UShort script_index,
HB_UShort language_index,
HB_UShort* feature_index );
HB_Error HB_GPOS_Query_Scripts( HB_GPOSHeader* gpos,
HB_UInt** script_tag_list );
HB_Error HB_GPOS_Query_Languages( HB_GPOSHeader* gpos,
HB_UShort script_index,
HB_UInt** language_tag_list );
HB_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos,
HB_UShort script_index,
HB_UShort language_index,
HB_UInt** feature_tag_list );
HB_Error HB_GPOS_Add_Feature( HB_GPOSHeader* gpos,
HB_UShort feature_index,
HB_UInt properties );
HB_Error HB_GPOS_Clear_Features( HB_GPOSHeader* gpos );
HB_Error HB_GPOS_Register_Glyph_Function( HB_GPOSHeader* gpos,
HB_GlyphFunction gfunc );
HB_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos,
HB_MMFunction mmfunc,
void* data );
/* If `dvi' is TRUE, glyph contour points for anchor points and device
tables are ignored -- you will get device independent values. */
HB_Error HB_GPOS_Apply_String( HB_Font font,
HB_GPOSHeader* gpos,
HB_UShort load_flags,
HB_Buffer buffer,
HB_Bool dvi,
HB_Bool r2l );
HB_END_HEADER
#endif /* HARFBUZZ_GPOS_H */

View File

@ -1,476 +0,0 @@
/*
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
* Copyright (C) 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HARFBUZZ_GSUB_PRIVATE_H
#define HARFBUZZ_GSUB_PRIVATE_H
#include "harfbuzz-impl.h"
#include "harfbuzz-stream-private.h"
#include "harfbuzz-gsub.h"
HB_BEGIN_HEADER
typedef union HB_GSUB_SubTable_ HB_GSUB_SubTable;
/* LookupType 1 */
struct HB_SingleSubstFormat1_
{
HB_Short DeltaGlyphID; /* constant added to get
substitution glyph index */
};
typedef struct HB_SingleSubstFormat1_ HB_SingleSubstFormat1;
struct HB_SingleSubstFormat2_
{
HB_UShort GlyphCount; /* number of glyph IDs in
Substitute array */
HB_UShort* Substitute; /* array of substitute glyph IDs */
};
typedef struct HB_SingleSubstFormat2_ HB_SingleSubstFormat2;
struct HB_SingleSubst_
{
HB_UShort SubstFormat; /* 1 or 2 */
HB_Coverage Coverage; /* Coverage table */
union
{
HB_SingleSubstFormat1 ssf1;
HB_SingleSubstFormat2 ssf2;
} ssf;
};
typedef struct HB_SingleSubst_ HB_SingleSubst;
/* LookupType 2 */
struct HB_Sequence_
{
HB_UShort GlyphCount; /* number of glyph IDs in the
Substitute array */
HB_UShort* Substitute; /* string of glyph IDs to
substitute */
};
typedef struct HB_Sequence_ HB_Sequence;
struct HB_MultipleSubst_
{
HB_UShort SubstFormat; /* always 1 */
HB_Coverage Coverage; /* Coverage table */
HB_UShort SequenceCount; /* number of Sequence tables */
HB_Sequence* Sequence; /* array of Sequence tables */
};
typedef struct HB_MultipleSubst_ HB_MultipleSubst;
/* LookupType 3 */
struct HB_AlternateSet_
{
HB_UShort GlyphCount; /* number of glyph IDs in the
Alternate array */
HB_UShort* Alternate; /* array of alternate glyph IDs */
};
typedef struct HB_AlternateSet_ HB_AlternateSet;
struct HB_AlternateSubst_
{
HB_UShort SubstFormat; /* always 1 */
HB_Coverage Coverage; /* Coverage table */
HB_UShort AlternateSetCount;
/* number of AlternateSet tables */
HB_AlternateSet* AlternateSet; /* array of AlternateSet tables */
};
typedef struct HB_AlternateSubst_ HB_AlternateSubst;
/* LookupType 4 */
struct HB_Ligature_
{
HB_UShort LigGlyph; /* glyphID of ligature
to substitute */
HB_UShort ComponentCount; /* number of components in ligature */
HB_UShort* Component; /* array of component glyph IDs */
};
typedef struct HB_Ligature_ HB_Ligature;
struct HB_LigatureSet_
{
HB_UShort LigatureCount; /* number of Ligature tables */
HB_Ligature* Ligature; /* array of Ligature tables */
};
typedef struct HB_LigatureSet_ HB_LigatureSet;
struct HB_LigatureSubst_
{
HB_UShort SubstFormat; /* always 1 */
HB_Coverage Coverage; /* Coverage table */
HB_UShort LigatureSetCount; /* number of LigatureSet tables */
HB_LigatureSet* LigatureSet; /* array of LigatureSet tables */
};
typedef struct HB_LigatureSubst_ HB_LigatureSubst;
/* needed by both lookup type 5 and 6 */
struct HB_SubstLookupRecord_
{
HB_UShort SequenceIndex; /* index into current
glyph sequence */
HB_UShort LookupListIndex; /* Lookup to apply to that pos. */
};
typedef struct HB_SubstLookupRecord_ HB_SubstLookupRecord;
/* LookupType 5 */
struct HB_SubRule_
{
HB_UShort GlyphCount; /* total number of input glyphs */
HB_UShort SubstCount; /* number of SubstLookupRecord
tables */
HB_UShort* Input; /* array of input glyph IDs */
HB_SubstLookupRecord* SubstLookupRecord;
/* array of SubstLookupRecord
tables */
};
typedef struct HB_SubRule_ HB_SubRule;
struct HB_SubRuleSet_
{
HB_UShort SubRuleCount; /* number of SubRule tables */
HB_SubRule* SubRule; /* array of SubRule tables */
};
typedef struct HB_SubRuleSet_ HB_SubRuleSet;
struct HB_ContextSubstFormat1_
{
HB_Coverage Coverage; /* Coverage table */
HB_UShort SubRuleSetCount; /* number of SubRuleSet tables */
HB_SubRuleSet* SubRuleSet; /* array of SubRuleSet tables */
};
typedef struct HB_ContextSubstFormat1_ HB_ContextSubstFormat1;
struct HB_SubClassRule_
{
HB_UShort GlyphCount; /* total number of context classes */
HB_UShort SubstCount; /* number of SubstLookupRecord
tables */
HB_UShort* Class; /* array of classes */
HB_SubstLookupRecord* SubstLookupRecord;
/* array of SubstLookupRecord
tables */
};
typedef struct HB_SubClassRule_ HB_SubClassRule;
struct HB_SubClassSet_
{
HB_UShort SubClassRuleCount;
/* number of SubClassRule tables */
HB_SubClassRule* SubClassRule; /* array of SubClassRule tables */
};
typedef struct HB_SubClassSet_ HB_SubClassSet;
/* The `MaxContextLength' field is not defined in the TTO specification
but simplifies the implementation of this format. It holds the
maximal context length used in the context rules. */
struct HB_ContextSubstFormat2_
{
HB_UShort MaxContextLength;
/* maximal context length */
HB_Coverage Coverage; /* Coverage table */
HB_ClassDefinition ClassDef; /* ClassDef table */
HB_UShort SubClassSetCount;
/* number of SubClassSet tables */
HB_SubClassSet* SubClassSet; /* array of SubClassSet tables */
};
typedef struct HB_ContextSubstFormat2_ HB_ContextSubstFormat2;
struct HB_ContextSubstFormat3_
{
HB_UShort GlyphCount; /* number of input glyphs */
HB_UShort SubstCount; /* number of SubstLookupRecords */
HB_Coverage* Coverage; /* array of Coverage tables */
HB_SubstLookupRecord* SubstLookupRecord;
/* array of substitution lookups */
};
typedef struct HB_ContextSubstFormat3_ HB_ContextSubstFormat3;
struct HB_ContextSubst_
{
HB_UShort SubstFormat; /* 1, 2, or 3 */
union
{
HB_ContextSubstFormat1 csf1;
HB_ContextSubstFormat2 csf2;
HB_ContextSubstFormat3 csf3;
} csf;
};
typedef struct HB_ContextSubst_ HB_ContextSubst;
/* LookupType 6 */
struct HB_ChainSubRule_
{
HB_UShort BacktrackGlyphCount;
/* total number of backtrack glyphs */
HB_UShort* Backtrack; /* array of backtrack glyph IDs */
HB_UShort InputGlyphCount;
/* total number of input glyphs */
HB_UShort* Input; /* array of input glyph IDs */
HB_UShort LookaheadGlyphCount;
/* total number of lookahead glyphs */
HB_UShort* Lookahead; /* array of lookahead glyph IDs */
HB_UShort SubstCount; /* number of SubstLookupRecords */
HB_SubstLookupRecord* SubstLookupRecord;
/* array of SubstLookupRecords */
};
typedef struct HB_ChainSubRule_ HB_ChainSubRule;
struct HB_ChainSubRuleSet_
{
HB_UShort ChainSubRuleCount;
/* number of ChainSubRule tables */
HB_ChainSubRule* ChainSubRule; /* array of ChainSubRule tables */
};
typedef struct HB_ChainSubRuleSet_ HB_ChainSubRuleSet;
struct HB_ChainContextSubstFormat1_
{
HB_Coverage Coverage; /* Coverage table */
HB_UShort ChainSubRuleSetCount;
/* number of ChainSubRuleSet tables */
HB_ChainSubRuleSet* ChainSubRuleSet;
/* array of ChainSubRuleSet tables */
};
typedef struct HB_ChainContextSubstFormat1_ HB_ChainContextSubstFormat1;
struct HB_ChainSubClassRule_
{
HB_UShort BacktrackGlyphCount;
/* total number of backtrack
classes */
HB_UShort* Backtrack; /* array of backtrack classes */
HB_UShort InputGlyphCount;
/* total number of context classes */
HB_UShort* Input; /* array of context classes */
HB_UShort LookaheadGlyphCount;
/* total number of lookahead
classes */
HB_UShort* Lookahead; /* array of lookahead classes */
HB_UShort SubstCount; /* number of SubstLookupRecords */
HB_SubstLookupRecord* SubstLookupRecord;
/* array of substitution lookups */
};
typedef struct HB_ChainSubClassRule_ HB_ChainSubClassRule;
struct HB_ChainSubClassSet_
{
HB_UShort ChainSubClassRuleCount;
/* number of ChainSubClassRule
tables */
HB_ChainSubClassRule* ChainSubClassRule;
/* array of ChainSubClassRule
tables */
};
typedef struct HB_ChainSubClassSet_ HB_ChainSubClassSet;
/* The `MaxXXXLength' fields are not defined in the TTO specification
but simplifies the implementation of this format. It holds the
maximal context length used in the specific context rules. */
struct HB_ChainContextSubstFormat2_
{
HB_Coverage Coverage; /* Coverage table */
HB_UShort MaxBacktrackLength;
/* maximal backtrack length */
HB_ClassDefinition BacktrackClassDef;
/* BacktrackClassDef table */
HB_UShort MaxInputLength;
/* maximal input length */
HB_ClassDefinition InputClassDef;
/* InputClassDef table */
HB_UShort MaxLookaheadLength;
/* maximal lookahead length */
HB_ClassDefinition LookaheadClassDef;
/* LookaheadClassDef table */
HB_UShort ChainSubClassSetCount;
/* number of ChainSubClassSet
tables */
HB_ChainSubClassSet* ChainSubClassSet;
/* array of ChainSubClassSet
tables */
};
typedef struct HB_ChainContextSubstFormat2_ HB_ChainContextSubstFormat2;
struct HB_ChainContextSubstFormat3_
{
HB_UShort BacktrackGlyphCount;
/* number of backtrack glyphs */
HB_Coverage* BacktrackCoverage;
/* array of backtrack Coverage
tables */
HB_UShort InputGlyphCount;
/* number of input glyphs */
HB_Coverage* InputCoverage;
/* array of input coverage
tables */
HB_UShort LookaheadGlyphCount;
/* number of lookahead glyphs */
HB_Coverage* LookaheadCoverage;
/* array of lookahead coverage
tables */
HB_UShort SubstCount; /* number of SubstLookupRecords */
HB_SubstLookupRecord* SubstLookupRecord;
/* array of substitution lookups */
};
typedef struct HB_ChainContextSubstFormat3_ HB_ChainContextSubstFormat3;
struct HB_ChainContextSubst_
{
HB_UShort SubstFormat; /* 1, 2, or 3 */
union
{
HB_ChainContextSubstFormat1 ccsf1;
HB_ChainContextSubstFormat2 ccsf2;
HB_ChainContextSubstFormat3 ccsf3;
} ccsf;
};
typedef struct HB_ChainContextSubst_ HB_ChainContextSubst;
#if 0
/* LookupType 7 */
struct HB_ExtensionSubst_
{
HB_UShort SubstFormat; /* always 1 */
HB_UShort LookuptType; /* lookup-type of referenced subtable */
HB_GSUB_SubTable *subtable; /* referenced subtable */
};
typedef struct HB_ExtensionSubst_ HB_ExtensionSubst;
#endif
/* LookupType 8 */
struct HB_ReverseChainContextSubst_
{
HB_UShort SubstFormat; /* always 1 */
HB_Coverage Coverage; /* coverage table for input glyphs */
HB_UShort BacktrackGlyphCount; /* number of backtrack glyphs */
HB_Coverage* BacktrackCoverage; /* array of backtrack Coverage
tables */
HB_UShort LookaheadGlyphCount; /* number of lookahead glyphs */
HB_Coverage* LookaheadCoverage; /* array of lookahead Coverage
tables */
HB_UShort GlyphCount; /* number of Glyph IDs */
HB_UShort* Substitute; /* array of substitute Glyph ID */
};
typedef struct HB_ReverseChainContextSubst_ HB_ReverseChainContextSubst;
union HB_GSUB_SubTable_
{
HB_SingleSubst single;
HB_MultipleSubst multiple;
HB_AlternateSubst alternate;
HB_LigatureSubst ligature;
HB_ContextSubst context;
HB_ChainContextSubst chain;
HB_ReverseChainContextSubst reverse;
};
HB_INTERNAL HB_Error
_HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st,
HB_Stream stream,
HB_UShort lookup_type );
HB_INTERNAL void
_HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st,
HB_UShort lookup_type );
HB_END_HEADER
#endif /* HARFBUZZ_GSUB_PRIVATE_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,140 +0,0 @@
/*
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
* Copyright (C) 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HARFBUZZ_GSUB_H
#define HARFBUZZ_GSUB_H
#include "harfbuzz-gdef.h"
#include "harfbuzz-buffer.h"
HB_BEGIN_HEADER
/* Lookup types for glyph substitution */
#define HB_GSUB_LOOKUP_SINGLE 1
#define HB_GSUB_LOOKUP_MULTIPLE 2
#define HB_GSUB_LOOKUP_ALTERNATE 3
#define HB_GSUB_LOOKUP_LIGATURE 4
#define HB_GSUB_LOOKUP_CONTEXT 5
#define HB_GSUB_LOOKUP_CHAIN 6
#define HB_GSUB_LOOKUP_EXTENSION 7
#define HB_GSUB_LOOKUP_REVERSE_CHAIN 8
/* A pointer to a function which selects the alternate glyph. `pos' is
the position of the glyph with index `glyphID', `num_alternates'
gives the number of alternates in the `alternates' array. `data'
points to the user-defined structure specified during a call to
HB_GSUB_Register_Alternate_Function(). The function must return an
index into the `alternates' array. */
typedef HB_UShort (*HB_AltFunction)(HB_UInt pos,
HB_UShort glyphID,
HB_UShort num_alternates,
HB_UShort* alternates,
void* data );
struct HB_GSUBHeader_
{
HB_UInt offset;
HB_16Dot16 Version;
HB_ScriptList ScriptList;
HB_FeatureList FeatureList;
HB_LookupList LookupList;
hb_ot_layout_t *layout;
/* the next two fields are used for an alternate substitution callback
function to select the proper alternate glyph. */
HB_AltFunction altfunc;
void* data;
};
typedef struct HB_GSUBHeader_ HB_GSUBHeader;
typedef HB_GSUBHeader* HB_GSUB;
HB_Error HB_Load_GSUB_Table( HB_Font font,
HB_GSUBHeader** gsub,
hb_ot_layout_t *layout );
HB_Error HB_Done_GSUB_Table( HB_GSUBHeader* gsub );
HB_Error HB_GSUB_Select_Script( HB_GSUBHeader* gsub,
HB_UInt script_tag,
HB_UShort* script_index );
HB_Error HB_GSUB_Select_Language( HB_GSUBHeader* gsub,
HB_UInt language_tag,
HB_UShort script_index,
HB_UShort* language_index,
HB_UShort* req_feature_index );
HB_Error HB_GSUB_Select_Feature( HB_GSUBHeader* gsub,
HB_UInt feature_tag,
HB_UShort script_index,
HB_UShort language_index,
HB_UShort* feature_index );
HB_Error HB_GSUB_Query_Scripts( HB_GSUBHeader* gsub,
HB_UInt** script_tag_list );
HB_Error HB_GSUB_Query_Languages( HB_GSUBHeader* gsub,
HB_UShort script_index,
HB_UInt** language_tag_list );
HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub,
HB_UShort script_index,
HB_UShort language_index,
HB_UInt** feature_tag_list );
HB_Error HB_GSUB_Add_Feature( HB_GSUBHeader* gsub,
HB_UShort feature_index,
HB_UInt properties );
HB_Error HB_GSUB_Clear_Features( HB_GSUBHeader* gsub );
HB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub,
HB_AltFunction altfunc,
void* data );
HB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub,
HB_Buffer buffer );
HB_END_HEADER
#endif /* HARFBUZZ_GSUB_H */

View File

@ -1,84 +0,0 @@
/*
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
* Copyright (C) 2007 Trolltech ASA
* Copyright (C) 2007 Red Hat, Inc.
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Behdad Esfahbod
*/
#include "harfbuzz-impl.h"
HB_INTERNAL HB_Pointer
_hb_alloc( size_t size,
HB_Error *perror )
{
HB_Error error = 0;
HB_Pointer block = NULL;
if ( size > 0 )
{
block = calloc( 1, size );
if ( !block )
error = ERR(HB_Err_Out_Of_Memory);
}
*perror = error;
return block;
}
HB_INTERNAL HB_Pointer
_hb_realloc( HB_Pointer block,
size_t new_size,
HB_Error *perror )
{
HB_Pointer block2 = NULL;
HB_Error error = 0;
block2 = realloc( block, new_size );
if ( block2 == NULL && new_size != 0 )
error = ERR(HB_Err_Out_Of_Memory);
if ( !error )
block = block2;
*perror = error;
return block;
}
HB_INTERNAL void
_hb_free( HB_Pointer block )
{
if ( block )
free( block );
}
/* helper func to set a breakpoint on */
HB_INTERNAL HB_Error
_hb_err (HB_Error code)
{
return code;
}

View File

@ -1,126 +0,0 @@
/*
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
* Copyright (C) 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HARFBUZZ_IMPL_H
#define HARFBUZZ_IMPL_H
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_TRUETYPE_TAGS_H
#include "harfbuzz-global.h"
#include <stdlib.h>
/* XXX */
#include "hb-ot-layout-private.h"
HB_BEGIN_HEADER
#ifndef HB_INTERNAL
# define HB_INTERNAL
#endif
#ifndef NULL
# define NULL ((void *)0)
#endif
#ifndef FALSE
# define FALSE 0
#endif
#ifndef TRUE
# define TRUE 1
#endif
#ifndef TTAG_GDEF
# define TTAG_GDEF HB_MAKE_TAG( 'G', 'D', 'E', 'F' )
#endif
#ifndef TTAG_GPOS
# define TTAG_GPOS HB_MAKE_TAG( 'G', 'P', 'O', 'S' )
#endif
#ifndef TTAG_GSUB
# define TTAG_GSUB HB_MAKE_TAG( 'G', 'S', 'U', 'B' )
#endif
#ifndef HB_UNUSED
# define HB_UNUSED(arg) ((arg) = (arg))
#endif
#ifndef HB_LIKELY
# define HB_LIKELY(cond) (cond)
#endif
#ifndef HB_UNLIKELY
# define HB_UNLIKELY(cond) (cond)
#endif
#define ALLOC(_ptr,_size) \
( *(void**)&(_ptr) = _hb_alloc( _size, &error ), error != 0 )
#define REALLOC(_ptr,_newsz) \
( (_ptr) = _hb_realloc( (_ptr), (_newsz), &error ), error != 0 )
#define FREE(_ptr) \
do { \
if ( (_ptr) ) \
{ \
_hb_free( _ptr ); \
_ptr = NULL; \
} \
} while (0)
#define ALLOC_ARRAY(_ptr,_count,_type) \
ALLOC(_ptr,(_count)*sizeof(_type))
#define REALLOC_ARRAY(_ptr,_newcnt,_type) \
REALLOC(_ptr,(_newcnt)*sizeof(_type))
#define MEM_Copy(dest,source,count) memcpy( (char*)(dest), (const char*)(source), (size_t)(count) )
#define ERR(err) _hb_err (err)
HB_INTERNAL HB_Pointer
_hb_alloc( size_t size,
HB_Error *perror_ );
HB_INTERNAL HB_Pointer
_hb_realloc( HB_Pointer block,
size_t new_size,
HB_Error *perror_ );
HB_INTERNAL void
_hb_free( HB_Pointer block );
/* helper func to set a breakpoint on */
HB_INTERNAL HB_Error
_hb_err (HB_Error code);
HB_END_HEADER
#endif /* HARFBUZZ_IMPL_H */

View File

@ -1,102 +0,0 @@
/*
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
* Copyright (C) 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HARFBUZZ_OPEN_PRIVATE_H
#define HARFBUZZ_OPEN_PRIVATE_H
#include "harfbuzz-impl.h"
#include "harfbuzz-open.h"
#include "harfbuzz-gsub-private.h"
#include "harfbuzz-gpos-private.h"
HB_BEGIN_HEADER
struct HB_SubTable_
{
union
{
HB_GSUB_SubTable gsub;
HB_GPOS_SubTable gpos;
} st;
};
HB_INTERNAL HB_Error
_HB_OPEN_Load_ScriptList( HB_ScriptList* sl,
HB_Stream input );
HB_INTERNAL HB_Error
_HB_OPEN_Load_FeatureList( HB_FeatureList* fl,
HB_Stream input );
HB_INTERNAL HB_Error
_HB_OPEN_Load_LookupList( HB_LookupList* ll,
HB_Stream input,
HB_Type type );
HB_INTERNAL HB_Error
_HB_OPEN_Load_Coverage( HB_Coverage* c,
HB_Stream input );
HB_INTERNAL HB_Error
_HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
HB_UShort limit,
HB_Stream input );
HB_INTERNAL HB_Error
_HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd,
HB_UShort limit,
HB_UInt class_offset,
HB_UInt base_offset,
HB_Stream input );
HB_INTERNAL HB_Error
_HB_OPEN_Load_Device( HB_Device* d,
HB_Stream input );
HB_INTERNAL void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl );
HB_INTERNAL void _HB_OPEN_Free_FeatureList( HB_FeatureList* fl );
HB_INTERNAL void _HB_OPEN_Free_LookupList( HB_LookupList* ll,
HB_Type type );
HB_INTERNAL void _HB_OPEN_Free_Coverage( HB_Coverage* c );
HB_INTERNAL void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd );
HB_INTERNAL void _HB_OPEN_Free_Device( HB_Device* d );
HB_INTERNAL HB_Error
_HB_OPEN_Coverage_Index( HB_Coverage* c,
HB_UShort glyphID,
HB_UShort* index );
HB_INTERNAL HB_Error
_HB_OPEN_Get_Class( HB_ClassDefinition* cd,
HB_UShort glyphID,
HB_UShort* klass,
HB_UShort* index );
HB_INTERNAL HB_Error
_HB_OPEN_Get_Device( HB_Device* d,
HB_UShort size,
HB_Short* value );
HB_END_HEADER
#endif /* HARFBUZZ_OPEN_PRIVATE_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,282 +0,0 @@
/*
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
* Copyright (C) 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HARFBUZZ_OPEN_H
#define HARFBUZZ_OPEN_H
#include "harfbuzz-global.h"
HB_BEGIN_HEADER
/* Use this if a feature applies to all glyphs */
#define HB_ALL_GLYPHS 0xFFFF
#define HB_DEFAULT_LANGUAGE 0xFFFF
#define HB_MAX_NESTING_LEVEL 100
/* Script list related structures */
struct HB_LangSys_
{
HB_UShort LookupOrderOffset; /* always 0 for TT Open 1.0 */
HB_UShort ReqFeatureIndex; /* required FeatureIndex */
HB_UShort FeatureCount; /* number of Feature indices */
HB_UShort* FeatureIndex; /* array of Feature indices */
};
typedef struct HB_LangSys_ HB_LangSys;
struct HB_LangSysRecord_
{
HB_UInt LangSysTag; /* LangSysTag identifier */
HB_LangSys LangSys; /* LangSys table */
};
typedef struct HB_LangSysRecord_ HB_LangSysRecord;
struct HB_ScriptTable_
{
HB_LangSys DefaultLangSys; /* DefaultLangSys table */
HB_UShort LangSysCount; /* number of LangSysRecords */
HB_LangSysRecord* LangSysRecord; /* array of LangSysRecords */
};
typedef struct HB_ScriptTable_ HB_ScriptTable;
struct HB_ScriptRecord_
{
HB_UInt ScriptTag; /* ScriptTag identifier */
HB_ScriptTable Script; /* Script table */
};
typedef struct HB_ScriptRecord_ HB_ScriptRecord;
struct HB_ScriptList_
{
HB_UShort ScriptCount; /* number of ScriptRecords */
HB_ScriptRecord* ScriptRecord; /* array of ScriptRecords */
};
typedef struct HB_ScriptList_ HB_ScriptList;
/* Feature list related structures */
struct HB_Feature_
{
HB_UShort FeatureParams; /* always 0 for TT Open 1.0 */
HB_UShort LookupListCount; /* number of LookupList indices */
HB_UShort* LookupListIndex; /* array of LookupList indices */
};
typedef struct HB_Feature_ HB_Feature;
struct HB_FeatureRecord_
{
HB_UInt FeatureTag; /* FeatureTag identifier */
HB_Feature Feature; /* Feature table */
};
typedef struct HB_FeatureRecord_ HB_FeatureRecord;
struct HB_FeatureList_
{
HB_UShort FeatureCount; /* number of FeatureRecords */
HB_FeatureRecord* FeatureRecord; /* array of FeatureRecords */
HB_UShort* ApplyOrder; /* order to apply features */
HB_UShort ApplyCount; /* number of elements in ApplyOrder */
};
typedef struct HB_FeatureList_ HB_FeatureList;
/* Lookup list related structures */
typedef struct HB_SubTable_ HB_SubTable;
struct HB_Lookup_
{
HB_UShort LookupType; /* Lookup type */
HB_UShort LookupFlag; /* Lookup qualifiers */
HB_UShort SubTableCount; /* number of SubTables */
HB_SubTable* SubTable; /* array of SubTables */
};
typedef struct HB_Lookup_ HB_Lookup;
/* The `Properties' field is not defined in the OpenType specification but
is needed for processing lookups. If properties[n] is > 0, the
functions HB_GSUB_Apply_String() resp. HB_GPOS_Apply_String() will
process Lookup[n] for glyphs which have the specific bit not set in
the `properties' field of the input string object. */
struct HB_LookupList_
{
HB_UShort LookupCount; /* number of Lookups */
HB_Lookup* Lookup; /* array of Lookup records */
HB_UInt* Properties; /* array of flags */
};
typedef struct HB_LookupList_ HB_LookupList;
/* Possible LookupFlag bit masks. `HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS' comes from the
OpenType 1.2 specification; HB_LOOKUP_FLAG_RIGHT_TO_LEFT has been (re)introduced in
OpenType 1.3 -- if set, the last glyph in a cursive attachment
sequence has to be positioned on the baseline -- regardless of the
writing direction. */
#define HB_LOOKUP_FLAG_RIGHT_TO_LEFT 0x0001
#define HB_LOOKUP_FLAG_IGNORE_BASE_GLYPHS 0x0002
#define HB_LOOKUP_FLAG_IGNORE_LIGATURES 0x0004
#define HB_LOOKUP_FLAG_IGNORE_MARKS 0x0008
#define HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS 0xFF00
struct HB_CoverageFormat1_
{
HB_UShort GlyphCount; /* number of glyphs in GlyphArray */
HB_UShort* GlyphArray; /* array of glyph IDs */
};
typedef struct HB_CoverageFormat1_ HB_CoverageFormat1;
struct HB_RangeRecord_
{
HB_UShort Start; /* first glyph ID in the range */
HB_UShort End; /* last glyph ID in the range */
HB_UShort StartCoverageIndex; /* coverage index of first
glyph ID in the range */
};
typedef struct HB_RangeRecord_ HB_RangeRecord;
struct HB_CoverageFormat2_
{
HB_UShort RangeCount; /* number of RangeRecords */
HB_RangeRecord* RangeRecord; /* array of RangeRecords */
};
typedef struct HB_CoverageFormat2_ HB_CoverageFormat2;
struct HB_Coverage_
{
HB_UShort CoverageFormat; /* 1 or 2 */
union
{
HB_CoverageFormat1 cf1;
HB_CoverageFormat2 cf2;
} cf;
};
typedef struct HB_Coverage_ HB_Coverage;
struct HB_ClassDefFormat1_
{
HB_UShort StartGlyph; /* first glyph ID of the
ClassValueArray */
HB_UShort GlyphCount; /* size of the ClassValueArray */
HB_UShort* ClassValueArray; /* array of class values */
};
typedef struct HB_ClassDefFormat1_ HB_ClassDefFormat1;
struct HB_ClassRangeRecord_
{
HB_UShort Start; /* first glyph ID in the range */
HB_UShort End; /* last glyph ID in the range */
HB_UShort Class; /* applied to all glyphs in range */
};
typedef struct HB_ClassRangeRecord_ HB_ClassRangeRecord;
struct HB_ClassDefFormat2_
{
HB_UShort ClassRangeCount;
/* number of ClassRangeRecords */
HB_ClassRangeRecord* ClassRangeRecord;
/* array of ClassRangeRecords */
};
typedef struct HB_ClassDefFormat2_ HB_ClassDefFormat2;
struct HB_ClassDefinition_
{
HB_Bool loaded;
HB_UShort ClassFormat; /* 1 or 2 */
union
{
HB_ClassDefFormat1 cd1;
HB_ClassDefFormat2 cd2;
} cd;
};
typedef struct HB_ClassDefinition_ HB_ClassDefinition;
struct HB_Device_
{
HB_UShort StartSize; /* smallest size to correct */
HB_UShort EndSize; /* largest size to correct */
HB_UShort DeltaFormat; /* DeltaValue array data format:
1, 2, or 3 */
HB_UShort* DeltaValue; /* array of compressed data */
};
typedef struct HB_Device_ HB_Device;
enum HB_Type_
{
HB_Type_GSUB,
HB_Type_GPOS
};
typedef enum HB_Type_ HB_Type;
HB_END_HEADER
#endif /* HARFBUZZ_OPEN_H */

View File

@ -1,83 +0,0 @@
/*
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
* Copyright (C) 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HARFBUZZ_STREAM_PRIVATE_H
#define HARFBUZZ_STREAM_PRIVATE_H
#include "harfbuzz-impl.h"
HB_BEGIN_HEADER
typedef FT_Stream HB_Stream;
HB_INTERNAL HB_Int
_hb_stream_pos( HB_Stream stream );
HB_INTERNAL HB_Error
_hb_stream_seek( HB_Stream stream,
HB_UInt pos );
HB_INTERNAL HB_Error
_hb_stream_frame_enter( HB_Stream stream,
HB_UInt size );
HB_INTERNAL void
_hb_stream_frame_exit( HB_Stream stream );
HB_INTERNAL HB_Error
_hb_font_goto_table( HB_Font font,
HB_UInt tag );
/* convenience macros */
#define SET_ERR(c) ( (error = (c)) != 0 )
#define GOTO_Table(tag) SET_ERR( _hb_font_goto_table( font, tag ) )
#define FILE_Pos() _hb_stream_pos( stream )
#define FILE_Seek(pos) SET_ERR( _hb_stream_seek( stream, pos ) )
#define ACCESS_Frame(size) SET_ERR( _hb_stream_frame_enter( stream, size ) )
#define FORGET_Frame() _hb_stream_frame_exit( stream )
#define GET_Byte() (*stream->cursor++)
#define GET_Short() (stream->cursor += 2, (HB_Short)( \
(*(((HB_Byte*)stream->cursor)-2) << 8) | \
*(((HB_Byte*)stream->cursor)-1) \
))
#define GET_Long() (stream->cursor += 4, (HB_Int)( \
(*(((HB_Byte*)stream->cursor)-4) << 24) | \
(*(((HB_Byte*)stream->cursor)-3) << 16) | \
(*(((HB_Byte*)stream->cursor)-2) << 8) | \
*(((HB_Byte*)stream->cursor)-1) \
))
#define GET_Char() ((HB_Char)GET_Byte())
#define GET_UShort() ((HB_UShort)GET_Short())
#define GET_ULong() ((HB_UInt)GET_Long())
#define GET_Tag4() GET_ULong()
HB_END_HEADER
#endif /* HARFBUZZ_STREAM_PRIVATE_H */

View File

@ -1,257 +0,0 @@
/*
* Copyright (C) 2005 David Turner
* Copyright (C) 2007 Trolltech ASA
* Copyright (C) 2007 Red Hat, Inc.
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Behdad Esfahbod
*/
#include "harfbuzz-impl.h"
#include "harfbuzz-stream-private.h"
#include <stdlib.h>
#if 0
#include <stdio.h>
#define LOG(x) _hb_log x
static void
_hb_log( const char* format, ... )
{
va_list ap;
va_start( ap, format );
vfprintf( stderr, format, ap );
va_end( ap );
}
#else
#define LOG(x) do {} while (0)
#endif
/* only used internally */
static HB_Pointer
_hb_qalloc( HB_UInt size,
HB_Error *perror )
{
HB_Error error = 0;
HB_Pointer block = NULL;
if ( size > 0 )
{
block = malloc( size );
if ( !block )
error = ERR(HB_Err_Out_Of_Memory);
}
*perror = error;
return block;
}
#undef QALLOC /* just in case */
#define QALLOC(ptr,size) ( (ptr) = _hb_qalloc( (size), &error ), error != 0 )
HB_INTERNAL HB_Int
_hb_stream_pos( HB_Stream stream )
{
LOG(( "_hb_stream_pos() -> %ld\n", stream->pos ));
return stream->pos;
}
HB_INTERNAL HB_Error
_hb_stream_seek( HB_Stream stream,
HB_UInt pos )
{
HB_Error error = 0;
stream->pos = pos;
if ( stream->read )
{
if ( stream->read( stream, pos, NULL, 0 ) )
error = ERR(HB_Err_Read_Error);
}
else if ( pos > stream->size )
error = ERR(HB_Err_Read_Error);
LOG(( "_hb_stream_seek(%ld) -> 0x%04X\n", pos, error ));
return error;
}
HB_INTERNAL HB_Error
_hb_stream_frame_enter( HB_Stream stream,
HB_UInt count )
{
HB_Error error = HB_Err_Ok;
HB_UInt read_bytes;
if ( stream->read )
{
/* allocate the frame in memory */
if ( QALLOC( stream->base, count ) )
goto Exit;
/* read it */
read_bytes = stream->read( stream, stream->pos,
stream->base, count );
if ( read_bytes < count )
{
FREE( stream->base );
error = ERR(HB_Err_Read_Error);
}
stream->cursor = stream->base;
stream->limit = stream->cursor + count;
stream->pos += read_bytes;
}
else
{
/* check new position, watch for overflow */
if (HB_UNLIKELY (stream->pos + count > stream->size ||
stream->pos + count < stream->pos))
{
error = ERR(HB_Err_Read_Error);
goto Exit;
}
/* set cursor */
stream->cursor = stream->base + stream->pos;
stream->limit = stream->cursor + count;
stream->pos += count;
}
Exit:
LOG(( "_hb_stream_frame_enter(%ld) -> 0x%04X\n", count, error ));
return error;
}
HB_INTERNAL void
_hb_stream_frame_exit( HB_Stream stream )
{
if ( stream->read )
{
FREE( stream->base );
}
stream->cursor = NULL;
stream->limit = NULL;
LOG(( "_hb_stream_frame_exit()\n" ));
}
HB_INTERNAL HB_Error
_hb_font_goto_table( HB_Font font,
HB_UInt the_tag )
{
HB_Stream stream = font->stream;
HB_UInt offset = 0, sig;
HB_UInt count, nn;
HB_Error error;
LOG(( "_hb_font_goto_table( %p, %c%c%c%c, %p )\n",
font,
(int)((the_tag >> 24) & 0xFF),
(int)((the_tag >> 16) & 0xFF),
(int)((the_tag >> 8) & 0xFF),
(int)(the_tag & 0xFF),
stream ));
if ( !FT_IS_SFNT(font) )
{
LOG(( "not a SFNT font !!\n" ));
error = ERR(HB_Err_Invalid_Argument);
goto Exit;
}
/* parse the directory table directly, without using
* FreeType's built-in data structures
*/
if ( FILE_Seek( 0 ) || ACCESS_Frame( 4 ) )
goto Exit;
sig = GET_Tag4();
FORGET_Frame();
if ( sig == HB_MAKE_TAG( 't', 't', 'c', 'f' ) )
{
/* deal with TrueType collections */
LOG(( ">> This is a TrueType Collection\n" ));
if ( FILE_Seek( 12 + font->face_index*4 ) ||
ACCESS_Frame( 4 ) )
goto Exit;
offset = GET_ULong();
FORGET_Frame();
}
LOG(( "TrueType offset = %ld\n", offset ));
if ( FILE_Seek( offset+4 ) ||
ACCESS_Frame( 2 ) )
goto Exit;
count = GET_UShort();
FORGET_Frame();
if ( FILE_Seek( offset+12 ) ||
ACCESS_Frame( count*16 ) )
goto Exit;
for ( nn = 0; nn < count; nn++ )
{
HB_UInt tag = GET_ULong();
HB_UInt checksum = GET_ULong();
HB_UInt start = GET_ULong();
HB_UInt size = GET_ULong();
HB_UNUSED(checksum);
HB_UNUSED(size);
if ( tag == the_tag )
{
LOG(( "TrueType table (start: %ld) (size: %ld)\n", start, size ));
error = _hb_stream_seek( stream, start );
goto FoundIt;
}
}
error = HB_Err_Not_Covered;
FoundIt:
FORGET_Frame();
Exit:
LOG(( "TrueType error=%d\n", error ));
return error;
}
#undef QALLOC

View File

@ -1,31 +0,0 @@
/*
* Copyright (C) 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#define HB_INTERNAL static
#include "harfbuzz-buffer.c"
#include "harfbuzz-gsub.c"
#include "harfbuzz-gpos.c"
#include "harfbuzz-impl.c"
#include "harfbuzz-open.c"
#include "harfbuzz-stream.c"

View File

@ -1,35 +0,0 @@
/*
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
* Copyright (C) 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HARFBUZZ_H
#define HARFBUZZ_H
#include "harfbuzz-global.h"
#include "harfbuzz-buffer.h"
#include "harfbuzz-gsub.h"
#include "harfbuzz-gpos.h"
#include "harfbuzz-open.h"
#endif /* HARFBUZZ_OPEN_H */