fixed CR6229445: fc-cache crash
--- src/lzw/zopen.c Tue Mar 1 13:54:50 2005
+++ src/lzw/zopen.c Tue Mar 1 16:00:09 2005
@@ -355,7 +355,11 @@
}
roffset = 0;
/* Round size down to integral number of codes. */
- size = (size << 3) - (n_bits - 1);
+ if(size) {
+ size = (size << 3) - (n_bits - 1);
+ }else
+ return -1;
+
}
r_off = roffset;
bits = n_bits;
--- src/pcf/pcfdrivr.c Mon Nov 21 13:31:24 2004
+++ new/src/pcf/pcfdrivr.c Fri Sep 16 11:18:37 2005
@@ -402,6 +402,11 @@
FT_UInt vert_resolution )
{
PCF_Face face = (PCF_Face)FT_SIZE_FACE( size );
+ /*
+ * Find a close match. Does not have to be exact match. (too difficult)
+ */
+ int sm_y_ppem = size->metrics.y_ppem;
+ int fr_y_ppem = face->root.available_sizes->y_ppem >> 6;
FT_UNUSED( char_width );
FT_UNUSED( char_height );
@@ -413,7 +418,7 @@
size->metrics.y_ppem,
face->root.available_sizes->y_ppem >> 6 ));
- if ( size->metrics.y_ppem == face->root.available_sizes->y_ppem >> 6 )
+ if ( sm_y_ppem >= fr_y_ppem - 4 && sm_y_ppem <= fr_y_ppem + 4 )
{
size->metrics.ascender = face->accel.fontAscent << 6;
size->metrics.descender = face->accel.fontDescent * (-64);
--- src/pcf/pcfread.c Fri Sep 23 14:50:03 2004
+++ new/src/pcf/pcfread.c Fri Sep 23 14:39:23 2005
@@ -891,6 +891,7 @@
FT_Error error = PCF_Err_Ok;
FT_Face face = FT_FACE( pcf );
FT_Memory memory = face->memory;
+ int weight = 0;
PCF_Property prop;
@@ -917,7 +918,8 @@
prop = pcf_find_property( pcf, "WEIGHT_NAME" );
if ( prop && prop->isString &&
- ( *(prop->value.atom) == 'B' || *(prop->value.atom) == 'b' ) )
+ ( *(prop->value.atom) == 'B' || *(prop->value.atom) == 'b' ||
+ *(prop->value.atom) == 'D' || *(prop->value.atom) == 'd' ) )
{
face->style_flags |= FT_STYLE_FLAG_BOLD;
bstr = (char *)"Bold";
@@ -924,6 +926,11 @@
len += ft_strlen( bstr );
parts++;
}
+ if ( prop && prop->isString &&
+ ( *(prop->value.atom) == 'M' || *(prop->value.atom) == 'm' ) )
+ {
+ weight = 100;
+ }
prop = pcf_find_property( pcf, "SETWIDTH_NAME" );
if ( prop && prop->isString &&
@@ -947,10 +954,20 @@
if ( !parts || !len )
{
- if ( FT_ALLOC( face->style_name, 8 ) )
- return error;
- ft_strcpy( face->style_name, "Regular" );
- face->style_name[7] = '\0';
+ if ( weight == 0 )
+ {
+ if ( FT_ALLOC( face->style_name, 8 ) )
+ return error;
+ ft_strcpy( face->style_name, "Regular" );
+ face->style_name[7] = '\0';
+ }
+ else
+ {
+ if ( FT_ALLOC( face->style_name, 7 ) )
+ return error;
+ ft_strcpy( face->style_name, "Medium" );
+ face->style_name[7] = '\0';
+ }
}
else
{