ref: 1987fb2f72b8a0c3d81db1084535d94d3cc68d9c
parent: 44be4d56fcc5f9530d45247c0f08f17c0c71fa85
author: Werner Lemberg <[email protected]>
date: Sun Mar 31 01:56:56 EST 2002
* src/truetype/ttobjs.c (TT_Size_Init): Fix typo. * src/otlayout/otlcommn.c, src/otlayout/otlcommn.h: s/index/idx/.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2002-03-31 Yao Zhang <[email protected]>
+
+ * src/truetype/ttobjs.c (TT_Size_Init): Fix typo.
+
+2002-03-31 Werner Lemberg <[email protected]>
+
+ * src/otlayout/otlcommn.c, src/otlayout/otlcommn.h: s/index/idx/.
+
2002-03-30 David Turner <[email protected]>
* include/freetype/internal/tttypes.h: Adding comments to some of
--- a/src/otlayout/otlcommn.c
+++ b/src/otlayout/otlcommn.c
@@ -1,5 +1,24 @@
+/***************************************************************************/
+/* */
+/* otlcommn.c */
+/* */
+/* OpenType layout support, common tables (body). */
+/* */
+/* Copyright 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
#include "otlayout.h"
+
/*************************************************************************/
/*************************************************************************/
/***** *****/
@@ -15,160 +34,170 @@
OTL_Bytes p;
OTL_UInt format;
+
if ( table + 4 > valid->limit )
OTL_INVALID_TOO_SHORT;
- format = OTL_NEXT_UShort(p);
- switch (format)
+ format = OTL_NEXT_UShort( p );
+ switch ( format )
{
- case 1:
- {
- OTL_UInt count = OTL_NEXT_UShort(p);
+ case 1:
+ {
+ OTL_UInt count = OTL_NEXT_UShort( p );
- if ( p + count*2 >= valid->limit )
- OTL_INVALID_TOO_SHORT;
- /* XXX: check glyph indices */
- }
- break;
+ if ( p + count * 2 >= valid->limit )
+ OTL_INVALID_TOO_SHORT;
- case 2:
- {
- OTL_UInt n, num_ranges = OTL_NEXT_UShort(p);
- OTL_UInt start, end, start_cover, total = 0, last = 0;
+ /* XXX: check glyph indices */
+ }
+ break;
- if ( p + num_ranges*6 >= valid->limit )
- OTL_INVALID_TOO_SHORT;
+ case 2:
+ {
+ OTL_UInt n, num_ranges = OTL_NEXT_UShort( p );
+ OTL_UInt start, end, start_cover, total = 0, last = 0;
- for ( n = 0; n < num_ranges; n++ )
- {
- start = OTL_NEXT_UShort(p);
- end = OTL_NEXT_UShort(p);
- start_cover = OTL_NEXT_UShort(p);
- if ( start > end || start_cover != total )
- OTL_INVALID_DATA;
+ if ( p + num_ranges * 6 >= valid->limit )
+ OTL_INVALID_TOO_SHORT;
- if ( n > 0 && start <= last )
- OTL_INVALID_DATA;
+ for ( n = 0; n < num_ranges; n++ )
+ {
+ start = OTL_NEXT_UShort( p );
+ end = OTL_NEXT_UShort( p );
+ start_cover = OTL_NEXT_UShort( p );
- total += (end - start + 1);
- last = end;
- }
+ if ( start > end || start_cover != total )
+ OTL_INVALID_DATA;
+
+ if ( n > 0 && start <= last )
+ OTL_INVALID_DATA;
+
+ total += end - start + 1;
+ last = end;
}
- break;
+ }
+ break;
- default:
- OTL_INVALID_FORMAT;
+ default:
+ OTL_INVALID_FORMAT;
}
}
OTL_LOCALDEF( OTL_UInt )
- otl_coverage_get_count( OTL_Bytes table )
+ otl_coverage_get_count( OTL_Bytes table )
{
OTL_Bytes p = table;
- OTL_UInt format = OTL_NEXT_UShort(p);
- OTL_UInt count = OTL_NEXT_UShort(p);
+ OTL_UInt format = OTL_NEXT_UShort( p );
+ OTL_UInt count = OTL_NEXT_UShort( p );
OTL_UInt result = 0;
+
switch ( format )
{
- case 1:
- return count;
+ case 1:
+ return count;
- case 2:
- {
- OTL_UInt start, end;
+ case 2:
+ {
+ OTL_UInt start, end;
- for ( ; count > 0; count-- )
- {
- start = OTL_NEXT_UShort(p);
- end = OTL_NEXT_UShort(p);
- p += 2; /* skip start_index */
- result += ( end - start + 1 );
- }
+ for ( ; count > 0; count-- )
+ {
+ start = OTL_NEXT_UShort( p );
+ end = OTL_NEXT_UShort( p );
+ p += 2; /* skip start_index */
+
+ result += end - start + 1;
}
- break;
+ }
+ break;
- default:
- ;
+ default:
+ ;
}
- return result;
+ return result;
}
OTL_LOCALDEF( OTL_Int )
- otl_coverage_get_index( OTL_Bytes table,
- OTL_UInt glyph_index )
+ otl_coverage_get_index( OTL_Bytes table,
+ OTL_UInt glyph_index )
{
OTL_Bytes p = table;
- OTL_UInt format = OTL_NEXT_UShort(p);
- OTL_UInt count = OTL_NEXT_UShort(p);
+ OTL_UInt format = OTL_NEXT_UShort( p );
+ OTL_UInt count = OTL_NEXT_UShort( p );
+
switch ( format )
{
- case 1:
- {
- OTL_UInt min = 0, max = count, mid, gindex;
+ case 1:
+ {
+ OTL_UInt min = 0, max = count, mid, gindex;
- table += 4;
- while ( min < max )
- {
- mid = ( min + max ) >> 1;
- p = table + 2*mid;
- gindex = OTL_PEEK_UShort(p);
- if ( glyph_index == gindex )
- return (OTL_Int)mid;
+ table += 4;
+ while ( min < max )
+ {
+ mid = ( min + max ) >> 1;
+ p = table + 2 * mid;
+ gindex = OTL_PEEK_UShort( p );
- if ( glyph_index < gindex )
- max = mid;
- else
- min = mid + 1;
- }
+ if ( glyph_index == gindex )
+ return (OTL_Int)mid;
+
+ if ( glyph_index < gindex )
+ max = mid;
+ else
+ min = mid + 1;
}
- break;
+ }
+ break;
- case 2:
- {
- OTL_UInt min = 0, max = count, mid;
- OTL_UInt start, end, delta, start_cover;
+ case 2:
+ {
+ OTL_UInt min = 0, max = count, mid;
+ OTL_UInt start, end, delta, start_cover;
- table += 4;
- while ( min < max )
- {
- mid = ( min + max ) >> 1;
- p = table + 6*mid;
- start = OTL_NEXT_UShort(p);
- end = OTL_NEXT_UShort(p);
- if ( glyph_index < start )
- max = mid;
- else if ( glyph_index > end )
- min = mid + 1;
- else
- return (OTL_Int)( glyph_index + OTL_NEXT_UShort(p) - start );
- }
+ table += 4;
+ while ( min < max )
+ {
+ mid = ( min + max ) >> 1;
+ p = table + 6 * mid;
+ start = OTL_NEXT_UShort( p );
+ end = OTL_NEXT_UShort( p );
+
+ if ( glyph_index < start )
+ max = mid;
+ else if ( glyph_index > end )
+ min = mid + 1;
+ else
+ return (OTL_Int)( glyph_index + OTL_NEXT_UShort( p ) - start );
}
- break;
+ }
+ break;
- default:
- ;
+ default:
+ ;
}
- return -1;
+
+ return -1;
}
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** CLASS DEFINITION TABLE *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** CLASS DEFINITION TABLE *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
OTL_LOCALDEF( void )
otl_class_definition_validate( OTL_Bytes table,
OTL_Validator valid )
@@ -176,52 +205,55 @@
OTL_Bytes p = table;
OTL_UInt format;
+
if ( p + 4 > valid->limit )
OTL_INVALID_TOO_SHORT;
- format = OTL_NEXT_UShort(p);
+ format = OTL_NEXT_UShort( p );
switch ( format )
{
- case 1:
- {
- OTL_UInt count, start = OTL_NEXT_UShort(p);
+ case 1:
+ {
+ OTL_UInt count, start = OTL_NEXT_UShort( p );
- if ( p + 2 > valid->limit )
- OTL_INVALID_TOO_SHORT;
- count = OTL_NEXT_UShort(p);
+ if ( p + 2 > valid->limit )
+ OTL_INVALID_TOO_SHORT;
- if ( p + count*2 > valid->limit )
- OTL_INVALID_TOO_SHORT;
+ count = OTL_NEXT_UShort( p );
- /* XXX: check glyph indices */
- }
- break;
+ if ( p + count * 2 > valid->limit )
+ OTL_INVALID_TOO_SHORT;
- case 2:
- {
- OTL_UInt n, num_ranges = OTL_NEXT_UShort(p);
- OTL_UInt start, end, value, last = 0;
+ /* XXX: check glyph indices */
+ }
+ break;
- if ( p + num_ranges*6 > valid->limit )
- OTL_INVALID_TOO_SHORT;
+ case 2:
+ {
+ OTL_UInt n, num_ranges = OTL_NEXT_UShort( p );
+ OTL_UInt start, end, value, last = 0;
- for ( n = 0; n < num_ranges; n++ )
- {
- start = OTL_NEXT_UShort(p);
- end = OTL_NEXT_UShort(p);
- value = OTL_NEXT_UShort(p); /* ignored */
- if ( start > end || ( n > 0 && start <= last ) )
- OTL_INVALID_DATA;
+ if ( p + num_ranges * 6 > valid->limit )
+ OTL_INVALID_TOO_SHORT;
- last = end;
- }
+ for ( n = 0; n < num_ranges; n++ )
+ {
+ start = OTL_NEXT_UShort( p );
+ end = OTL_NEXT_UShort( p );
+ value = OTL_NEXT_UShort( p ); /* ignored */
+
+ if ( start > end || ( n > 0 && start <= last ) )
+ OTL_INVALID_DATA;
+
+ last = end;
}
- break;
+ }
+ break;
- default:
- OTL_INVALID_FORMAT;
+ default:
+ OTL_INVALID_FORMAT;
}
}
@@ -231,61 +263,66 @@
OTL_UInt glyph_index )
{
OTL_Bytes p = table;
- OTL_UInt format = OTL_NEXT_UShort(p);
+ OTL_UInt format = OTL_NEXT_UShort( p );
+
switch ( format )
{
- case 1:
- {
- OTL_UInt start = OTL_NEXT_UShort(p);
- OTL_UInt count = OTL_NEXT_UShort(p);
- OTL_UInt index = (OTL_UInt)( glyph_index - start );
+ case 1:
+ {
+ OTL_UInt start = OTL_NEXT_UShort( p );
+ OTL_UInt count = OTL_NEXT_UShort( p );
+ OTL_UInt idx = (OTL_UInt)( glyph_index - start );
- if ( index < count )
- {
- p += 2*index;
- return OTL_PEEK_UShort(p);
- }
- }
- break;
- case 2:
+ if ( idx < count )
{
- OTL_UInt count = OTL_NEXT_UShort(p);
- OTL_UInt min = 0, max = count, mid, gindex;
+ p += 2 * idx;
+ return OTL_PEEK_UShort( p );
+ }
+ }
+ break;
- table += 4;
- while ( min < max )
- {
- mid = ( min + max ) >> 1;
- p = table + 6*mid;
- start = OTL_NEXT_UShort(p);
- end = OTL_NEXT_UShort(p);
+ case 2:
+ {
+ OTL_UInt count = OTL_NEXT_UShort( p );
+ OTL_UInt min = 0, max = count, mid, gindex;
- if ( glyph_index < start )
- max = mid;
- else if ( glyph_index > end )
- min = mid+1;
- else
- return OTL_PEEK_UShort(p);
- }
+
+ table += 4;
+ while ( min < max )
+ {
+ mid = ( min + max ) >> 1;
+ p = table + 6 * mid;
+ start = OTL_NEXT_UShort( p );
+ end = OTL_NEXT_UShort( p );
+
+ if ( glyph_index < start )
+ max = mid;
+ else if ( glyph_index > end )
+ min = mid + 1;
+ else
+ return OTL_PEEK_UShort( p );
}
- break;
+ }
+ break;
- default:
- ;
+ default:
+ ;
}
+
return 0;
}
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** DEVICE TABLE *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** DEVICE TABLE *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
OTL_LOCALDEF( void )
otl_device_table_validate( OTL_Bytes table,
OTL_Validator valid )
@@ -293,19 +330,20 @@
OTL_Bytes p = table;
OTL_UInt start, end, count, format, count;
+
if ( p + 8 > valid->limit )
OTL_INVALID_TOO_SHORT;
- start = OTL_NEXT_UShort(p);
- end = OTL_NEXT_UShort(p);
- format = OTL_NEXT_UShort(p);
+ start = OTL_NEXT_UShort( p );
+ end = OTL_NEXT_UShort( p );
+ format = OTL_NEXT_UShort( p );
if ( format < 1 || format > 3 || end < start )
OTL_INVALID_DATA;
- count = (OTL_UInt)( end - start + 1 );
+ count = (OTL_UInt)( end - start + 1 );
- if ( p + ((1 << format)*count)/8> valid->limit )
+ if ( p + ( ( 1 << format ) * count ) / 8 > valid->limit )
OTL_INVALID_TOO_SHORT;
}
@@ -315,7 +353,8 @@
{
OTL_Bytes p = table;
- return OTL_PEEK_UShort(p);
+
+ return OTL_PEEK_UShort( p );
}
@@ -324,74 +363,75 @@
{
OTL_Bytes p = table + 2;
- return OTL_PEEK_UShort(p);
+
+ return OTL_PEEK_UShort( p );
}
OTL_LOCALDEF( OTL_Int )
- otl_device_table_get_delta( OTL_Bytes table,
- OTL_UInt size )
+ otl_device_table_get_delta( OTL_Bytes table,
+ OTL_UInt size )
{
- OTL_Bytes p = table;
- OTL_Int result = 0;
- OTL_UInt start, end, format, index, value;
+ OTL_Bytes p = table;
+ OTL_Int result = 0;
+ OTL_UInt start, end, format, idx, value;
- start = OTL_NEXT_UShort(p);
- end = OTL_NEXT_UShort(p);
- format = OTL_NEXT_UShort(p);
+ start = OTL_NEXT_UShort( p );
+ end = OTL_NEXT_UShort( p );
+ format = OTL_NEXT_UShort( p );
+
if ( size >= start && size <= end )
{
- /* we could do that with clever bit operations, but a switch is simply */
- /* much simpler to understand and maintain !! */
- /* */
+ /* we could do that with clever bit operations, but a switch is */
+ /* much simpler to understand and maintain */
+ /* */
switch ( format )
{
- case 1:
- {
- index = (OTL_UInt)(( size - start )*2);
- p += (index/16);
- value = OTL_PEEK_UShort(p);
- shift = index & 15;
- result = (OTL_Short)(value << shift) >> (14-shift);
- }
- break;
+ case 1:
+ idx = (OTL_UInt)( ( size - start ) * 2 );
+ p += idx / 16;
+ value = OTL_PEEK_UShort( p );
+ shift = idx & 15;
+ result = (OTL_Short)( value << shift ) >> ( 14 - shift );
- case 2:
- {
- index = (OTL_UInt)(( size - start )*4);
- p += (index/16);
- value = OTL_PEEK_UShort(p);
- shift = index & 15;
- result = (OTL_Short)(value << shift) >> (12-shift);
- }
- break;
+ break;
- case 3:
- {
- index = (OTL_UInt)(( size - start )*8);
- p += (index/16);
- value = OTL_PEEK_UShort(p);
- shift = index & 15;
- result = (OTL_Short)(value << shift) >> (8-shift);
- }
- break;
+ case 2:
+ idx = (OTL_UInt)( ( size - start ) * 4 );
+ p += idx / 16;
+ value = OTL_PEEK_UShort( p );
+ shift = idx & 15;
+ result = (OTL_Short)( value << shift ) >> ( 12 - shift );
- default:
- ;
+ break;
+
+ case 3:
+ idx = (OTL_UInt)( ( size - start ) * 8 );
+ p += idx / 16;
+ value = OTL_PEEK_UShort( p );
+ shift = idx & 15;
+ result = (OTL_Short)( value << shift ) >> ( 8 - shift );
+
+ break;
+
+ default:
+ ;
}
}
- return result;
+
+ return result;
}
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** LOOKUP LISTS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** LOOKUP LISTS *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
OTL_LOCALDEF( void )
otl_lookup_validate( OTL_Bytes table,
OTL_Validator valid )
@@ -399,24 +439,25 @@
OTL_Bytes p = table;
OTL_UInt num_tables;
+
if ( table + 6 > valid->limit )
OTL_INVALID_TOO_SHORT;
p += 4;
- num_tables = OTL_NEXT_UShort(p);
+ num_tables = OTL_NEXT_UShort( p );
- if ( p + num_tables*2 > valid->limit )
+ if ( p + num_tables * 2 > valid->limit )
OTL_INVALID_TOO_SHORT;
for ( ; num_tables > 0; num_tables-- )
{
- offset = OTL_NEXT_UShort(p);
+ offset = OTL_NEXT_UShort( p );
if ( table + offset >= valid->limit )
OTL_INVALID_OFFSET;
}
- /* XXX: check sub-tables ?? */
+ /* XXX: check sub-tables? */
}
@@ -425,35 +466,39 @@
{
OTL_Bytes p = table + 4;
- return OTL_PEEK_UShort(p);
+
+ return OTL_PEEK_UShort( p );
}
OTL_LOCALDEF( OTL_Bytes )
otl_lookup_get_table( OTL_Bytes table,
- OTL_UInt index )
+ OTL_UInt idx )
{
OTL_Bytes p, result = NULL;
OTL_UInt count;
+
p = table + 4;
- count = OTL_NEXT_UShort(p);
- if ( index < count )
+ count = OTL_NEXT_UShort( p );
+ if ( idx < count )
{
- p += index*2;
- result = table + OTL_PEEK_UShort(p);
+ p += idx * 2;
+ result = table + OTL_PEEK_UShort( p );
}
- return result;
+
+ return result;
}
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** LOOKUP LISTS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** LOOKUP LISTS *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
OTL_LOCALDEF( void )
otl_lookup_list_validate( OTL_Bytes table,
OTL_Validator valid )
@@ -461,19 +506,19 @@
OTL_Bytes p = table, q;
OTL_UInt num_lookups, offset;
+
if ( p + 2 > valid->limit )
OTL_INVALID_TOO_SHORT;
- num_lookups = OTL_NEXT_UShort(p);
+ num_lookups = OTL_NEXT_UShort( p );
- if ( p + num_lookups*2 > valid->limit )
+ if ( p + num_lookups * 2 > valid->limit )
OTL_INVALID_TOO_SHORT;
for ( ; num_lookups > 0; num_lookups-- )
{
+ offset = OTL_NEXT_UShort( p );
- offset = OTL_NEXT_UShort(p);
-
otl_lookup_validate( table + offset, valid );
}
}
@@ -484,25 +529,28 @@
{
OTL_Bytes p = table;
- return OTL_PEEK_UShort(p);
+
+ return OTL_PEEK_UShort( p );
}
OTL_LOCALDEF( OTL_Bytes )
otl_lookup_list_get_lookup( OTL_Bytes table,
- OTL_UInt index )
+ OTL_UInt idx )
{
OTL_Bytes p, result = 0;
OTL_UInt count;
+
p = table;
- count = OTL_NEXT_UShort(p);
- if ( index < count )
+ count = OTL_NEXT_UShort( p );
+ if ( idx < count )
{
- p += index*2;
- result = table + OTL_PEEK_UShort(p);
+ p += idx * 2;
+ result = table + OTL_PEEK_UShort( p );
}
- return result;
+
+ return result;
}
@@ -513,6 +561,7 @@
{
OTL_Bytes result = NULL;
+
result = otl_lookup_list_get_lookup( table, lookup_index );
if ( result )
result = otl_lookup_get_table( result, table_index );
@@ -527,35 +576,37 @@
OTL_Pointer func_data )
{
OTL_Bytes p = table;
- OTL_UInt count = OTL_NEXT_UShort(p);
+ OTL_UInt count = OTL_NEXT_UShort( p );
+
for ( ; count > 0; count-- )
- func( table + OTL_NEXT_USHORT(p), func_data );
+ func( table + OTL_NEXT_USHORT( p ), func_data );
}
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** FEATURES *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** FEATURES *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
OTL_LOCALDEF( void )
otl_feature_validate( OTL_Bytes table,
OTL_Validator valid )
{
- OTL_Bytes p = table;
- OTL_UInt feat_params, num_lookups;
+ OTL_Bytes p = table;
+ OTL_UInt feat_params, num_lookups;
+
if ( p + 4 > valid->limit )
OTL_INVALID_TOO_SHORT;
- feat_params = OTL_NEXT_UShort(p); /* ignored */
- num_lookups = OTL_NEXT_UShort(p);
+ feat_params = OTL_NEXT_UShort( p ); /* ignored */
+ num_lookups = OTL_NEXT_UShort( p );
- if ( p + num_lookups*2 > valid->limit )
+ if ( p + num_lookups * 2 > valid->limit )
OTL_INVALID_TOO_SHORT;
/* XXX: check lookup indices */
@@ -563,27 +614,29 @@
OTL_LOCALDEF( OTL_UInt )
- otl_feature_get_count( OTL_Bytes table )
+ otl_feature_get_count( OTL_Bytes table )
{
OTL_Bytes p = table + 4;
- return OTL_PEEK_UShort(p);
+
+ return OTL_PEEK_UShort( p );
}
OTL_LOCALDEF( OTL_UInt )
- otl_feature_get_lookups( OTL_Bytes table,
- OTL_UInt start,
- OTL_UInt count,
- OTL_UInt *lookups )
+ otl_feature_get_lookups( OTL_Bytes table,
+ OTL_UInt start,
+ OTL_UInt count,
+ OTL_UInt *lookups )
{
OTL_Bytes p;
OTL_UInt num_features, result = 0;
+
p = table + 4;
- num_features = OTL_NEXT_UShort(p);
+ num_features = OTL_NEXT_UShort( p );
- p += start*2;
+ p += start * 2;
for ( ; count > 0 && start < num_features; count--, start++ )
{
@@ -596,15 +649,14 @@
}
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** FEATURE LIST *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** FEATURE LIST *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
OTL_LOCALDEF( void )
otl_feature_list_validate( OTL_Bytes table,
OTL_Validator valid )
@@ -612,18 +664,19 @@
OTL_Bytes p = table;
OTL_UInt num_features, offset;
+
if ( table + 2 > valid->limit )
OTL_INVALID_TOO_SHORT;
- num_features = OTL_NEXT_UShort(p);
+ num_features = OTL_NEXT_UShort( p );
- if ( p + num_features*2 > valid->limit )
+ if ( p + num_features * 2 > valid->limit )
OTL_INVALID_TOO_SHORT;
for ( ; num_features > 0; num_features-- )
{
- p += 4; /* skip tag */
- offset = OTL_NEXT_UShort(p);
+ p += 4; /* skip tag */
+ offset = OTL_NEXT_UShort( p );
otl_feature_table_validate( table + offset, valid );
}
@@ -635,26 +688,29 @@
{
OTL_Bytes p = table;
- return OTL_PEEK_UShort(p);
+
+ return OTL_PEEK_UShort( p );
}
OTL_LOCALDEF( OTL_Bytes )
otl_feature_list_get_feature( OTL_Bytes table,
- OTL_UInt index )
+ OTL_UInt idx )
{
OTL_Bytes p, result = NULL;
OTL_UInt count;
+
p = table;
- count = OTL_NEXT_UShort(p);
+ count = OTL_NEXT_UShort( p );
- if ( index < count )
+ if ( idx < count )
{
- p += index*2;
- result = table + OTL_PEEK_UShort(p);
+ p += idx * 2;
+ result = table + OTL_PEEK_UShort( p );
}
- return result;
+
+ return result;
}
@@ -663,25 +719,27 @@
OTL_ForeachFunc func,
OTL_Pointer func_data )
{
- OTL_Bytes p;
- OTL_UInt count;
+ OTL_Bytes p;
+ OTL_UInt count;
+
p = table;
- count = OTL_NEXT_UShort(p);
+ count = OTL_NEXT_UShort( p );
for ( ; count > 0; count-- )
- func( table + OTL_NEXT_UShort(p), func_data );
+ func( table + OTL_NEXT_UShort( p ), func_data );
}
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** LANGUAGE SYSTEM *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
OTL_LOCALDEF( void )
otl_lang_validate( OTL_Bytes table,
OTL_Validator valid )
@@ -691,19 +749,20 @@
OTL_UInt req_feature;
OTL_UInt num_features;
+
if ( table + 6 >= valid->limit )
OTL_INVALID_TOO_SHORT;
- lookup_order = OTL_NEXT_UShort(p);
- req_feature = OTL_NEXT_UShort(p);
- num_features = OTL_NEXT_UShort(p);
+ lookup_order = OTL_NEXT_UShort( p );
+ req_feature = OTL_NEXT_UShort( p );
+ num_features = OTL_NEXT_UShort( p );
/* XXX: check req_feature if not 0xFFFFU */
- if ( p + 2*num_features >= valid->limit )
+ if ( p + 2 * num_features >= valid->limit )
OTL_INVALID_TOO_SHORT;
- /* XXX: check features indices !! */
+ /* XXX: check features indices! */
}
@@ -710,9 +769,10 @@
OTL_LOCALDEF( OTL_UInt )
otl_lang_get_count( OTL_Bytes table )
{
- OTL_Bytes p = table + 4;
+ OTL_Bytes p = table + 4;
- return OTL_PEEK_UShort(p);
+
+ return OTL_PEEK_UShort( p );
}
@@ -722,41 +782,43 @@
OTL_UInt count,
OTL_UInt *features )
{
- OTL_Bytes p = table + 4;
- OTL_UInt num_features = OTL_NEXT_UShort(p);
- OTL_UInt result = 0;
+ OTL_Bytes p = table + 4;
+ OTL_UInt num_features = OTL_NEXT_UShort( p );
+ OTL_UInt result = 0;
- p += start*2;
+ p += start * 2;
+
for ( ; count > 0 && start < num_features; start++, count-- )
{
- features[0] = OTL_NEXT_UShort(p);
+ features[0] = OTL_NEXT_UShort( p );
features++;
result++;
}
- return result;
+
+ return result;
}
OTL_LOCALDEF( OTL_UInt )
- otl_lang_get_req_feature( OTL_Bytes table )
+ otl_lang_get_req_feature( OTL_Bytes table )
{
OTL_Bytes p = table + 2;
- return OTL_PEEK_UShort(p);
+
+ return OTL_PEEK_UShort( p );
}
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** SCRIPTS *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
OTL_LOCALDEF( void )
otl_script_table_validate( OTL_Bytes table,
OTL_Validator valid )
@@ -764,11 +826,12 @@
OTL_UInt default_lang;
OTL_Bytes p = table;
+
if ( table + 4 > valid->limit )
OTL_INVALID_TOO_SHORT;
- default_lang = OTL_NEXT_UShort(p);
- num_langs = OTL_NEXT_UShort(p);
+ default_lang = OTL_NEXT_UShort( p );
+ num_langs = OTL_NEXT_UShort( p );
if ( default_lang != 0 )
{
@@ -776,7 +839,7 @@
OTL_INVALID_OFFSET;
}
- if ( p + num_langs*6 >= valid->limit )
+ if ( p + num_langs * 6 >= valid->limit )
OTL_INVALID_OFFSET;
for ( ; num_langs > 0; num_langs-- )
@@ -783,8 +846,9 @@
{
OTL_UInt offset;
+
p += 4; /* skip tag */
- offset = OTL_NEXT_UShort(p);
+ offset = OTL_NEXT_UShort( p );
otl_lang_validate( table + offset, valid );
}
@@ -795,15 +859,16 @@
otl_script_list_validate( OTL_Bytes list,
OTL_Validator valid )
{
- OTL_UInt num_scripts;
- OTL_Bytes p = list;
+ OTL_UInt num_scripts;
+ OTL_Bytes p = list;
+
if ( list + 2 > valid->limit )
OTL_INVALID_TOO_SHORT;
- num_scripts = OTL_NEXT_UShort(p);
+ num_scripts = OTL_NEXT_UShort( p );
- if ( p + num_scripts*6 > valid->limit )
+ if ( p + num_scripts * 6 > valid->limit )
OTL_INVALID_TOO_SHORT;
for ( ; num_scripts > 0; num_scripts-- )
@@ -810,11 +875,13 @@
{
OTL_UInt offset;
- p += 4; /* skip tag */
- offset = OTL_NEXT_UShort(p);
+ p += 4; /* skip tag */
+ offset = OTL_NEXT_UShort( p );
+
otl_script_table_validate( list + offset, valid );
}
}
+/* END */
--- a/src/otlayout/otlcommn.h
+++ b/src/otlayout/otlcommn.h
@@ -1,205 +1,208 @@
-/***************************************************************************
- *
- * otlcommn.h
- *
- * OpenType Layout common tables processing
- *
- * this header provides several routines used to process common table
- * found in various OpenType Layout tables..
- */
-#ifndef __OTLAYOUT_COMMON_H__
-#define __OTLAYOUT_COMMON_H__
+/***************************************************************************/
+/* */
+/* otlcommn.h */
+/* */
+/* OpenType layout support, common tables (specification). */
+/* */
+/* Copyright 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+#ifndef __OTLCOMMN_H__
+#define __OTLCOMMN_H__
+
#include "otlayout.h"
OTL_BEGIN_HEADER
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** COVERAGE TABLE *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** COVERAGE TABLE *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
- /* validate coverage table */
+ /* validate coverage table */
OTL_LOCALDEF( void )
otl_coverage_validate( OTL_Bytes base,
OTL_Validator valid );
- /* return number of covered glyphs */
+ /* return number of covered glyphs */
OTL_LOCALDEF( OTL_UInt )
- otl_coverage_get_count( OTL_Bytes base );
+ otl_coverage_get_count( OTL_Bytes base );
-
- /* return the coverage index corresponding to a glyph glyph index. */
- /* returns -1 if the glyph isn't covered.. */
+ /* Return the coverage index corresponding to a glyph glyph index. */
+ /* Return -1 if the glyph isn't covered. */
OTL_LOCALDEF( OTL_Int )
- otl_coverage_get_index( OTL_Bytes base,
- OTL_UInt glyph_index );
+ otl_coverage_get_index( OTL_Bytes base,
+ OTL_UInt glyph_index );
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** CLASS DEFINITION TABLE *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** CLASS DEFINITION TABLE *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* validate class definition table */
+ /* validate class definition table */
OTL_LOCALDEF( void )
otl_class_definition_validate( OTL_Bytes table,
OTL_Validator valid );
- /* return class value for a given glyph index */
+ /* return class value for a given glyph index */
OTL_LOCALDEF( OTL_UInt )
otl_class_definition_get_value( OTL_Bytes table,
OTL_UInt glyph_index );
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** DEVICE TABLE *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** DEVICE TABLE *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* validate a device table */
+ /* validate a device table */
OTL_LOCALDEF( void )
otl_device_table_validate( OTL_Bytes table,
OTL_Validator valid );
-
- /* return a device table's first size */
+ /* return a device table's first size */
OTL_LOCALDEF( OTL_UInt )
otl_device_table_get_start( OTL_Bytes table );
-
- /* return a device table's last size */
+ /* return a device table's last size */
OTL_LOCALDEF( OTL_UInt )
otl_device_table_get_end( OTL_Bytes table );
-
- /* return pixel adjustment for a given size */
+ /* return pixel adjustment for a given size */
OTL_LOCALDEF( OTL_Int )
- otl_device_table_get_delta( OTL_Bytes table,
- OTL_UInt size );
+ otl_device_table_get_delta( OTL_Bytes table,
+ OTL_UInt size );
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** LOOKUPS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** LOOKUPS *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
- /* validate lookup table */
+ /* validate lookup table */
OTL_LOCALDEF( void )
otl_lookup_validate( OTL_Bytes table,
OTL_Validator valid );
- /* return number of sub-tables in a lookup */
+ /* return number of sub-tables in a lookup */
OTL_LOCALDEF( OTL_UInt )
otl_lookup_get_count( OTL_Bytes table );
- /* return lookup sub-table */
+ /* return lookup sub-table */
OTL_LOCALDEF( OTL_Bytes )
otl_lookup_get_table( OTL_Bytes table,
- OTL_UInt index );
+ OTL_UInt idx );
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** LOOKUP LISTS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** LOOKUP LISTS *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
- /* validate lookup list */
+ /* validate lookup list */
OTL_LOCALDEF( void )
otl_lookup_list_validate( OTL_Bytes table,
OTL_Validator valid );
- /* return number of lookups in list */
+ /* return number of lookups in list */
OTL_LOCALDEF( OTL_UInt )
otl_lookup_list_get_count( OTL_Bytes table );
-
- /* return a given lookup from a list */
+ /* return a given lookup from a list */
OTL_LOCALDEF( OTL_Bytes )
otl_lookup_list_get_lookup( OTL_Bytes table,
- OTL_UInt index );
+ OTL_UInt idx );
-
- /* return lookup sub-table from a list */
+ /* return lookup sub-table from a list */
OTL_LOCALDEF( OTL_Bytes )
otl_lookup_list_get_table( OTL_Bytes table,
OTL_UInt lookup_index,
OTL_UInt table_index );
- /* iterate over lookup list */
+ /* iterate over lookup list */
OTL_LOCALDEF( void )
otl_lookup_list_foreach( OTL_Bytes table,
OTL_ForeachFunc func,
OTL_Pointer func_data );
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** FEATURES *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
- /* validate feature table */
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** FEATURES *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /* validate feature table */
OTL_LOCALDEF( void )
otl_feature_validate( OTL_Bytes table,
OTL_Validator valid );
- /* return feature's lookup count */
+ /* return feature's lookup count */
OTL_LOCALDEF( OTL_UInt )
- otl_feature_get_count( OTL_Bytes table );
+ otl_feature_get_count( OTL_Bytes table );
- /* get several lookups indices from a feature. returns the number of lookups */
- /* grabbed */
+ /* get several lookups indices from a feature. returns the number of */
+ /* lookups grabbed */
OTL_LOCALDEF( OTL_UInt )
- otl_feature_get_lookups( OTL_Bytes table,
- OTL_UInt start,
- OTL_UInt count,
- OTL_UInt *lookups );
+ otl_feature_get_lookups( OTL_Bytes table,
+ OTL_UInt start,
+ OTL_UInt count,
+ OTL_UInt *lookups );
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** FEATURE LIST *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
- /* validate a feature list */
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** FEATURE LIST *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /* validate a feature list */
OTL_LOCALDEF( void )
otl_feature_list_validate( OTL_Bytes table,
OTL_Validator valid );
- /* return number of features in list */
+ /* return number of features in list */
OTL_LOCALDEF( OTL_UInt )
otl_feature_list_get_count( OTL_Bytes table );
- /* return a given feature from a list */
+ /* return a given feature from a list */
OTL_LOCALDEF( OTL_Bytes )
otl_feature_list_get_feature( OTL_Bytes table,
- OTL_UInt index );
+ OTL_UInt idx );
- /* iterate over all features in a list */
+ /* iterate over all features in a list */
OTL_LOCALDEF( void )
otl_feature_list_foreach( OTL_Bytes table,
OTL_ForeachFunc func,
@@ -209,4 +212,7 @@
OTL_END_HEADER
-#endif /* __OTLAYOUT_COMMON_H__ */
+#endif /* __OTLCOMMN_H__ */
+
+
+/* END */
--- a/src/pcf/descrip.mms
+++ b/src/pcf/descrip.mms
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2001 by
+# Copyright (C) 2001, 2002 by
# Francesco Zappa Nardelli
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
--- a/src/pcf/pcf.h
+++ b/src/pcf/pcf.h
@@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
- Copyright (C) 2000-2001 by
+ Copyright (C) 2000-2001, 2002 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
--- a/src/pcf/pcfdriver.c
+++ b/src/pcf/pcfdriver.c
@@ -2,7 +2,7 @@
FreeType font driver for pcf files
- Copyright (C) 2000-2001 by
+ Copyright (C) 2000-2001, 2002 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -40,9 +40,10 @@
#undef FT_COMPONENT
#define FT_COMPONENT trace_pcfread
+
#ifdef FT_CONFIG_OPTION_USE_CMAPS
- typedef struct PCF_CMapRec_
+ typedef struct PCF_CMapRec_
{
FT_CMapRec cmap;
FT_UInt num_encodings;
@@ -52,11 +53,12 @@
FT_CALLBACK_DEF( FT_Error )
- pcf_cmap_init( PCF_CMap cmap )
+ pcf_cmap_init( PCF_CMap cmap )
{
- PCF_Face face = (PCF_Face) FT_CMAP_FACE(cmap);
+ PCF_Face face = (PCF_Face)FT_CMAP_FACE( cmap );
- cmap->num_encodings = (FT_UInt) face->nencodings;
+
+ cmap->num_encodings = (FT_UInt)face->nencodings;
cmap->encodings = face->encodings;
return FT_Err_Ok;
@@ -79,6 +81,7 @@
FT_UInt min, max, mid;
FT_UInt result = 0;
+
min = 0;
max = cmap->num_encodings;
@@ -86,6 +89,7 @@
{
FT_UInt32 code;
+
mid = ( min + max ) >> 1;
code = encodings[mid].enc;
@@ -98,7 +102,7 @@
if ( charcode < code )
max = mid;
else
- min = mid+1;
+ min = mid + 1;
}
return result;
@@ -114,6 +118,7 @@
FT_UInt32 charcode = *acharcode + 1;
FT_UInt result = 0;
+
min = 0;
max = cmap->num_encodings;
@@ -121,6 +126,7 @@
{
FT_UInt32 code;
+
mid = ( min + max ) >> 1;
code = encodings[mid].enc;
@@ -133,7 +139,7 @@
if ( charcode < code )
max = mid;
else
- min = mid+1;
+ min = mid + 1;
}
charcode = 0;
@@ -152,10 +158,10 @@
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec pcf_cmap_class =
{
sizeof( PCF_CMapRec ),
- (FT_CMap_InitFunc) pcf_cmap_init,
- (FT_CMap_DoneFunc) pcf_cmap_done,
- (FT_CMap_CharIndexFunc) pcf_cmap_char_index,
- (FT_CMap_CharNextFunc) pcf_cmap_char_next
+ (FT_CMap_InitFunc) pcf_cmap_init,
+ (FT_CMap_DoneFunc) pcf_cmap_done,
+ (FT_CMap_CharIndexFunc)pcf_cmap_char_index,
+ (FT_CMap_CharNextFunc) pcf_cmap_char_next
};
#else /* !FT_CONFIG_OPTION_USE_CMAPS */
@@ -243,7 +249,7 @@
FT_CALLBACK_DEF( FT_Error )
PCF_Face_Done( PCF_Face face )
{
- FT_Memory memory = FT_FACE_MEMORY( face );
+ FT_Memory memory = FT_FACE_MEMORY( face );
FT_FREE( face->encodings );
@@ -251,9 +257,10 @@
/* free properties */
{
- PCF_Property prop = face->properties;
- FT_Int i;
+ PCF_Property prop = face->properties;
+ FT_Int i;
+
for ( i = 0; i < face->nprops; i++ )
{
prop = &face->properties[i];
@@ -298,8 +305,8 @@
/* set-up charmap */
{
- FT_String *charset_registry, *charset_encoding;
- FT_Bool unicode_charmap = 0;
+ FT_String *charset_registry, *charset_encoding;
+ FT_Bool unicode_charmap = 0;
charset_registry = face->charset_registry;
@@ -315,10 +322,12 @@
}
#ifdef FT_CONFIG_OPTION_USE_CMAPS
+
{
FT_CharMapRec charmap;
- charmap.face = FT_FACE(face);
+
+ charmap.face = FT_FACE( face );
charmap.encoding = ft_encoding_none;
charmap.platform_id = 0;
charmap.encoding_id = 0;
@@ -332,6 +341,7 @@
error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL );
}
+
#else /* !FT_CONFIG_OPTION_USE_CMAPS */
/* XXX: charmaps. For now, report unicode for Unicode and Latin 1 */
@@ -378,13 +388,13 @@
if ( size->metrics.y_ppem == face->root.available_sizes->height )
{
- size->metrics.ascender = face->accel.fontAscent << 6;
- size->metrics.descender = face->accel.fontDescent * (-64);
+ size->metrics.ascender = face->accel.fontAscent << 6;
+ size->metrics.descender = face->accel.fontDescent * (-64);
#if 0
- size->metrics.height = face->accel.maxbounds.ascent << 6;
+ size->metrics.height = face->accel.maxbounds.ascent << 6;
#endif
- size->metrics.height = size->metrics.ascender -
- size->metrics.descender;
+ size->metrics.height = size->metrics.ascender -
+ size->metrics.descender;
size->metrics.max_advance = face->accel.maxbounds.characterWidth << 6;
@@ -407,12 +417,11 @@
PCF_Face face = (PCF_Face)FT_SIZE_FACE( size );
FT_Stream stream = face->root.stream;
FT_Error error = PCF_Err_Ok;
- FT_Memory memory = FT_FACE(face)->memory;
+ FT_Memory memory = FT_FACE( face )->memory;
FT_Bitmap* bitmap = &slot->bitmap;
PCF_Metric metric;
int bytes;
-
FT_UNUSED( load_flags );
@@ -464,7 +473,7 @@
if ( FT_ALLOC( bitmap->buffer, bytes ) )
goto Exit;
- if ( FT_STREAM_SEEK( metric->bits ) ||
+ if ( FT_STREAM_SEEK( metric->bits ) ||
FT_STREAM_READ( bitmap->buffer, bytes ) )
goto Exit;
@@ -531,38 +540,37 @@
sizeof( FT_SizeRec ),
sizeof( FT_GlyphSlotRec ),
- (FT_Face_InitFunc) PCF_Face_Init,
- (FT_Face_DoneFunc) PCF_Face_Done,
- (FT_Size_InitFunc) 0,
- (FT_Size_DoneFunc) 0,
- (FT_Slot_InitFunc)0,
- (FT_Slot_DoneFunc)0,
+ (FT_Face_InitFunc) PCF_Face_Init,
+ (FT_Face_DoneFunc) PCF_Face_Done,
+ (FT_Size_InitFunc) 0,
+ (FT_Size_DoneFunc) 0,
+ (FT_Slot_InitFunc) 0,
+ (FT_Slot_DoneFunc) 0,
- (FT_Size_ResetPointsFunc) PCF_Set_Pixel_Size,
- (FT_Size_ResetPixelsFunc) PCF_Set_Pixel_Size,
+ (FT_Size_ResetPointsFunc) PCF_Set_Pixel_Size,
+ (FT_Size_ResetPixelsFunc) PCF_Set_Pixel_Size,
- (FT_Slot_LoadFunc) PCF_Glyph_Load,
+ (FT_Slot_LoadFunc) PCF_Glyph_Load,
#ifndef FT_CONFIG_OPTION_USE_CMAPS
- (FT_CharMap_CharIndexFunc) PCF_Char_Get_Index,
+ (FT_CharMap_CharIndexFunc)PCF_Char_Get_Index,
#else
- (FT_CharMap_CharIndexFunc) 0,
+ (FT_CharMap_CharIndexFunc)0,
#endif
- (FT_Face_GetKerningFunc) 0,
- (FT_Face_AttachFunc) 0,
- (FT_Face_GetAdvancesFunc) 0,
+ (FT_Face_GetKerningFunc) 0,
+ (FT_Face_AttachFunc) 0,
+ (FT_Face_GetAdvancesFunc) 0,
#ifndef FT_CONFIG_OPTION_USE_CMAPS
- (FT_CharMap_CharNextFunc) PCF_Char_Get_Next,
+ (FT_CharMap_CharNextFunc) PCF_Char_Get_Next,
#else
- (FT_CharMap_CharNextFunc) 0
+ (FT_CharMap_CharNextFunc) 0
#endif
};
#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS
-
/*************************************************************************/
/* */
--- a/src/pcf/pcfdriver.h
+++ b/src/pcf/pcfdriver.h
@@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
- Copyright 2000-2001 by
+ Copyright 2000-2001, 2002 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
- Copyright 2000-2001 by
+ Copyright 2000-2001, 2002 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -98,7 +98,7 @@
FT_UInt n;
- if ( FT_STREAM_SEEK ( 0 ) ||
+ if ( FT_STREAM_SEEK ( 0 ) ||
FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) )
return PCF_Err_Cannot_Open_Resource;
@@ -130,7 +130,7 @@
for( j = 0; j < sizeof ( tableNames ) / sizeof ( tableNames[0] ); j++ )
if ( tables[i].type == (FT_UInt)( 1 << j ) )
name = tableNames[j];
-
+
FT_TRACE4(( "Table %d: type=%-6s format=0x%04lX "
"size=0x%06lX (%8ld) offset=0x%04lX\n",
i, name,
@@ -200,8 +200,6 @@
};
-
-
static FT_Error
pcf_get_metric( FT_Stream stream,
FT_ULong format,
@@ -212,15 +210,16 @@
if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
{
- const FT_Frame_Field* fields;
-
+ const FT_Frame_Field* fields;
+
+
/* parsing normal metrics */
fields = PCF_BYTE_ORDER( format ) == MSBFirst
- ? pcf_metric_msb_header
- : pcf_metric_header;
+ ? pcf_metric_msb_header
+ : pcf_metric_header;
- /* the following sets 'error' but doesn't return in case of failure */
- (void) FT_STREAM_READ_FIELDS( fields, metric );
+ /* the following sets 'error' but doesn't return in case of failure */
+ (void)FT_STREAM_READ_FIELDS( fields, metric );
}
else
{
@@ -267,7 +266,7 @@
*asize = tables[i].size; /* unused - to be removed */
*aformat = tables[i].format;
-
+
return PCF_Err_Ok;
}
@@ -491,7 +490,7 @@
error = FT_READ_ULONG_LE( format );
- if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) &&
+ if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) &&
!PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) )
return PCF_Err_Invalid_File_Format;
@@ -650,11 +649,11 @@
error = pcf_seek_to_table_type( stream,
- face->toc.tables,
- face->toc.count,
- PCF_BDF_ENCODINGS,
- &format,
- &size );
+ face->toc.tables,
+ face->toc.count,
+ PCF_BDF_ENCODINGS,
+ &format,
+ &size );
if ( error )
return error;
@@ -809,7 +808,7 @@
error = FT_READ_ULONG_LE( format );
- if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) &&
+ if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) &&
!PCF_FORMAT_MATCH( format, PCF_ACCEL_W_INKBOUNDS ) )
goto Bail;
@@ -973,12 +972,12 @@
prop = pcf_find_property( face, "PIXEL_SIZE" );
if ( prop != NULL )
{
- root->available_sizes->height =
+ root->available_sizes->height =
root->available_sizes->width = (FT_Short)( prop->value.integer );
size_set = 1;
}
- else
+ else
{
prop = pcf_find_property( face, "POINT_SIZE" );
if ( prop != NULL )
@@ -993,13 +992,13 @@
if ( ( yres != NULL ) && ( xres != NULL ) )
{
root->available_sizes->height =
- (FT_Short)( prop->value.integer *
- yres->value.integer / 720 );
+ (FT_Short)( prop->value.integer *
+ yres->value.integer / 720 );
root->available_sizes->width =
- (FT_Short)( prop->value.integer *
+ (FT_Short)( prop->value.integer *
xres->value.integer / 720 );
-
+
size_set = 1;
}
}
@@ -1014,11 +1013,11 @@
/* set-up charset */
{
PCF_Property charset_registry = 0, charset_encoding = 0;
-
-
+
+
charset_registry = pcf_find_property( face, "CHARSET_REGISTRY" );
charset_encoding = pcf_find_property( face, "CHARSET_ENCODING" );
-
+
if ( ( charset_registry != NULL ) &&
( charset_encoding != NULL ) )
{
@@ -1028,11 +1027,11 @@
if ( FT_NEW_ARRAY( face->charset_encoding,
strlen( charset_encoding->value.atom ) + 1 ) )
goto Exit;
-
+
if ( FT_NEW_ARRAY( face->charset_registry,
strlen( charset_registry->value.atom ) + 1 ) )
goto Exit;
-
+
strcpy( face->charset_registry, charset_registry->value.atom );
strcpy( face->charset_encoding, charset_encoding->value.atom );
}
@@ -1039,15 +1038,15 @@
}
}
}
-
+
Exit:
- if (error)
+ if ( error )
{
/* this is done to respect the behaviour of the original */
- /* PCF font driver.. */
+ /* PCF font driver. */
error = PCF_Err_Invalid_File_Format;
}
-
+
return error;
}
--- a/src/pcf/rules.mk
+++ b/src/pcf/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2000 by
+# Copyright (C) 2000, 2001 by
# Francesco Zappa Nardelli
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -436,7 +436,7 @@
Fail_Memory:
- TT_Done_Size( size );
+ TT_Size_Done( size );
return error;
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */