* src/bdf/bdflib.c (hash_bucket, hash_lookup): Use `const' for first

argument.
(bdf_get_font_property): Use `const' for third argument.
Updated all callers.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Set pixel width and height
similar to the PCF driver.
* src/bdf/bdf.h (_hashnode): Use `const' for `key'.
Updated.

* src/gzip/ftgzip.c: C++ doesn't like that the array `inflate_mask'
is declared twice.  It is perhaps better to modify the zlip source
files directly instead of this hack.
(zcalloc, zfree, ft_gzip_stream_close, ft_gzip_stream_io): Add casts
to make build with g++ successful.
This commit is contained in:
Werner Lemberg 2003-04-25 05:35:04 +00:00
parent 2dd1e657ba
commit 428c2e4f62
13 changed files with 96 additions and 56 deletions

View File

@ -1,9 +1,32 @@
2003-04-25 Werner Lemberg <wl@gnu.org>
* src/bdf/bdflib.c (hash_bucket, hash_lookup): Use `const' for first
argument.
(bdf_get_font_property): Use `const' for third argument.
Updated all callers.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Set pixel width and height
similar to the PCF driver.
* src/bdf/bdf.h (_hashnode): Use `const' for `key'.
Updated.
* src/gzip/ftgzip.c: C++ doesn't like that the array `inflate_mask'
is declared twice. It is perhaps better to modify the zlip source
files directly instead of this hack.
(zcalloc, zfree, ft_gzip_stream_close, ft_gzip_stream_io): Add casts
to make build with g++ successful.
2003-04-24 Manish Singh <yosh@gimp.org>
* src/cid/cidobjs.c (cid_face_init), src/type1/t1objs.c
(T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Split on `-'
also for searching the style name.
2003-04-24 David Turner <david@freetype.org>
* src/pcf/pcfread.c (pcf_load_font): fixed the computation of
face->num_glyphs, this required increase the value by 1 to respect
the convention that gindex 0 always corresponds to the "missing
glyph".
* src/pcf/pcfread.c (pcf_load_font): fixed the computation of
face->num_glyphs, this required increase the value by 1 to respect
the convention that gindex 0 always corresponds to the "missing
glyph".
2003-04-24 Werner Lemberg <wl@gnu.org>

View File

@ -1426,8 +1426,8 @@
if ( char_height < 1 * 64 )
char_height = 1 * 64;
/* Compute pixel sizes in 26.6 units. we use rounding
*/
/* Compute pixel sizes in 26.6 units. we use rounding
*/
dim_x = ( ( char_width * horz_resolution + (36+32*72) ) / 72 ) & -64;
dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & -64;

View File

@ -1,6 +1,6 @@
/*
* Copyright 2000 Computing Research Labs, New Mexico State University
* Copyright 2001, 2002 Francesco Zappa Nardelli
* Copyright 2001, 2002, 2003 Francesco Zappa Nardelli
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -159,8 +159,8 @@ FT_BEGIN_HEADER
typedef struct _hashnode_
{
char* key;
void* data;
const char* key;
void* data;
} _hashnode, *hashnode;
@ -283,7 +283,7 @@ FT_BEGIN_HEADER
FT_LOCAL( bdf_property_t * )
bdf_get_font_property( bdf_font_t* font,
char* name );
const char* name );
FT_END_HEADER

View File

@ -169,8 +169,6 @@ THE SOFTWARE.
};
FT_CALLBACK_DEF( FT_Error )
BDF_Face_Done( BDF_Face face )
{
@ -250,7 +248,7 @@ THE SOFTWARE.
FT_FACE_FLAG_HORIZONTAL |
FT_FACE_FLAG_FAST_GLYPHS;
prop = bdf_get_font_property( font, (char *)"SPACING" );
prop = bdf_get_font_property( font, "SPACING" );
if ( prop != NULL )
if ( prop->format == BDF_ATOM )
if ( prop->value.atom != NULL )
@ -262,7 +260,7 @@ THE SOFTWARE.
/* FZ XXX: I need a font to implement this */
root->style_flags = 0;
prop = bdf_get_font_property( font, (char *)"SLANT" );
prop = bdf_get_font_property( font, "SLANT" );
if ( prop != NULL )
if ( prop->format == BDF_ATOM )
if ( prop->value.atom != NULL )
@ -270,14 +268,14 @@ THE SOFTWARE.
( *(prop->value.atom) == 'I' ) )
root->style_flags |= FT_STYLE_FLAG_ITALIC;
prop = bdf_get_font_property( font, (char *)"WEIGHT_NAME" );
prop = bdf_get_font_property( font, "WEIGHT_NAME" );
if ( prop != NULL )
if ( prop->format == BDF_ATOM )
if ( prop->value.atom != NULL )
if ( *(prop->value.atom) == 'B' )
root->style_flags |= FT_STYLE_FLAG_BOLD;
prop = bdf_get_font_property( font, (char *)"FAMILY_NAME" );
prop = bdf_get_font_property( font, "FAMILY_NAME" );
if ( ( prop != NULL ) && ( prop->value.atom != NULL ) )
{
int l = ft_strlen( prop->value.atom ) + 1;
@ -307,22 +305,24 @@ THE SOFTWARE.
if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
goto Exit;
prop = bdf_get_font_property( font, (char *)"AVERAGE_WIDTH" );
prop = bdf_get_font_property( font, "AVERAGE_WIDTH" );
if ( ( prop != NULL ) && ( prop->value.int32 >= 10 ) )
root->available_sizes->width = (short)( prop->value.int32 / 10 );
prop = bdf_get_font_property( font, (char *)"PIXEL_SIZE" );
if ( prop != NULL )
root->available_sizes->height = (short) prop->value.int32;
prop = bdf_get_font_property( font, "PIXEL_SIZE" );
if ( prop != NULL ) {
root->available_sizes->height =
root->available_sizes->width = (short) prop->value.int32;
}
else
{
prop = bdf_get_font_property( font, (char *)"POINT_SIZE" );
prop = bdf_get_font_property( font, "POINT_SIZE" );
if ( prop != NULL )
{
bdf_property_t *yres;
yres = bdf_get_font_property( font, (char *)"RESOLUTION_Y" );
yres = bdf_get_font_property( font, "RESOLUTION_Y" );
if ( yres != NULL )
{
FT_TRACE4(( "POINT_SIZE: %d RESOLUTION_Y: %d\n",
@ -371,9 +371,9 @@ THE SOFTWARE.
charset_registry =
bdf_get_font_property( font, (char *)"CHARSET_REGISTRY" );
bdf_get_font_property( font, "CHARSET_REGISTRY" );
charset_encoding =
bdf_get_font_property( font, (char *)"CHARSET_ENCODING" );
bdf_get_font_property( font, "CHARSET_ENCODING" );
if ( ( charset_registry != NULL ) && ( charset_encoding != NULL ) )
{
if ( ( charset_registry->format == BDF_ATOM ) &&
@ -640,7 +640,7 @@ THE SOFTWARE.
FT_ASSERT( face && face->bdffont );
prop = bdf_get_font_property( face->bdffont, (char*)prop_name );
prop = bdf_get_font_property( face->bdffont, prop_name );
if ( prop != NULL )
{
switch ( prop->format )

View File

@ -183,10 +183,10 @@
(*hash_free_func)( hashnode node );
static hashnode*
hash_bucket( char* key,
hashtable* ht )
hash_bucket( const char* key,
hashtable* ht )
{
char* kp = key;
const char* kp = key;
unsigned long res = 0;
hashnode* bp = ht->table, *ndp;
@ -317,7 +317,7 @@
static hashnode
hash_lookup( char* key,
hash_lookup( const char* key,
hashtable* ht )
{
hashnode *np = hash_bucket( key, ht );
@ -1882,7 +1882,7 @@
/* */
/* This is *always* done regardless of the options, because X11 */
/* requires these two fields to compile fonts. */
if ( bdf_get_font_property( p->font, (char *)"FONT_ASCENT" ) == 0 )
if ( bdf_get_font_property( p->font, "FONT_ASCENT" ) == 0 )
{
p->font->font_ascent = p->font->bbx.ascent;
ft_sprintf( nbuf, "%hd", p->font->bbx.ascent );
@ -1894,7 +1894,7 @@
p->font->modified = 1;
}
if ( bdf_get_font_property( p->font, (char *)"FONT_DESCENT" ) == 0 )
if ( bdf_get_font_property( p->font, "FONT_DESCENT" ) == 0 )
{
p->font->font_descent = p->font->bbx.descent;
ft_sprintf( nbuf, "%hd", p->font->bbx.descent );
@ -2418,7 +2418,7 @@
FT_LOCAL_DEF( bdf_property_t * )
bdf_get_font_property( bdf_font_t* font,
char* name )
const char* name )
{
hashnode hn;

View File

@ -2374,8 +2374,8 @@
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 );

View File

@ -166,8 +166,8 @@
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 );

View File

@ -4,7 +4,7 @@
/* */
/* CID 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, */
@ -361,8 +361,10 @@
full++;
}
root->style_name = ( *full == ' ' ) ? full + 1
: (char *)"Regular";
if ( *full == ' ' || *full == '-' )
root->style_name = full + 1;
else
root->style_name = (char *)"Regular";
}
else
{

View File

@ -48,12 +48,23 @@
#include "zlib.h"
#undef SLOW
#define SLOW 1 /* we can't use asm-optimized sources here !! */
#define SLOW 1 /* we can't use asm-optimized sources here! */
/* Urgh. `inflate_mask' must not be declared twice -- C++ doesn't like
this. We temporarily rename it and load all necessary header files. */
#define inflate_mask ft_gzip_dummy
#include "zutil.h"
#include "inftrees.h"
#include "infblock.h"
#include "infcodes.h"
#include "infutil.h"
#undef inflate_mask
/* infutil.c must be included before infcodes.c */
#include "zutil.c"
#include "inftrees.c"
#include "infcodes.c"
#include "infutil.c"
#include "infcodes.c"
#include "infblock.c"
#include "inflate.c"
#include "adler32.c"
@ -102,14 +113,14 @@
unsigned items,
unsigned size )
{
return ft_gzip_alloc( opaque, items, size );
return ft_gzip_alloc( (FT_Memory)opaque, items, size );
}
local void
zcfree( voidpf opaque,
voidpf ptr )
{
ft_gzip_free( opaque, ptr );
ft_gzip_free( (FT_Memory)opaque, ptr );
}
#endif /* !SYSTEM_ZLIB */
@ -502,7 +513,7 @@
static void
ft_gzip_stream_close( FT_Stream stream )
{
FT_GZipFile zip = stream->descriptor.pointer;
FT_GZipFile zip = (FT_GZipFile)stream->descriptor.pointer;
FT_Memory memory = stream->memory;
@ -524,7 +535,7 @@
FT_Byte* buffer,
FT_ULong count )
{
FT_GZipFile zip = stream->descriptor.pointer;
FT_GZipFile zip = (FT_GZipFile)stream->descriptor.pointer;
return ft_gzip_file_io( zip, pos, buffer, count );

View File

@ -478,7 +478,7 @@ THE SOFTWARE.
}
else
{
/* apparently, the PCF driver loads all properties as signed integers!
/* Apparently, the PCF driver loads all properties as signed integers!
* This really doesn't seem to be a problem, because this is
* sufficient for any meaningful values.
*/

View File

@ -972,12 +972,12 @@ THE SOFTWARE.
else
root->family_name = 0;
/* note: we shift all glyph indices by +1 since we must
* respect the convention that glyph 0 always correspond
* to the "missing glyph".
*
* this implies bumping the number of "available" glyphs by 1
*/
/* Note: We shift all glyph indices by +1 since we must
* respect the convention that glyph 0 always corresponds
* to the "missing glyph".
*
* This implies bumping the number of "available" glyphs by 1.
*/
root->num_glyphs = face->nmetrics + 1;
root->num_fixed_sizes = 1;

View File

@ -355,8 +355,10 @@
full++;
}
root->style_name = ( *full == ' ' ? full + 1
: (char *)"Regular" );
if ( *full == ' ' || *full == '-' )
root->style_name = full + 1;
else
root->style_name = (char *)"Regular";
}
else
root->style_name = (char *)"Regular";

View File

@ -223,8 +223,10 @@
full++;
}
root->style_name = ( *full == ' ' ? full + 1
: (char *)"Regular" );
if ( *full == ' ' || *full == '-' )
root->style_name = full + 1;
else
root->style_name = (char *)"Regular";
}
else
root->style_name = (char *)"Regular";