} HB_GlyphItemRec, *HB_GlyphItem;
typedef struct HB_PositionRec_ {
- FT_Pos x_pos;
- FT_Pos y_pos;
- FT_Pos x_advance;
- FT_Pos y_advance;
+ HB_Fixed x_pos;
+ HB_Fixed y_pos;
+ HB_Fixed x_advance;
+ HB_Fixed y_advance;
HB_UShort back; /* number of glyphs to go back
for drawing current glyph */
HB_Bool new_advance; /* if set, the advance width values are
void
try_string (FT_Library library,
- FT_Face face,
+ HB_Font font,
HB_GSUB gsub)
{
HB_Error error;
HB_GSUB_String *out_str;
HB_UInt i;
- if ((error = HB_GSUB_String_New (face->memory, &in_str)))
+ if ((error = HB_GSUB_String_New (font->memory, &in_str)))
croak ("HB_GSUB_String_New", error);
- if ((error = HB_GSUB_String_New (face->memory, &out_str)))
+ if ((error = HB_GSUB_String_New (font->memory, &out_str)))
croak ("HB_GSUB_String_New", error);
if ((error = HB_GSUB_String_Set_Length (in_str, N_ELEMENTS (arabic_str))))
for (i=0; i < N_ELEMENTS (arabic_str); i++)
{
- in_str->string[i] = FT_Get_Char_Index (face, arabic_str[i]);
+ in_str->string[i] = FT_Get_Char_Index (font, arabic_str[i]);
in_str->properties[i] = arabic_props[i];
in_str->components[i] = i;
in_str->ligIDs[i] = i;
{
HB_Error error;
FT_Library library;
- FT_Face face;
+ HB_Font font;
HB_GSUB gsub;
HB_GPOS gpos;
if ((error = FT_Init_FreeType (&library)))
croak ("FT_Init_FreeType", error);
- if ((error = FT_New_Face (library, argv[1], 0, &face)))
+ 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 (face, &gsub, NULL)))
+ if (!(error = HB_Load_GSUB_Table (font, &gsub, NULL)))
{
HB_Dump_GSUB_Table (gsub, stdout);
else if (error != HB_Err_Not_Covered)
fprintf (stderr, "HB_Load_GSUB_Table %x\n", error);
- if (!(error = HB_Load_GPOS_Table (face, &gpos, NULL)))
+ if (!(error = HB_Load_GPOS_Table (font, &gpos, NULL)))
{
HB_Dump_GPOS_Table (gpos, stdout);
printf ("</OpenType>\n");
#if 0
- select_cmap (face);
+ select_cmap (font);
add_features (gsub);
- try_string (library, face, gsub);
+ try_string (library, font, gsub);
#endif
- if ((error = FT_Done_Face (face)))
+ if ((error = FT_Done_Face (font)))
croak ("FT_Done_Face", error);
if ((error = FT_Done_FreeType (library)))
static HB_Error GDEF_Create( void* ext,
- PFace face )
+ PFace font )
{
- DEFINE_LOAD_LOCALS( face->stream );
+ DEFINE_LOAD_LOCALS( font->stream );
HB_GDEFHeader* gdef = (HB_GDEFHeader*)ext;
Long table;
/* we store the start offset and the size of the subtable */
- table = HB_LookUp_Table( face, TTAG_GDEF );
+ table = HB_LookUp_Table( font, TTAG_GDEF );
if ( table < 0 )
return HB_Err_Ok; /* The table is optional */
- if ( FILE_Seek( face->dirTables[table].Offset ) ||
+ if ( FILE_Seek( font->dirTables[table].Offset ) ||
ACCESS_Frame( 4L ) )
return error;
static HB_Error GDEF_Destroy( void* ext,
- PFace face )
+ PFace font )
{
HB_GDEFHeader* gdef = (HB_GDEFHeader*)ext;
}
-HB_Error HB_Load_GDEF_Table( FT_Face face,
+HB_Error HB_Load_GDEF_Table( HB_Font font,
HB_GDEFHeader** retptr )
{
HB_Error error;
- HB_Stream stream = face->stream;
+ HB_Stream stream = font->stream;
HB_UInt cur_offset, new_offset, base_offset;
HB_GDEFHeader* gdef;
{
HB_UInt offset;
- FT_Fixed Version;
+ HB_16Dot16 Version;
HB_ClassDefinition GlyphClassDef;
HB_AttachList AttachList;
HB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr );
-HB_Error HB_Load_GDEF_Table( FT_Face face,
+HB_Error HB_Load_GDEF_Table( HB_Font font,
HB_GDEFHeader** gdef );
/*******************************************************************
*
- * Copyright 1996-2000 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
* Copyright 2007 Trolltech ASA
* Copyright 2007 Behdad Esfahbod
*
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 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 {
struct GPOS_Instance_
{
HB_GPOSHeader* gpos;
- FT_Face face;
+ HB_Font font;
HB_Bool dvi;
HB_UShort load_flags; /* how the glyph should be loaded */
HB_Bool r2l;
HB_UShort last; /* the last valid glyph -- used
with cursive positioning */
- FT_Pos anchor_x; /* the coordinates of the anchor point */
- FT_Pos anchor_y; /* of the last valid glyph */
+ HB_Fixed anchor_x; /* the coordinates of the anchor point */
+ HB_Fixed anchor_y; /* of the last valid glyph */
};
typedef struct GPOS_Instance_ GPOS_Instance;
/* the client application must replace this with something more
meaningful if multiple master fonts are to be supported. */
-static HB_Error default_mmfunc( FT_Face face,
+static HB_Error default_mmfunc( HB_Font font,
HB_UShort metric_id,
- FT_Pos* metric_value,
+ HB_Fixed* metric_value,
void* data )
{
- HB_UNUSED(face);
+ HB_UNUSED(font);
HB_UNUSED(metric_id);
HB_UNUSED(metric_value);
HB_UNUSED(data);
-HB_Error HB_Load_GPOS_Table( FT_Face face,
+HB_Error HB_Load_GPOS_Table( HB_Font font,
HB_GPOSHeader** retptr,
HB_GDEFHeader* gdef )
{
HB_GPOSHeader* gpos;
- HB_Stream stream = face->stream;
+ HB_Stream stream = font->stream;
HB_Error error;
HB_UShort format,
HB_Position gd )
{
- FT_Pos value;
+ HB_Fixed value;
HB_Short pixel_value;
HB_Error error = HB_Err_Ok;
HB_GPOSHeader* gpos = gpi->gpos;
HB_UShort x_ppem, y_ppem;
- FT_Fixed x_scale, y_scale;
+ HB_16Dot16 x_scale, y_scale;
if ( !format )
return HB_Err_Ok;
- x_ppem = gpi->face->size->metrics.x_ppem;
- y_ppem = gpi->face->size->metrics.y_ppem;
- x_scale = gpi->face->size->metrics.x_scale;
- y_scale = gpi->face->size->metrics.y_scale;
+ x_ppem = gpi->font->size->metrics.x_ppem;
+ y_ppem = gpi->font->size->metrics.y_ppem;
+ x_scale = gpi->font->size->metrics.x_scale;
+ y_scale = gpi->font->size->metrics.y_scale;
/* design units -> fractional pixel */
if ( format & HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT )
{
- error = (gpos->mmfunc)( gpi->face, vr->XIdPlacement,
+ error = (gpos->mmfunc)( gpi->font, vr->XIdPlacement,
&value, gpos->data );
if ( error )
return error;
}
if ( format & HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT )
{
- error = (gpos->mmfunc)( gpi->face, vr->YIdPlacement,
+ error = (gpos->mmfunc)( gpi->font, vr->YIdPlacement,
&value, gpos->data );
if ( error )
return error;
}
if ( format & HB_GPOS_FORMAT_HAVE_X_ID_ADVANCE )
{
- error = (gpos->mmfunc)( gpi->face, vr->XIdAdvance,
+ error = (gpos->mmfunc)( gpi->font, vr->XIdAdvance,
&value, gpos->data );
if ( error )
return error;
}
if ( format & HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE )
{
- error = (gpos->mmfunc)( gpi->face, vr->YIdAdvance,
+ error = (gpos->mmfunc)( gpi->font, vr->YIdAdvance,
&value, gpos->data );
if ( error )
return error;
static HB_Error Get_Anchor( GPOS_Instance* gpi,
HB_Anchor* an,
HB_UShort glyph_index,
- FT_Pos* x_value,
- FT_Pos* y_value )
+ HB_Fixed* x_value,
+ HB_Fixed* y_value )
{
HB_Error error = HB_Err_Ok;
HB_UShort load_flags;
HB_UShort x_ppem, y_ppem;
- FT_Fixed x_scale, y_scale;
+ HB_16Dot16 x_scale, y_scale;
- x_ppem = gpi->face->size->metrics.x_ppem;
- y_ppem = gpi->face->size->metrics.y_ppem;
- x_scale = gpi->face->size->metrics.x_scale;
- y_scale = gpi->face->size->metrics.y_scale;
+ x_ppem = gpi->font->size->metrics.x_ppem;
+ y_ppem = gpi->font->size->metrics.y_ppem;
+ x_scale = gpi->font->size->metrics.x_scale;
+ y_scale = gpi->font->size->metrics.y_scale;
switch ( an->PosFormat )
{
if ( !gpi->dvi )
{
- error = (gpos->gfunc)( gpi->face, glyph_index, load_flags );
+ error = (gpos->gfunc)( gpi->font, glyph_index, load_flags );
if ( error )
return error;
- if ( gpi->face->glyph->format != ft_glyph_format_outline )
+ if ( gpi->font->glyph->format != ft_glyph_format_outline )
return ERR(HB_Err_Invalid_SubTable);
ap = an->af.af2.AnchorPoint;
- outline = gpi->face->glyph->outline;
-
- /* if outline.n_points is set to zero by gfunc(), we use the
- design coordinate value pair. This can happen e.g. for
- sbit glyphs */
+ outline = gpi->font->glyph->outline;
+ /* if n_points is set to zero, we use the design coordinate value pair.
+ * This can happen e.g. for sbit glyphs. */
if ( !outline.n_points )
goto no_contour_point;
break;
case 4:
- error = (gpos->mmfunc)( gpi->face, an->af.af4.XIdAnchor,
+ error = (gpos->mmfunc)( gpi->font, an->af.af4.XIdAnchor,
x_value, gpos->data );
if ( error )
return error;
- error = (gpos->mmfunc)( gpi->face, an->af.af4.YIdAnchor,
+ error = (gpos->mmfunc)( gpi->font, an->af.af4.YIdAnchor,
y_value, gpos->data );
if ( error )
return error;
HB_CursivePos* cp = &st->cursive;
HB_EntryExitRecord* eer;
- FT_Pos entry_x, entry_y;
- FT_Pos exit_x, exit_y;
+ HB_Fixed entry_x, entry_y;
+ HB_Fixed exit_x, exit_y;
HB_UNUSED(nesting_level);
int nesting_level )
{
HB_UShort i, j, mark_index, base_index, property, class;
- FT_Pos x_mark_value, y_mark_value, x_base_value, y_base_value;
+ HB_Fixed x_mark_value, y_mark_value, x_base_value, y_base_value;
HB_Error error;
HB_GPOSHeader* gpos = gpi->gpos;
HB_MarkBasePos* mbp = &st->markbase;
{
HB_UShort i, j, mark_index, lig_index, property, class;
HB_UShort mark_glyph;
- FT_Pos x_mark_value, y_mark_value, x_lig_value, y_lig_value;
+ HB_Fixed x_mark_value, y_mark_value, x_lig_value, y_lig_value;
HB_Error error;
HB_GPOSHeader* gpos = gpi->gpos;
HB_MarkLigPos* mlp = &st->marklig;
int nesting_level )
{
HB_UShort i, j, mark1_index, mark2_index, property, class;
- FT_Pos x_mark1_value, y_mark1_value,
+ HB_Fixed x_mark1_value, y_mark1_value,
x_mark2_value, y_mark2_value;
HB_Error error;
HB_GPOSHeader* gpos = gpi->gpos;
tables are ignored -- you will get device independent values. */
-HB_Error HB_GPOS_Apply_String( FT_Face face,
+HB_Error HB_GPOS_Apply_String( HB_Font font,
HB_GPOSHeader* gpos,
HB_UShort load_flags,
HB_Buffer buffer,
GPOS_Instance gpi;
int i, j, lookup_count, num_features;
- if ( !face || !gpos || !buffer )
+ if ( !font || !gpos || !buffer )
return ERR(HB_Err_Invalid_Argument);
if ( buffer->in_length == 0 )
return HB_Err_Not_Covered;
- gpi.face = face;
+ gpi.font = font;
gpi.gpos = gpos;
gpi.load_flags = load_flags;
gpi.r2l = r2l;
_glyph = HANDLE_Glyph( glyph ) */
-typedef HB_Error (*HB_GlyphFunction)(FT_Face face,
+typedef HB_Error (*HB_GlyphFunction)(HB_Font font,
HB_UInt glyphIndex,
HB_Int loadFlags );
`metric_value' must be returned as a scaled value (but shouldn't
be rounded). */
-typedef HB_Error (*HB_MMFunction)(FT_Face face,
+typedef HB_Error (*HB_MMFunction)(HB_Font font,
HB_UShort metric_id,
- FT_Pos* metric_value,
+ HB_Fixed* metric_value,
void* data );
struct HB_GPOSHeader_
{
- FT_Fixed Version;
+ HB_16Dot16 Version;
HB_ScriptList ScriptList;
HB_FeatureList FeatureList;
typedef HB_GPOSHeader* HB_GPOS;
-HB_Error HB_Load_GPOS_Table( FT_Face face,
+HB_Error HB_Load_GPOS_Table( HB_Font font,
HB_GPOSHeader** gpos,
HB_GDEFHeader* gdef );
tables are ignored -- you will get device independent values. */
-HB_Error HB_GPOS_Apply_String( FT_Face face,
+HB_Error HB_GPOS_Apply_String( HB_Font font,
HB_GPOSHeader* gpos,
HB_UShort load_flags,
HB_Buffer buffer,
-HB_Error HB_Load_GSUB_Table( FT_Face face,
+HB_Error HB_Load_GSUB_Table( HB_Font font,
HB_GSUBHeader** retptr,
HB_GDEFHeader* gdef )
{
- HB_Stream stream = face->stream;
+ HB_Stream stream = font->stream;
HB_Error error;
HB_UInt cur_offset, new_offset, base_offset;
{
HB_UInt offset;
- FT_Fixed Version;
+ HB_16Dot16 Version;
HB_ScriptList ScriptList;
HB_FeatureList FeatureList;
typedef HB_GSUBHeader* HB_GSUB;
-HB_Error HB_Load_GSUB_Table( FT_Face face,
+HB_Error HB_Load_GSUB_Table( HB_Font font,
HB_GSUBHeader** gsub,
HB_GDEFHeader* gdef );
_hb_stream_frame_exit( HB_Stream stream );
HB_INTERNAL HB_Error
-_hb_face_goto_table( FT_Face face,
+_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_face_goto_table( face, tag ) )
+#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 ) )
HB_INTERNAL HB_Error
-_hb_face_goto_table( FT_Face face,
+_hb_font_goto_table( HB_Font font,
HB_UInt the_tag )
{
- HB_Stream stream = face->stream;
+ HB_Stream stream = font->stream;
HB_Error error;
- LOG(( "_hb_face_goto_table( %p, %c%c%c%c, %p )\n",
- face,
+ 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(face) )
+ if ( !FT_IS_SFNT(font) )
{
- LOG(( "not a SFNT face !!\n" ));
+ LOG(( "not a SFNT font !!\n" ));
error = ERR(HB_Err_Invalid_Argument);
}
else
HB_UInt offset = 0;
HB_UInt count, nn;
- if ( face->num_faces > 1 )
+ if ( font->num_faces > 1 )
{
/* deal with TrueType collections */
LOG(( ">> This is a TrueType Collection\n" ));
- if ( FILE_Seek( 12 + face->face_index*4 ) ||
+ if ( FILE_Seek( 12 + font->face_index*4 ) ||
ACCESS_Frame( 4 ) )
goto Exit;