[Xorg-commit] xc/extras/freetype2/src/cff cffcmap.c,1.1,1.1.4.1 cffcmap.h,1.1,1.1.4.1 cffdrivr.c,1.1.4.1,1.1.4.2 cffgload.c,1.1.4.1,1.1.4.2 cffgload.h,1.1.4.1,1.1.4.2 cffload.c,1.1.4.1,1.1.4.2 cffload.h,1.1.4.1,1.1.4.2 cffobjs.c,1.1.4.1,1.1.4.2 cffobjs.h,1.1.4.1,1.1.4.2 cffparse.c,1.1.4.1,1.1.4.2 cffparse.h,1.1.4.1,1.1.4.2 cfftoken.h,1.1,1.1.4.1 rules.mk,1.1.4.1,1.1.4.2
Kaleb Keithley
xorg-commit at pdx.freedesktop.org
Wed May 9 17:30:30 EEST 2007
- Previous message: [Xorg-commit] xc/extras/freetype2/src/cache ftccache.c,1.1.4.1,1.1.4.2 ftccmap.c,1.1.4.1,1.1.4.2 ftcsbits.c,1.1.4.1,1.1.4.2 ftlru.c,1.1.4.1,1.1.4.2 rules.mk,1.1,1.1.4.1
- Next message: [Xorg-commit] xc/extras/freetype2/src/cid cidgload.c,1.1.4.1,1.1.4.2 cidload.c,1.1.4.1,1.1.4.2 cidload.h,1.1.4.1,1.1.4.2 cidobjs.c,1.1.4.1,1.1.4.2 cidparse.c,1.1.4.1,1.1.4.2 cidparse.h,1.1.4.1,1.1.4.2 cidriver.c,1.1.4.1,1.1.4.2 cidtoken.h,1.1,1.1.4.1 rules.mk,1.1,1.1.4.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: kaleb
Index: cffcmap.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffcmap.c,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/cffcmap.c 25 Nov 2003 19:27:19 -0000 1.1
+++ b/cffcmap.c 23 Feb 2004 21:32:44 -0000 1.1.4.1
@@ -4,7 +4,7 @@
/* */
/* CFF character mapping table (cmap) support (body). */
/* */
-/* Copyright 2002 by */
+/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -19,6 +19,8 @@
#include "cffcmap.h"
#include "cffload.h"
+#include "cfferrs.h"
+
/*************************************************************************/
/*************************************************************************/
@@ -36,9 +38,8 @@
CFF_Encoding encoding = &cff->encoding;
- cmap->count = encoding->count;
cmap->gids = encoding->codes;
-
+
return 0;
}
@@ -46,7 +47,6 @@
FT_CALLBACK_DEF( void )
cff_cmap_encoding_done( CFF_CMapStd cmap )
{
- cmap->count = 0;
cmap->gids = NULL;
}
@@ -58,9 +58,9 @@
FT_UInt result = 0;
- if ( char_code < cmap->count )
+ if ( char_code < 256 )
result = cmap->gids[char_code];
-
+
return result;
}
@@ -71,27 +71,27 @@
{
FT_UInt result = 0;
FT_UInt32 char_code = *pchar_code;
-
+
*pchar_code = 0;
- if ( char_code < cmap->count )
+ if ( char_code < 255 )
{
FT_UInt code = (FT_UInt)(char_code + 1);
-
+
for (;;)
{
- if ( code >= cmap->count )
+ if ( code >= 256 )
break;
-
+
result = cmap->gids[code];
if ( result != 0 )
{
*pchar_code = code;
break;
}
-
+
code++;
}
}
@@ -125,28 +125,28 @@
{
FT_UInt32 u1 = ((CFF_CMapUniPair)pair1)->unicode;
FT_UInt32 u2 = ((CFF_CMapUniPair)pair2)->unicode;
-
+
if ( u1 < u2 )
return -1;
-
+
if ( u1 > u2 )
return +1;
-
+
return 0;
- }
+ }
FT_CALLBACK_DEF( FT_Error )
cff_cmap_unicode_init( CFF_CMapUnicode cmap )
{
- FT_Error error;
- FT_UInt count;
- TT_Face face = (TT_Face)FT_CMAP_FACE( cmap );
- FT_Memory memory = FT_FACE_MEMORY( face );
- CFF_Font cff = (CFF_Font)face->extra.data;
- CFF_Charset charset = &cff->charset;
- PSNames_Service psnames = (PSNames_Service)cff->psnames;
+ FT_Error error;
+ FT_UInt count;
+ TT_Face face = (TT_Face)FT_CMAP_FACE( cmap );
+ FT_Memory memory = FT_FACE_MEMORY( face );
+ CFF_Font cff = (CFF_Font)face->extra.data;
+ CFF_Charset charset = &cff->charset;
+ FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
cmap->num_pairs = 0;
@@ -164,12 +164,12 @@
pair = cmap->pairs;
for ( n = 0; n < count; n++ )
{
- FT_UInt sid = charset->sids[n];
+ FT_UInt sid = charset->sids[n];
const char* gname;
gname = cff_index_get_sid_string( &cff->string_index, sid, psnames );
-
+
/* build unsorted pair table by matching glyph names */
if ( gname )
{
@@ -181,7 +181,7 @@
pair->gindex = n;
pair++;
}
-
+
FT_FREE( gname );
}
}
@@ -191,7 +191,7 @@
{
/* there are no unicode characters in here! */
FT_FREE( cmap->pairs );
- error = FT_Err_Invalid_Argument;
+ error = CFF_Err_Invalid_Argument;
}
else
{
@@ -223,7 +223,7 @@
FT_Face face = FT_CMAP_FACE( cmap );
FT_Memory memory = FT_FACE_MEMORY( face );
-
+
FT_FREE( cmap->pairs );
cmap->num_pairs = 0;
}
Index: cffcmap.h
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffcmap.h,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/cffcmap.h 25 Nov 2003 19:27:19 -0000 1.1
+++ b/cffcmap.h 23 Feb 2004 21:32:45 -0000 1.1.4.1
@@ -4,7 +4,7 @@
/* */
/* CFF character mapping table (cmap) support (specification). */
/* */
-/* Copyright 2002 by */
+/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -38,7 +38,6 @@
typedef struct CFF_CMapStdRec_
{
FT_CMapRec cmap;
- FT_UInt count;
FT_UShort* gids; /* up to 256 elements */
} CFF_CMapStdRec;
Index: cffdrivr.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffdrivr.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/cffdrivr.c 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/cffdrivr.c 23 Feb 2004 21:32:45 -0000 1.1.4.2
@@ -4,7 +4,7 @@
/* */
/* OpenType font driver implementation (body). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,7 +22,8 @@
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_SFNT_H
#include FT_TRUETYPE_IDS_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include FT_SERVICE_POSTSCRIPT_INFO_H
#include "cffdrivr.h"
#include "cffgload.h"
@@ -30,6 +31,8 @@
#include "cfferrs.h"
+#include FT_SERVICE_XFREE86_NAME_H
+#include FT_SERVICE_GLYPH_DICT_H
/*************************************************************************/
/* */
@@ -165,7 +168,7 @@
/* glyph_index :: The index of the glyph in the font file. */
/* */
/* load_flags :: A flag indicating what to load for this glyph. The */
- /* FTLOAD_??? constants can be used to control the */
+ /* FT_LOAD_??? constants can be used to control the */
/* glyph loading process (e.g., whether the outline */
/* should be scaled, whether to load bitmaps or not, */
/* whether to hint the outline, etc). */
@@ -210,17 +213,10 @@
}
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** C H A R A C T E R M A P P I N G S ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
+ /*
+ * GLYPH DICT SERVICE
+ *
+ */
static FT_Error
cff_get_glyph_name( CFF_Face face,
@@ -228,17 +224,15 @@
FT_Pointer buffer,
FT_UInt buffer_max )
{
- CFF_Font font = (CFF_Font)face->extra.data;
- FT_Memory memory = FT_FACE_MEMORY( face );
- FT_String* gname;
- FT_UShort sid;
- PSNames_Service psnames;
- FT_Error error;
-
+ CFF_Font font = (CFF_Font)face->extra.data;
+ FT_Memory memory = FT_FACE_MEMORY( face );
+ FT_String* gname;
+ FT_UShort sid;
+ FT_Service_PsCMaps psnames;
+ FT_Error error;
- psnames = (PSNames_Service)FT_Get_Module_Interface(
- face->root.driver->root.library, "psnames" );
+ FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
if ( !psnames )
{
FT_ERROR(( "cff_get_glyph_name:" ));
@@ -255,7 +249,7 @@
/* now, lookup the name itself */
gname = cff_index_get_sid_string( &font->string_index, sid, psnames );
- if ( buffer_max > 0 )
+ if ( gname && buffer_max > 0 )
{
FT_UInt len = (FT_UInt)ft_strlen( gname );
@@ -267,7 +261,7 @@
((FT_Byte*)buffer)[len] = 0;
}
- FT_FREE ( gname );
+ FT_FREE( gname );
error = CFF_Err_Ok;
Exit:
@@ -275,44 +269,24 @@
}
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cff_get_name_index */
- /* */
- /* <Description> */
- /* Uses the psnames module and the CFF font's charset to to return a */
- /* a given glyph name's glyph index. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* */
- /* glyph_name :: The glyph name. */
- /* */
- /* <Return> */
- /* Glyph index. 0 means `undefined character code'. */
- /* */
static FT_UInt
cff_get_name_index( CFF_Face face,
FT_String* glyph_name )
{
- CFF_Font cff;
- CFF_Charset charset;
- PSNames_Service psnames;
- FT_Memory memory = FT_FACE_MEMORY( face );
- FT_String* name;
- FT_UShort sid;
- FT_UInt i;
- FT_Int result;
+ CFF_Font cff;
+ CFF_Charset charset;
+ FT_Service_PsCMaps psnames;
+ FT_Memory memory = FT_FACE_MEMORY( face );
+ FT_String* name;
+ FT_UShort sid;
+ FT_UInt i;
+ FT_Int result;
cff = (CFF_FontRec *)face->extra.data;
charset = &cff->charset;
- psnames = (PSNames_Service)FT_Get_Module_Interface(
- face->root.driver->root.library, "psnames" );
-
+ FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
for ( i = 0; i < cff->num_glyphs; i++ )
{
sid = charset->sids[i];
@@ -335,6 +309,33 @@
}
+ static const FT_Service_GlyphDictRec cff_service_glyph_dict =
+ {
+ (FT_GlyphDict_GetNameFunc) cff_get_glyph_name,
+ (FT_GlyphDict_NameIndexFunc)cff_get_name_index,
+ };
+
+
+ /*
+ * POSTSCRIPT INFO SERVICE
+ *
+ */
+
+ static FT_Int
+ cff_ps_has_glyph_names( FT_Face face )
+ {
+ FT_UNUSED( face );
+ return 1;
+ }
+
+
+ static const FT_Service_PsInfoRec cff_service_ps_info =
+ {
+ (PS_GetFontInfoFunc) NULL, /* unsupported with CFF fonts */
+ (PS_HasGlyphNamesFunc)cff_ps_has_glyph_names
+ };
+
+
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@@ -347,24 +348,30 @@
/*************************************************************************/
/*************************************************************************/
+ static const FT_ServiceDescRec cff_services[] =
+ {
+ { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF },
+ { FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info },
+#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
+ { FT_SERVICE_ID_GLYPH_DICT, &cff_service_glyph_dict },
+#endif
+ { NULL, NULL }
+ };
+
+
static FT_Module_Interface
cff_get_interface( CFF_Driver driver,
const char* module_interface )
{
- FT_Module sfnt;
-
-
-#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
-
- if ( ft_strcmp( (const char*)module_interface, "glyph_name" ) == 0 )
- return (FT_Module_Interface)cff_get_glyph_name;
+ FT_Module sfnt;
+ FT_Module_Interface result;
- if ( ft_strcmp( (const char*)module_interface, "name_index" ) == 0 )
- return (FT_Module_Interface)cff_get_name_index;
-#endif
+ result = ft_service_list_lookup( cff_services, module_interface );
+ if ( result != NULL )
+ return result;
- /* we simply pass our request to the `sfnt' module */
+ /* we pass our request to the `sfnt' module */
sfnt = FT_Get_Module( driver->root.root.library, "sfnt" );
return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0;
@@ -378,9 +385,9 @@
{
/* begin with the FT_Module_Class fields */
{
- ft_module_font_driver |
- ft_module_driver_scalable |
- ft_module_driver_has_hinter,
+ FT_MODULE_FONT_DRIVER |
+ FT_MODULE_DRIVER_SCALABLE |
+ FT_MODULE_DRIVER_HAS_HINTER,
sizeof( CFF_DriverRec ),
"cff",
Index: cffgload.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffgload.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/cffgload.c 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/cffgload.c 23 Feb 2004 21:32:45 -0000 1.1.4.2
@@ -4,7 +4,7 @@
/* */
/* OpenType Glyph Loader (body). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -15,8 +15,6 @@
/* */
/***************************************************************************/
-/* $XFree86: xc/extras/freetype2/src/cff/cffgload.c,v 1.3 2003/10/22 17:26:28 tsi Exp $ */
-
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
@@ -248,7 +246,6 @@
builder->current = &loader->current.outline;
FT_GlyphLoader_Rewind( loader );
- builder->hint_flags = FT_FACE(face)->internal->hint_flags;
builder->hints_globals = 0;
builder->hints_funcs = 0;
@@ -369,7 +366,7 @@
decoder->num_globals = cff->num_global_subrs;
decoder->globals = cff->global_subrs;
decoder->globals_bias = cff_compute_bias( decoder->num_globals );
-
+
decoder->hint_mode = hint_mode;
}
@@ -820,7 +817,7 @@
seed = (FT_Fixed)(char*)&seed ^
(FT_Fixed)(char*)&decoder ^
(FT_Fixed)(char*)&charstring_base;
- seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFF;
+ seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;
if ( seed == 0 )
seed = 0x7384;
@@ -905,7 +902,7 @@
*decoder->top++ = val;
#ifdef FT_DEBUG_LEVEL_TRACE
- if ( !( val & 0xFFFF ) )
+ if ( !( val & 0xFFFFL ) )
FT_TRACE4(( " %d", (FT_Int32)( val >> 16 ) ));
else
FT_TRACE4(( " %.2f", val / 65536.0 ));
@@ -1772,7 +1769,7 @@
hinter->apply( hinter->hints,
builder->current,
(PSH_Globals)builder->hints_globals,
- (FT_Render_Mode)builder->hint_flags );
+ decoder->hint_mode );
}
/* add current outline to the glyph slot */
@@ -1826,7 +1823,7 @@
FT_TRACE4(( " rand" ));
Rand = seed;
- if ( Rand >= 0x8000 )
+ if ( Rand >= 0x8000L )
Rand++;
args[0] = Rand;
@@ -2365,18 +2362,19 @@
cff_builder_done( &decoder.builder );
}
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ #ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Incremental fonts can optionally override the metrics. */
- if ( !error &&
- face->root.internal->incremental_interface &&
+ if ( !error &&
+ face->root.internal->incremental_interface &&
face->root.internal->incremental_interface->funcs->get_glyph_metrics )
{
FT_Incremental_MetricsRec metrics;
+
metrics.bearing_x = decoder.builder.left_bearing.x;
- metrics.bearing_y = decoder.builder.left_bearing.y;
- metrics.advance = decoder.builder.advance.x;
+ metrics.bearing_y = decoder.builder.left_bearing.y;
+ metrics.advance = decoder.builder.advance.x;
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
face->root.internal->incremental_interface->object,
glyph_index, FALSE, &metrics );
@@ -2413,6 +2411,7 @@
{
FT_BBox cbox;
FT_Glyph_Metrics* metrics = &glyph->root.metrics;
+ FT_Vector advance;
/* copy the _unscaled_ advance width */
@@ -2442,6 +2441,15 @@
font_offset.x,
font_offset.y );
+ advance.x = metrics->horiAdvance;
+ advance.y = 0;
+ FT_Vector_Transform( &advance, &font_matrix );
+ metrics->horiAdvance = advance.x + font_offset.x;
+ advance.x = 0;
+ advance.y = metrics->vertAdvance;
+ FT_Vector_Transform( &advance, &font_matrix );
+ metrics->vertAdvance = advance.y + font_offset.y;
+
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
{
/* scale the outline and the metrics */
Index: cffgload.h
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffgload.h,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/cffgload.h 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/cffgload.h 23 Feb 2004 21:32:45 -0000 1.1.4.2
@@ -4,7 +4,7 @@
/* */
/* OpenType Glyph Loader (specification). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -114,8 +114,6 @@
FT_Error error; /* only used for memory errors */
FT_Bool metrics_only;
- FT_UInt32 hint_flags;
-
void* hints_funcs; /* hinter-specific */
void* hints_globals; /* hinter-specific */
Index: cffload.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffload.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/cffload.c 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/cffload.c 23 Feb 2004 21:32:45 -0000 1.1.4.2
@@ -4,7 +4,7 @@
/* */
/* OpenType and CFF data/program tables loader (body). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -20,7 +20,7 @@
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
#include FT_TRUETYPE_TAGS_H
#include "cffload.h"
@@ -1312,9 +1312,9 @@
FT_LOCAL_DEF( FT_String* )
- cff_index_get_sid_string( CFF_Index idx,
- FT_UInt sid,
- PSNames_Service psnames_service )
+ cff_index_get_sid_string( CFF_Index idx,
+ FT_UInt sid,
+ FT_Service_PsCMaps psnames )
{
/* if it is not a standard string, return it */
if ( sid > 390 )
@@ -1323,7 +1323,7 @@
/* that's a standard string, fetch a copy from the PSName module */
{
FT_String* name = 0;
- const char* adobe_name = psnames_service->adobe_std_strings( sid );
+ const char* adobe_name = psnames->adobe_std_strings( sid );
FT_UInt len;
@@ -1505,8 +1505,8 @@
FT_ULong base_offset,
FT_ULong offset )
{
- FT_Memory memory = stream->memory;
- FT_Error error = 0;
+ FT_Memory memory = stream->memory;
+ FT_Error error = 0;
FT_UShort glyph_sid;
@@ -1557,7 +1557,6 @@
while ( j < num_glyphs )
{
-
/* Read the first glyph sid of the range. */
if ( FT_READ_USHORT( glyph_sid ) )
goto Exit;
@@ -1595,7 +1594,7 @@
/* In order to use a predefined charset, the following must be */
/* true: The charset constructed for the glyphs in the font's */
/* charstrings dictionary must match the predefined charset in */
- /* the first num_glyphs */
+ /* the first num_glyphs. */
charset->offset = offset; /* record charset type */
@@ -1680,7 +1679,6 @@
}
-
static void
cff_encoding_done( CFF_Encoding encoding )
{
@@ -1690,7 +1688,6 @@
}
-
static FT_Error
cff_encoding_load( CFF_Encoding encoding,
CFF_Charset charset,
@@ -1699,11 +1696,11 @@
FT_ULong base_offset,
FT_ULong offset )
{
- FT_Error error = 0;
- FT_UInt count;
- FT_UInt j;
- FT_UShort glyph_sid;
- FT_UInt glyph_code;
+ FT_Error error = 0;
+ FT_UInt count;
+ FT_UInt j;
+ FT_UShort glyph_sid;
+ FT_UInt glyph_code;
/* Check for charset->sids. If we do not have this, we fail. */
@@ -1720,8 +1717,8 @@
encoding->codes[j] = 0;
}
- /* Note: The encoding table in a CFF font is indexed by glyph index, */
- /* where the first encoded glyph index is 1. Hence, we read the char */
+ /* Note: The encoding table in a CFF font is indexed by glyph index; */
+ /* the first encoded glyph index is 1. Hence, we read the character */
/* code (`glyph_code') at index j and make the assignment: */
/* */
/* encoding->codes[glyph_code] = j + 1 */
@@ -1734,7 +1731,6 @@
if ( offset > 1 )
{
-
encoding->offset = base_offset + offset;
/* we need to parse the table to determine its size */
@@ -1749,9 +1745,10 @@
{
FT_Byte* p;
- /* by convention, GID 0 is always ".notdef" and is never */
- /* coded in the font. Hence, the number of codes found */
- /* in the table is 'count+1' */
+
+ /* By convention, GID 0 is always ".notdef" and is never */
+ /* coded in the font. Hence, the number of codes found */
+ /* in the table is `count+1'. */
/* */
encoding->count = count + 1;
@@ -1781,7 +1778,7 @@
case 1:
{
- FT_Byte nleft;
+ FT_UInt nleft;
FT_UInt i = 1;
FT_UInt k;
@@ -1821,7 +1818,7 @@
}
}
- /* simple check, one never knows what can be found in a font */
+ /* simple check; one never knows what can be found in a font */
if ( encoding->count > 256 )
encoding->count = 256;
}
@@ -1856,13 +1853,13 @@
/* Assign code to SID mapping. */
encoding->sids[glyph_code] = glyph_sid;
- /* First, lookup GID which has been assigned to */
- /* SID glyph_sid. */
+ /* First, look up GID which has been assigned to */
+ /* SID glyph_sid. */
for ( gindex = 0; gindex < num_glyphs; gindex++ )
{
if ( charset->sids[gindex] == glyph_sid )
{
- encoding->codes[glyph_code] = (FT_UShort) gindex;
+ encoding->codes[glyph_code] = (FT_UShort)gindex;
break;
}
}
@@ -1874,10 +1871,10 @@
FT_UInt i;
- /* We take into account the fact a CFF font can use a predefined */
- /* encoding without containing all of the glyphs encoded by this */
- /* encoding (see the note at the end of section 12 in the CFF */
- /* specification). */
+ /* We take into account the fact a CFF font can use a predefined */
+ /* encoding without containing all of the glyphs encoded by this */
+ /* encoding (see the note at the end of section 12 in the CFF */
+ /* specification). */
switch ( (FT_UInt)offset )
{
@@ -1899,7 +1896,6 @@
encoding->count = 0;
-
for ( j = 0; j < 256; j++ )
{
/* If j is encoded, find the GID for it. */
@@ -1923,8 +1919,8 @@
encoding->codes[j] = (FT_UShort)i;
/* update encoding count */
- if ( encoding->count < j+1 )
- encoding->count = j+1;
+ if ( encoding->count < j + 1 )
+ encoding->count = j + 1;
}
}
}
@@ -1964,8 +1960,8 @@
/* set defaults */
FT_MEM_ZERO( top, sizeof ( *top ) );
- top->underline_position = -100;
- top->underline_thickness = 50;
+ top->underline_position = -100L << 16;
+ top->underline_thickness = 50L << 16;
top->charstring_type = 2;
top->font_matrix.xx = 0x10000L;
top->font_matrix.yy = 0x10000L;
@@ -1992,8 +1988,8 @@
priv->blue_shift = 7;
priv->blue_fuzz = 1;
priv->lenIV = -1;
- priv->expansion_factor = (FT_Fixed)0.06 * 0x10000L;
- priv->blue_scale = (FT_Fixed)0.039625 * 0x10000L;
+ priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );
+ priv->blue_scale = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );
cff_parser_init( &parser, CFF_CODE_PRIVATE, priv );
@@ -2207,7 +2203,7 @@
if ( font->num_glyphs > 0 )
{
error = cff_charset_load( &font->charset, font->num_glyphs, stream,
- base_offset, dict->charset_offset );
+ base_offset, dict->charset_offset );
if ( error )
goto Exit;
Index: cffload.h
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffload.h,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/cffload.h 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/cffload.h 23 Feb 2004 21:32:45 -0000 1.1.4.2
@@ -4,7 +4,7 @@
/* */
/* OpenType & CFF data/program tables loader (specification). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -21,8 +21,8 @@
#include <ft2build.h>
-#include FT_INTERNAL_CFF_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include "cfftypes.h"
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
FT_BEGIN_HEADER
@@ -36,9 +36,9 @@
FT_UInt element );
FT_LOCAL( FT_String* )
- cff_index_get_sid_string( CFF_Index idx,
- FT_UInt sid,
- PSNames_Service psnames_interface );
+ cff_index_get_sid_string( CFF_Index idx,
+ FT_UInt sid,
+ FT_Service_PsCMaps psnames );
FT_LOCAL( FT_Error )
Index: cffobjs.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffobjs.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/cffobjs.c 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/cffobjs.c 23 Feb 2004 21:32:45 -0000 1.1.4.2
@@ -4,7 +4,7 @@
/* */
/* OpenType objects manager (body). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -24,7 +24,7 @@
#include FT_TRUETYPE_IDS_H
#include FT_TRUETYPE_TAGS_H
#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
#include "cffobjs.h"
#include "cffload.h"
@@ -253,24 +253,31 @@
FT_Int num_params,
FT_Parameter* params )
{
- FT_Error error;
- SFNT_Service sfnt;
- PSNames_Service psnames;
- PSHinter_Service pshinter;
- FT_Bool pure_cff = 1;
- FT_Bool sfnt_format = 0;
+ FT_Error error;
+ SFNT_Service sfnt;
+ FT_Service_PsCMaps psnames;
+ PSHinter_Service pshinter;
+ FT_Bool pure_cff = 1;
+ FT_Bool sfnt_format = 0;
+#if 0
+ FT_FACE_FIND_GLOBAL_SERVICE( face, sfnt, SFNT );
+ FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES );
+ FT_FACE_FIND_GLOBAL_SERVICE( face, pshinter, POSTSCRIPT_HINTER );
+ if ( !sfnt )
+ goto Bad_Format;
+#else
sfnt = (SFNT_Service)FT_Get_Module_Interface(
face->root.driver->root.library, "sfnt" );
if ( !sfnt )
goto Bad_Format;
- psnames = (PSNames_Service)FT_Get_Module_Interface(
- face->root.driver->root.library, "psnames" );
+ FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
pshinter = (PSHinter_Service)FT_Get_Module_Interface(
face->root.driver->root.library, "pshinter" );
+#endif
/* create input stream from resource */
if ( FT_STREAM_SEEK( 0 ) )
@@ -293,7 +300,7 @@
sfnt_format = 1;
/* now, the font can be either an OpenType/CFF font, or an SVG CEF */
- /* font in the later case; it doesn't have a `head' table */
+ /* font; in the later case it doesn't have a `head' table */
error = face->goto_table( face, TTAG_head, stream, 0 );
if ( !error )
{
@@ -347,7 +354,7 @@
goto Exit;
cff->pshinter = pshinter;
- cff->psnames = psnames;
+ cff->psnames = (void*)psnames;
/* Complement the root flags with some interesting information. */
/* Note that this is only necessary for pure CFF and CEF fonts. */
@@ -396,6 +403,11 @@
else
root->units_per_EM = 1000;
+ root->underline_position =
+ (FT_Short)( dict->underline_position >> 16 );
+ root->underline_thickness =
+ (FT_Short)( dict->underline_thickness >> 16 );
+
/* retrieve font family & style name */
root->family_name = cff_index_get_name( &cff->name_index, face_index );
if ( dict->cid_registry )
@@ -463,7 +475,7 @@
CFF_Encoding encoding = &cff->encoding;
- for ( nn = 0; nn < (FT_UInt) root->num_charmaps; nn++ )
+ for ( nn = 0; nn < (FT_UInt)root->num_charmaps; nn++ )
{
cmap = root->charmaps[nn];
@@ -482,12 +494,12 @@
cmaprec.encoding_id = 1;
cmaprec.encoding = FT_ENCODING_UNICODE;
- nn = (FT_UInt) root->num_charmaps;
+ nn = (FT_UInt)root->num_charmaps;
FT_CMap_New( &cff_cmap_unicode_class_rec, NULL, &cmaprec, NULL );
/* if no Unicode charmap was previously selected, select this one */
- if ( root->charmap == NULL && nn != (FT_UInt) root->num_charmaps )
+ if ( root->charmap == NULL && nn != (FT_UInt)root->num_charmaps )
root->charmap = root->charmaps[nn];
Skip_Unicode:
@@ -501,26 +513,25 @@
if ( encoding->offset == 0 )
{
- cmaprec.encoding_id = 0;
+ cmaprec.encoding_id = TT_ADOBE_ID_STANDARD;
cmaprec.encoding = FT_ENCODING_ADOBE_STANDARD;
clazz = &cff_cmap_encoding_class_rec;
}
else if ( encoding->offset == 1 )
{
- cmaprec.encoding_id = 1;
+ cmaprec.encoding_id = TT_ADOBE_ID_EXPERT;
cmaprec.encoding = FT_ENCODING_ADOBE_EXPERT;
clazz = &cff_cmap_encoding_class_rec;
}
else
{
- cmaprec.encoding_id = 3;
+ cmaprec.encoding_id = TT_ADOBE_ID_CUSTOM;
cmaprec.encoding = FT_ENCODING_ADOBE_CUSTOM;
clazz = &cff_cmap_encoding_class_rec;
}
FT_CMap_New( clazz, NULL, &cmaprec, NULL );
}
-
}
}
Index: cffobjs.h
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffobjs.h,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/cffobjs.h 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/cffobjs.h 23 Feb 2004 21:32:45 -0000 1.1.4.2
@@ -4,7 +4,7 @@
/* */
/* OpenType objects manager (specification). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,9 +22,9 @@
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_CFF_TYPES_H
+#include "cfftypes.h"
#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
FT_BEGIN_HEADER
Index: cffparse.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffparse.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/cffparse.c 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/cffparse.c 23 Feb 2004 21:32:45 -0000 1.1.4.2
@@ -4,7 +4,7 @@
/* */
/* CFF token stream parser (body) */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -38,6 +38,7 @@
cff_kind_none = 0,
cff_kind_num,
cff_kind_fixed,
+ cff_kind_fixed_thousand,
cff_kind_string,
cff_kind_bool,
cff_kind_delta,
@@ -429,6 +430,8 @@
CFF_FIELD( code, name, cff_kind_num )
#define CFF_FIELD_FIXED( code, name ) \
CFF_FIELD( code, name, cff_kind_fixed )
+#define CFF_FIELD_FIXED_1000( code, name ) \
+ CFF_FIELD( code, name, cff_kind_fixed_thousand )
#define CFF_FIELD_STRING( code, name ) \
CFF_FIELD( code, name, cff_kind_string )
#define CFF_FIELD_BOOL( code, name ) \
@@ -579,6 +582,10 @@
case cff_kind_fixed:
val = cff_parse_fixed( parser->stack );
+ goto Store_Number;
+
+ case cff_kind_fixed_thousand:
+ val = cff_parse_fixed_thousand( parser->stack );
Store_Number:
switch ( field->size )
Index: cffparse.h
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffparse.h,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/cffparse.h 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/cffparse.h 23 Feb 2004 21:32:45 -0000 1.1.4.2
@@ -21,7 +21,7 @@
#include <ft2build.h>
-#include FT_INTERNAL_CFF_TYPES_H
+#include "cfftypes.h"
#include FT_INTERNAL_OBJECTS_H
Index: cfftoken.h
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cfftoken.h,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/cfftoken.h 14 Nov 2003 16:48:24 -0000 1.1
+++ b/cfftoken.h 23 Feb 2004 21:32:45 -0000 1.1.4.1
@@ -4,7 +4,7 @@
/* */
/* CFF token definitions (specification only). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -30,8 +30,8 @@
CFF_FIELD_STRING ( 4, weight )
CFF_FIELD_BOOL ( 0x101, is_fixed_pitch )
CFF_FIELD_FIXED ( 0x102, italic_angle )
- CFF_FIELD_NUM ( 0x103, underline_position )
- CFF_FIELD_NUM ( 0x104, underline_thickness )
+ CFF_FIELD_FIXED ( 0x103, underline_position )
+ CFF_FIELD_FIXED ( 0x104, underline_thickness )
CFF_FIELD_NUM ( 0x105, paint_type )
CFF_FIELD_NUM ( 0x106, charstring_type )
CFF_FIELD_CALLBACK( 0x107, font_matrix )
@@ -72,26 +72,26 @@
#undef CFFCODE
#define CFFCODE CFFCODE_PRIVATE
- CFF_FIELD_DELTA( 6, blue_values, 14 )
- CFF_FIELD_DELTA( 7, other_blues, 10 )
- CFF_FIELD_DELTA( 8, family_blues, 14 )
- CFF_FIELD_DELTA( 9, family_other_blues, 10 )
- CFF_FIELD_FIXED( 0x109, blue_scale )
- CFF_FIELD_NUM ( 0x10A, blue_shift )
- CFF_FIELD_NUM ( 0x10B, blue_fuzz )
- CFF_FIELD_NUM ( 10, standard_width )
- CFF_FIELD_NUM ( 11, standard_height )
- CFF_FIELD_DELTA( 0x10C, snap_widths, 13 )
- CFF_FIELD_DELTA( 0x10D, snap_heights, 13 )
- CFF_FIELD_BOOL ( 0x10E, force_bold )
- CFF_FIELD_FIXED( 0x10F, force_bold_threshold )
- CFF_FIELD_NUM ( 0x110, lenIV )
- CFF_FIELD_NUM ( 0x111, language_group )
- CFF_FIELD_FIXED( 0x112, expansion_factor )
- CFF_FIELD_NUM ( 0x113, initial_random_seed )
- CFF_FIELD_NUM ( 19, local_subrs_offset )
- CFF_FIELD_NUM ( 20, default_width )
- CFF_FIELD_NUM ( 21, nominal_width )
+ CFF_FIELD_DELTA ( 6, blue_values, 14 )
+ CFF_FIELD_DELTA ( 7, other_blues, 10 )
+ CFF_FIELD_DELTA ( 8, family_blues, 14 )
+ CFF_FIELD_DELTA ( 9, family_other_blues, 10 )
+ CFF_FIELD_FIXED_1000( 0x109, blue_scale )
+ CFF_FIELD_NUM ( 0x10A, blue_shift )
+ CFF_FIELD_NUM ( 0x10B, blue_fuzz )
+ CFF_FIELD_NUM ( 10, standard_width )
+ CFF_FIELD_NUM ( 11, standard_height )
+ CFF_FIELD_DELTA ( 0x10C, snap_widths, 13 )
+ CFF_FIELD_DELTA ( 0x10D, snap_heights, 13 )
+ CFF_FIELD_BOOL ( 0x10E, force_bold )
+ CFF_FIELD_FIXED ( 0x10F, force_bold_threshold )
+ CFF_FIELD_NUM ( 0x110, lenIV )
+ CFF_FIELD_NUM ( 0x111, language_group )
+ CFF_FIELD_FIXED ( 0x112, expansion_factor )
+ CFF_FIELD_NUM ( 0x113, initial_random_seed )
+ CFF_FIELD_NUM ( 19, local_subrs_offset )
+ CFF_FIELD_NUM ( 20, default_width )
+ CFF_FIELD_NUM ( 21, nominal_width )
/* END */
Index: rules.mk
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/rules.mk,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/rules.mk 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/rules.mk 23 Feb 2004 21:32:45 -0000 1.1.4.2
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2000, 2001 by
+# Copyright 1996-2000, 2001, 2003 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -15,27 +15,26 @@
# OpenType driver directory
#
-CFF_DIR := $(SRC_)cff
-CFF_DIR_ := $(CFF_DIR)$(SEP)
+CFF_DIR := $(SRC_DIR)/cff
-CFF_COMPILE := $(FT_COMPILE) $I$(CFF_DIR)
+CFF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(CFF_DIR))
# CFF driver sources (i.e., C files)
#
-CFF_DRV_SRC := $(CFF_DIR_)cffobjs.c \
- $(CFF_DIR_)cffload.c \
- $(CFF_DIR_)cffgload.c \
- $(CFF_DIR_)cffparse.c \
- $(CFF_DIR_)cffcmap.c \
- $(CFF_DIR_)cffdrivr.c
+CFF_DRV_SRC := $(CFF_DIR)/cffobjs.c \
+ $(CFF_DIR)/cffload.c \
+ $(CFF_DIR)/cffgload.c \
+ $(CFF_DIR)/cffparse.c \
+ $(CFF_DIR)/cffcmap.c \
+ $(CFF_DIR)/cffdrivr.c
# CFF driver headers
#
CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \
- $(CFF_DIR_)cfftoken.h \
- $(CFF_DIR_)cfferrs.h
+ $(CFF_DIR)/cfftoken.h \
+ $(CFF_DIR)/cfferrs.h
# CFF driver object(s)
@@ -43,24 +42,24 @@
# CFF_DRV_OBJ_M is used during `multi' builds
# CFF_DRV_OBJ_S is used during `single' builds
#
-CFF_DRV_OBJ_M := $(CFF_DRV_SRC:$(CFF_DIR_)%.c=$(OBJ_)%.$O)
-CFF_DRV_OBJ_S := $(OBJ_)cff.$O
+CFF_DRV_OBJ_M := $(CFF_DRV_SRC:$(CFF_DIR)/%.c=$(OBJ_DIR)/%.$O)
+CFF_DRV_OBJ_S := $(OBJ_DIR)/cff.$O
# CFF driver source file for single build
#
-CFF_DRV_SRC_S := $(CFF_DIR_)cff.c
+CFF_DRV_SRC_S := $(CFF_DIR)/cff.c
# CFF driver - single object
#
$(CFF_DRV_OBJ_S): $(CFF_DRV_SRC_S) $(CFF_DRV_SRC) $(FREETYPE_H) $(CFF_DRV_H)
- $(CFF_COMPILE) $T$@ $(CFF_DRV_SRC_S)
+ $(CFF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(CFF_DRV_SRC_S))
# CFF driver - multiple objects
#
-$(OBJ_)%.$O: $(CFF_DIR_)%.c $(FREETYPE_H) $(CFF_DRV_H)
- $(CFF_COMPILE) $T$@ $<
+$(OBJ_DIR)/%.$O: $(CFF_DIR)/%.c $(FREETYPE_H) $(CFF_DRV_H)
+ $(CFF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
# update main driver object lists
@@ -68,4 +67,5 @@
DRV_OBJS_S += $(CFF_DRV_OBJ_S)
DRV_OBJS_M += $(CFF_DRV_OBJ_M)
+
# EOF
- Previous message: [Xorg-commit] xc/extras/freetype2/src/cache ftccache.c,1.1.4.1,1.1.4.2 ftccmap.c,1.1.4.1,1.1.4.2 ftcsbits.c,1.1.4.1,1.1.4.2 ftlru.c,1.1.4.1,1.1.4.2 rules.mk,1.1,1.1.4.1
- Next message: [Xorg-commit] xc/extras/freetype2/src/cid cidgload.c,1.1.4.1,1.1.4.2 cidload.c,1.1.4.1,1.1.4.2 cidload.h,1.1.4.1,1.1.4.2 cidobjs.c,1.1.4.1,1.1.4.2 cidparse.c,1.1.4.1,1.1.4.2 cidparse.h,1.1.4.1,1.1.4.2 cidriver.c,1.1.4.1,1.1.4.2 cidtoken.h,1.1,1.1.4.1 rules.mk,1.1,1.1.4.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the xorg-commit
mailing list