[xorg-commit-diffs] xc/extras/freetype2/src/pcf pcfdrivr.c, NONE,
1.1.6.1 pcfdrivr.h, NONE, 1.1.6.1 Jamfile, 1.1.4.1,
1.1.4.2 pcf.c, 1.1, 1.1.4.1 pcf.h, 1.1.4.1, 1.1.4.2 pcfread.c,
1.1.4.2, 1.1.4.3 pcfread.h, 1.1, 1.1.4.1 pcfutil.c, 1.1.4.2,
1.1.4.3 pcfutil.h, 1.1.4.3, 1.1.4.4 rules.mk, 1.1,
1.1.4.1 pcfdriver.c, 1.1.4.1, NONE pcfdriver.h, 1.1, NONE
Egbert Eich
xorg-commit at pdx.freedesktop.org
Thu Apr 15 03:14:41 PDT 2004
- Previous message: [xorg-commit-diffs] xc/extras/freetype2/src/otlayout otlgsub.c,
1.1.4.1, 1.1.4.2
- Next message: [xorg-commit-diffs] xc/extras/freetype2/src/pfr Jamfile, 1.1.4.1,
1.1.4.2 pfrdrivr.c, 1.1.4.1, 1.1.4.2 pfrload.c, 1.1.4.1,
1.1.4.2 pfrobjs.c, 1.1.4.2, 1.1.4.3 pfrobjs.h, 1.1.4.1,
1.1.4.2 pfrsbit.c, 1.1, 1.1.4.1 pfrtypes.h, 1.1.4.1,
1.1.4.2 rules.mk, 1.1, 1.1.4.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: eich
Update of /cvs/xorg/xc/extras/freetype2/src/pcf
In directory pdx:/home/eich/tstbuild/xc/extras/freetype2/src/pcf
Modified Files:
Tag: XORG-CURRENT
Jamfile pcf.c pcf.h pcfread.c pcfread.h pcfutil.c pcfutil.h
rules.mk
Added Files:
Tag: XORG-CURRENT
pcfdrivr.c pcfdrivr.h
Removed Files:
Tag: XORG-CURRENT
pcfdriver.c pcfdriver.h
Log Message:
2004-04-15 Egbert Eich <eich at freedesktop.org>
Merged changes from RELEASE-1 branch
--- NEW FILE: pcfdrivr.c ---
/* pcfdrivr.c
FreeType font driver for pcf files
Copyright (C) 2000, 2001, 2002, 2003 by
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"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_OBJECTS_H
#include FT_GZIP_H
#include FT_ERRORS_H
#include FT_BDF_H
#include "pcf.h"
#include "pcfdrivr.h"
#include "pcfutil.h"
#include "pcfread.h"
#include "pcferror.h"
#undef FT_COMPONENT
#define FT_COMPONENT trace_pcfread
#include FT_SERVICE_BDF_H
#include FT_SERVICE_XFREE86_NAME_H
typedef struct PCF_CMapRec_
{
FT_CMapRec cmap;
FT_UInt num_encodings;
PCF_Encoding encodings;
} PCF_CMapRec, *PCF_CMap;
FT_CALLBACK_DEF( FT_Error )
pcf_cmap_init( PCF_CMap cmap )
{
PCF_Face face = (PCF_Face)FT_CMAP_FACE( cmap );
cmap->num_encodings = (FT_UInt)face->nencodings;
cmap->encodings = face->encodings;
return PCF_Err_Ok;
}
FT_CALLBACK_DEF( void )
pcf_cmap_done( PCF_CMap cmap )
{
cmap->encodings = NULL;
cmap->num_encodings = 0;
}
FT_CALLBACK_DEF( FT_UInt )
pcf_cmap_char_index( PCF_CMap cmap,
FT_UInt32 charcode )
{
PCF_Encoding encodings = cmap->encodings;
FT_UInt min, max, mid;
FT_UInt result = 0;
min = 0;
max = cmap->num_encodings;
while ( min < max )
{
FT_UInt32 code;
mid = ( min + max ) >> 1;
code = encodings[mid].enc;
if ( charcode == code )
{
result = encodings[mid].glyph + 1;
break;
}
if ( charcode < code )
max = mid;
else
min = mid + 1;
}
return result;
}
FT_CALLBACK_DEF( FT_UInt )
pcf_cmap_char_next( PCF_CMap cmap,
FT_UInt32 *acharcode )
{
PCF_Encoding encodings = cmap->encodings;
FT_UInt min, max, mid;
FT_UInt32 charcode = *acharcode + 1;
FT_UInt result = 0;
min = 0;
max = cmap->num_encodings;
while ( min < max )
{
FT_UInt32 code;
mid = ( min + max ) >> 1;
code = encodings[mid].enc;
if ( charcode == code )
{
result = encodings[mid].glyph + 1;
goto Exit;
}
if ( charcode < code )
max = mid;
else
min = mid + 1;
}
charcode = 0;
if ( min < cmap->num_encodings )
{
charcode = encodings[min].enc;
result = encodings[min].glyph + 1;
}
Exit:
*acharcode = charcode;
return result;
}
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
};
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_pcfdriver
FT_CALLBACK_DEF( FT_Error )
PCF_Face_Done( PCF_Face face )
{
FT_Memory memory = FT_FACE_MEMORY( face );
FT_FREE( face->encodings );
FT_FREE( face->metrics );
/* free properties */
{
PCF_Property prop = face->properties;
FT_Int i;
for ( i = 0; i < face->nprops; i++ )
{
prop = &face->properties[i];
FT_FREE( prop->name );
if ( prop->isString )
FT_FREE( prop->value );
}
FT_FREE( face->properties );
}
FT_FREE( face->toc.tables );
FT_FREE( face->root.family_name );
FT_FREE( face->root.available_sizes );
FT_FREE( face->charset_encoding );
FT_FREE( face->charset_registry );
FT_TRACE4(( "PCF_Face_Done: done face\n" ));
/* close gzip stream if any */
if ( face->root.stream == &face->gzip_stream )
{
FT_Stream_Close( &face->gzip_stream );
face->root.stream = face->gzip_source;
}
return PCF_Err_Ok;
}
FT_CALLBACK_DEF( FT_Error )
PCF_Face_Init( FT_Stream stream,
PCF_Face face,
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params )
{
FT_Error error = PCF_Err_Ok;
FT_UNUSED( num_params );
FT_UNUSED( params );
FT_UNUSED( face_index );
error = pcf_load_font( stream, face );
if ( error )
{
FT_Error error2;
/* this didn't work, try gzip support! */
error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream );
if ( error2 == PCF_Err_Unimplemented_Feature )
goto Fail;
error = error2;
if ( error )
goto Fail;
face->gzip_source = stream;
face->root.stream = &face->gzip_stream;
stream = face->root.stream;
error = pcf_load_font( stream, face );
if ( error )
goto Fail;
}
/* set-up charmap */
{
FT_String *charset_registry, *charset_encoding;
FT_Bool unicode_charmap = 0;
charset_registry = face->charset_registry;
charset_encoding = face->charset_encoding;
if ( ( charset_registry != NULL ) &&
( charset_encoding != NULL ) )
{
char* s = face->charset_registry;
/* Uh, oh, compare first letters manually to avoid dependency
on locales. */
if ( ( s[0] == 'i' || s[0] == 'I' ) &&
( s[1] == 's' || s[1] == 'S' ) &&
( s[2] == 'o' || s[2] == 'O' ) )
{
s += 3;
if ( !ft_strcmp( s, "10646" ) ||
( !ft_strcmp( s, "8859" ) &&
!ft_strcmp( face->charset_encoding, "1" ) ) )
unicode_charmap = 1;
}
}
{
FT_CharMapRec charmap;
charmap.face = FT_FACE( face );
charmap.encoding = FT_ENCODING_NONE;
charmap.platform_id = 0;
charmap.encoding_id = 0;
if ( unicode_charmap )
{
charmap.encoding = FT_ENCODING_UNICODE;
charmap.platform_id = 3;
charmap.encoding_id = 1;
}
error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL );
#if 0
/* Select default charmap */
if (face->root.num_charmaps)
face->root.charmap = face->root.charmaps[0];
#endif
}
}
Exit:
return error;
Fail:
FT_TRACE2(( "[not a valid PCF file]\n" ));
error = PCF_Err_Unknown_File_Format; /* error */
goto Exit;
}
static FT_Error
PCF_Set_Pixel_Size( FT_Size size )
{
PCF_Face face = (PCF_Face)FT_SIZE_FACE( size );
FT_TRACE4(( "rec %d - pres %d\n", size->metrics.y_ppem,
face->root.available_sizes->height ));
if ( size->metrics.y_ppem == face->root.available_sizes->height )
{
size->metrics.ascender = face->accel.fontAscent << 6;
size->metrics.descender = face->accel.fontDescent * (-64);
#if 0
size->metrics.height = face->accel.maxbounds.ascent << 6;
#endif
size->metrics.height = size->metrics.ascender -
size->metrics.descender;
size->metrics.max_advance = face->accel.maxbounds.characterWidth << 6;
return PCF_Err_Ok;
}
else
{
FT_TRACE4(( "size WRONG\n" ));
return PCF_Err_Invalid_Pixel_Size;
}
}
static FT_Error
PCF_Glyph_Load( FT_GlyphSlot slot,
FT_Size size,
FT_UInt glyph_index,
FT_Int32 load_flags )
{
PCF_Face face = (PCF_Face)FT_SIZE_FACE( size );
FT_Stream stream = face->root.stream;
FT_Error error = PCF_Err_Ok;
FT_Bitmap* bitmap = &slot->bitmap;
PCF_Metric metric;
int bytes;
FT_UNUSED( load_flags );
FT_TRACE4(( "load_glyph %d ---", glyph_index ));
if ( !face )
{
error = PCF_Err_Invalid_Argument;
goto Exit;
}
if ( glyph_index > 0 )
glyph_index--;
metric = face->metrics + glyph_index;
bitmap->rows = metric->ascent + metric->descent;
bitmap->width = metric->rightSideBearing - metric->leftSideBearing;
bitmap->num_grays = 1;
bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
FT_TRACE6(( "BIT_ORDER %d ; BYTE_ORDER %d ; GLYPH_PAD %d\n",
PCF_BIT_ORDER( face->bitmapsFormat ),
PCF_BYTE_ORDER( face->bitmapsFormat ),
PCF_GLYPH_PAD( face->bitmapsFormat ) ));
switch ( PCF_GLYPH_PAD( face->bitmapsFormat ) )
{
case 1:
bitmap->pitch = ( bitmap->width + 7 ) >> 3;
break;
case 2:
bitmap->pitch = ( ( bitmap->width + 15 ) >> 4 ) << 1;
break;
case 4:
bitmap->pitch = ( ( bitmap->width + 31 ) >> 5 ) << 2;
break;
case 8:
bitmap->pitch = ( ( bitmap->width + 63 ) >> 6 ) << 3;
break;
default:
return PCF_Err_Invalid_File_Format;
}
/* XXX: to do: are there cases that need repadding the bitmap? */
bytes = bitmap->pitch * bitmap->rows;
error = ft_glyphslot_alloc_bitmap( slot, bytes );
if ( error )
goto Exit;
if ( FT_STREAM_SEEK( metric->bits ) ||
FT_STREAM_READ( bitmap->buffer, bytes ) )
goto Exit;
if ( PCF_BIT_ORDER( face->bitmapsFormat ) != MSBFirst )
BitOrderInvert( bitmap->buffer, bytes );
if ( ( PCF_BYTE_ORDER( face->bitmapsFormat ) !=
PCF_BIT_ORDER( face->bitmapsFormat ) ) )
{
switch ( PCF_SCAN_UNIT( face->bitmapsFormat ) )
{
case 1:
break;
case 2:
TwoByteSwap( bitmap->buffer, bytes );
break;
case 4:
FourByteSwap( bitmap->buffer, bytes );
break;
}
}
slot->bitmap_left = metric->leftSideBearing;
slot->bitmap_top = metric->ascent;
slot->metrics.horiAdvance = metric->characterWidth << 6;
slot->metrics.horiBearingX = metric->leftSideBearing << 6;
slot->metrics.horiBearingY = metric->ascent << 6;
slot->metrics.width = ( metric->rightSideBearing -
metric->leftSideBearing ) << 6;
slot->metrics.height = bitmap->rows << 6;
slot->linearHoriAdvance = (FT_Fixed)bitmap->width << 16;
slot->format = FT_GLYPH_FORMAT_BITMAP;
FT_TRACE4(( " --- ok\n" ));
Exit:
return error;
}
/*
*
* BDF SERVICE
*
*/
static FT_Error
pcf_get_bdf_property( PCF_Face face,
const char* prop_name,
BDF_PropertyRec *aproperty )
{
PCF_Property prop;
prop = pcf_find_property( face, prop_name );
if ( prop != NULL )
{
if ( prop->isString )
{
aproperty->type = BDF_PROPERTY_TYPE_ATOM;
aproperty->u.atom = prop->value.atom;
}
else
{
/* 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.
*/
aproperty->type = BDF_PROPERTY_TYPE_INTEGER;
aproperty->u.integer = prop->value.integer;
}
return 0;
}
return PCF_Err_Invalid_Argument;
}
static FT_Service_BDFRec pcf_service_bdf =
{
(FT_BDF_GetCharsetIdFunc)NULL, /* unimplemented ? */
(FT_BDF_GetPropertyFunc) pcf_get_bdf_property
};
/*
*
* SERVICE LIST
*
*/
static FT_ServiceDescRec pcf_services[] =
{
{ FT_SERVICE_ID_BDF, &pcf_service_bdf },
{ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_PCF },
{ NULL, NULL }
};
static FT_Module_Interface
pcf_driver_requester( FT_Module module,
const char* name )
{
FT_UNUSED( module );
return ft_service_list_lookup( pcf_services, name );
}
FT_CALLBACK_TABLE_DEF
const FT_Driver_ClassRec pcf_driver_class =
{
{
FT_MODULE_FONT_DRIVER |
FT_MODULE_DRIVER_NO_OUTLINES,
sizeof ( FT_DriverRec ),
"pcf",
0x10000L,
0x20000L,
0,
(FT_Module_Constructor)0,
(FT_Module_Destructor) 0,
(FT_Module_Requester) pcf_driver_requester
},
sizeof( PCF_FaceRec ),
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_Size_ResetPointsFunc) PCF_Set_Pixel_Size,
(FT_Size_ResetPixelsFunc) PCF_Set_Pixel_Size,
(FT_Slot_LoadFunc) PCF_Glyph_Load,
(FT_Face_GetKerningFunc) 0,
(FT_Face_AttachFunc) 0,
(FT_Face_GetAdvancesFunc) 0
};
/* END */
--- NEW FILE: pcfdrivr.h ---
/* pcfdrivr.h
FreeType font driver for pcf fonts
Copyright 2000-2001, 2002 by
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"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef __PCFDRIVR_H__
#define __PCFDRIVR_H__
#include <ft2build.h>
#include FT_INTERNAL_DRIVER_H
FT_BEGIN_HEADER
FT_EXPORT_VAR( const FT_Driver_ClassRec ) pcf_driver_class;
FT_END_HEADER
#endif /* __PCFDRIVR_H__ */
/* END */
Index: Jamfile
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/pcf/Jamfile,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/Jamfile 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/Jamfile 15 Apr 2004 10:14:37 -0000 1.1.4.2
@@ -1,4 +1,4 @@
-# FreeType 2 src/pcf Jamfile (c) 2001 David Turner
+# FreeType 2 src/pcf Jamfile (c) 2001, 2003 David Turner
#
SubDir FT2_TOP $(FT2_SRC_DIR) pcf ;
@@ -8,7 +8,7 @@
if $(FT2_MULTI)
{
- _sources = pcfdriver pcfread pcfutil ;
+ _sources = pcfdrivr pcfread pcfutil ;
}
else
{
Index: pcf.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/pcf/pcf.c,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/pcf.c 14 Nov 2003 16:48:24 -0000 1.1
+++ b/pcf.c 15 Apr 2004 10:14:37 -0000 1.1.4.1
@@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
- Copyright 2000-2001 by
+ Copyright 2000-2001, 2003 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -31,6 +31,6 @@
#include <ft2build.h>
#include "pcfutil.c"
#include "pcfread.c"
-#include "pcfdriver.c"
+#include "pcfdrivr.c"
/* END */
Index: pcf.h
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/pcf/pcf.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/pcf.h 26 Nov 2003 22:48:27 -0000 1.1.4.1
+++ b/pcf.h 15 Apr 2004 10:14:37 -0000 1.1.4.2
@@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
- Copyright (C) 2000-2001, 2002 by
+ Copyright (C) 2000, 2001, 2002, 2003 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -124,10 +124,10 @@
} PCF_AccelRec, *PCF_Accel;
- typedef struct PCD_EncodingRec_
+ typedef struct PCF_EncodingRec_
{
- FT_Long enc;
- FT_Short glyph;
+ FT_Long enc;
+ FT_UShort glyph;
} PCF_EncodingRec, *PCF_Encoding;
Index: pcfread.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/pcf/pcfread.c,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -d -r1.1.4.2 -r1.1.4.3
--- a/pcfread.c 5 Mar 2004 13:38:43 -0000 1.1.4.2
+++ b/pcfread.c 15 Apr 2004 10:14:37 -0000 1.1.4.3
@@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
- Copyright 2000-2001, 2002 by
+ Copyright 2000, 2001, 2002, 2003 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,7 +23,6 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* $XFree86: xc/extras/freetype2/src/pcf/pcfread.c,v 1.3tsi Exp $ */
#include <ft2build.h>
@@ -32,7 +31,7 @@
#include FT_INTERNAL_OBJECTS_H
#include "pcf.h"
-#include "pcfdriver.h"
+#include "pcfdrivr.h"
#include "pcfread.h"
#include "pcferror.h"
@@ -250,18 +249,22 @@
FT_ULong *aformat,
FT_ULong *asize )
{
- FT_Error error;
+ FT_Error error = PCF_Err_Invalid_File_Format;
FT_Int i;
for ( i = 0; i < ntables; i++ )
if ( tables[i].type == type )
{
- if ( stream->pos > tables[i].offset )
- return PCF_Err_Invalid_Stream_Skip;
+ if ( stream->pos > tables[i].offset ) {
+ error = PCF_Err_Invalid_Stream_Skip;
+ goto Fail;
+ }
- if ( FT_STREAM_SKIP( tables[i].offset - stream->pos ) )
- return error;
+ if ( FT_STREAM_SKIP( tables[i].offset - stream->pos ) ) {
+ error = PCF_Err_Invalid_Stream_Skip;
+ goto Fail;
+ }
*asize = tables[i].size; /* unused - to be removed */
*aformat = tables[i].format;
@@ -269,7 +272,8 @@
return PCF_Err_Ok;
}
- return PCF_Err_Invalid_File_Format;
+ Fail:
+ return error;
}
@@ -914,10 +918,9 @@
{
FT_Face root = FT_FACE( face );
PCF_Property prop;
- int size_set = 0;
- root->num_faces = 1;
+ root->num_faces = 1;
root->face_index = 0;
root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
FT_FACE_FLAG_HORIZONTAL |
@@ -931,13 +934,16 @@
if ( prop != NULL )
if ( prop->isString )
if ( ( *(prop->value.atom) == 'O' ) ||
- ( *(prop->value.atom) == 'I' ) )
+ ( *(prop->value.atom) == 'o' ) ||
+ ( *(prop->value.atom) == 'I' ) ||
+ ( *(prop->value.atom) == 'i' ) )
root->style_flags |= FT_STYLE_FLAG_ITALIC;
prop = pcf_find_property( face, "WEIGHT_NAME" );
if ( prop != NULL )
if ( prop->isString )
- if ( *(prop->value.atom) == 'B' )
+ if ( ( *(prop->value.atom) == 'B' ) ||
+ ( *(prop->value.atom) == 'b' ) )
root->style_flags |= FT_STYLE_FLAG_BOLD;
root->style_name = (char *)"Regular";
@@ -967,53 +973,56 @@
else
root->family_name = 0;
- root->num_glyphs = face->nmetrics;
+ /* 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;
if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
goto Exit;
- prop = pcf_find_property( face, "PIXEL_SIZE" );
- if ( prop != NULL )
{
- root->available_sizes->height =
- root->available_sizes->width = (FT_Short)( prop->value.integer );
+ FT_Bitmap_Size* bsize = root->available_sizes;
- size_set = 1;
- }
- else
- {
- prop = pcf_find_property( face, "POINT_SIZE" );
+
+ FT_MEM_ZERO( bsize, sizeof ( FT_Bitmap_Size ) );
+
+ prop = pcf_find_property( face, "PIXEL_SIZE" );
if ( prop != NULL )
- {
- PCF_Property xres, yres;
+ bsize->height = (FT_Short)prop->value.integer;
+ prop = pcf_find_property( face, "AVERAGE_WIDTH" );
+ if ( prop != NULL )
+ bsize->width = (FT_Short)( ( prop->value.integer + 5 ) / 10 );
- xres = pcf_find_property( face, "RESOLUTION_X" );
- yres = pcf_find_property( face, "RESOLUTION_Y" );
+ prop = pcf_find_property( face, "POINT_SIZE" );
+ if ( prop != NULL )
+ /* convert from 722,7 decipoints to 72 points per inch */
+ bsize->size =
+ (FT_Pos)( ( prop->value.integer * 64 * 7200 + 36135L ) / 72270L );
- if ( ( yres != NULL ) && ( xres != NULL ) )
- {
- root->available_sizes->height =
- (FT_Short)( prop->value.integer *
- yres->value.integer / 720 );
+ prop = pcf_find_property( face, "RESOLUTION_X" );
+ if ( prop != NULL )
+ bsize->x_ppem =
+ (FT_Pos)( ( prop->value.integer * bsize->size + 36 ) / 72 );
- root->available_sizes->width =
- (FT_Short)( prop->value.integer *
- xres->value.integer / 720 );
+ prop = pcf_find_property( face, "RESOLUTION_Y" );
+ if ( prop != NULL )
+ bsize->y_ppem =
+ (FT_Pos)( ( prop->value.integer * bsize->size + 36 ) / 72 );
- size_set = 1;
- }
- }
- }
+ if ( bsize->height == 0 )
+ bsize->height = (FT_Short)( ( bsize->y_ppem + 32 ) / 64 );
- if (size_set == 0 )
- {
- root->available_sizes->width = 12;
- root->available_sizes->height = 12;
+ if ( bsize->height == 0 )
+ bsize->height = 12;
}
- /* set-up charset */
+ /* set up charset */
{
PCF_Property charset_registry = 0, charset_encoding = 0;
Index: pcfread.h
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/pcf/pcfread.h,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/pcfread.h 25 Nov 2003 19:27:21 -0000 1.1
+++ b/pcfread.h 15 Apr 2004 10:14:37 -0000 1.1.4.1
@@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
- Copyright 2000-2001 by
+ Copyright 2003 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -39,7 +39,7 @@
FT_END_HEADER
-#endif /* __PCFUTIL_H__ */
+#endif /* __PCFREAD_H__ */
/* END */
Index: pcfutil.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/pcf/pcfutil.c,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -d -r1.1.4.2 -r1.1.4.3
--- a/pcfutil.c 5 Mar 2004 13:38:43 -0000 1.1.4.2
+++ b/pcfutil.c 15 Apr 2004 10:14:37 -0000 1.1.4.3
@@ -2,11 +2,7 @@
Copyright 1990, 1994, 1998 The Open Group
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
+All Rights Reserved.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
@@ -23,7 +19,7 @@
in this Software without prior written authorization from The Open Group.
*/
-/* $XFree86: xc/extras/freetype2/src/pcf/pcfutil.c,v 1.4tsi Exp $ */
+/* $XFree86: xc/lib/font/util/utilbitmap.c,v 1.3 1999/08/22 08:58:58 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
@@ -76,7 +72,7 @@
* Invert bit order within each BYTE of an array.
*/
- static void
+ void
BitOrderInvert( unsigned char* buf,
int nbytes )
{
@@ -92,7 +88,7 @@
* Invert byte order within each 16-bits of an array.
*/
- static void
+ void
TwoByteSwap( unsigned char* buf,
int nbytes )
{
@@ -111,7 +107,7 @@
* Invert byte order within each 32-bits of an array.
*/
- static void
+ void
FourByteSwap( unsigned char* buf,
int nbytes )
{
@@ -131,12 +127,11 @@
}
-# ifdef UNUSED
/*
* Repad a bitmap.
*/
- static int
+ int
RepadBitmap( char* pSrc,
char* pDst,
unsigned int srcPad,
@@ -215,6 +210,6 @@
return dstWidthBytes * height;
}
-# endif
+
/* END */
Index: pcfutil.h
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/pcf/pcfutil.h,v
retrieving revision 1.1.4.3
retrieving revision 1.1.4.4
diff -u -d -r1.1.4.3 -r1.1.4.4
--- a/pcfutil.h 5 Mar 2004 13:38:43 -0000 1.1.4.3
+++ b/pcfutil.h 15 Apr 2004 10:14:37 -0000 1.1.4.4
@@ -23,7 +23,6 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* $XFree86: xc/extras/freetype2/src/pcf/pcfutil.h,v 1.3tsi Exp $ */
#ifndef __PCFUTIL_H__
#define __PCFUTIL_H__
@@ -32,27 +31,25 @@
#include <ft2build.h>
- static void
+ void
BitOrderInvert( unsigned char* buf,
int nbytes);
- static void
+ void
TwoByteSwap( unsigned char* buf,
int nbytes);
- static void
+ void
FourByteSwap( unsigned char* buf,
int nbytes);
-# ifdef UNUSED
- static int
+ int
RepadBitmap( char* pSrc,
char* pDst,
unsigned int srcPad,
unsigned int dstPad,
int width,
int height);
-# endif
#endif /* __PCFUTIL_H__ */
Index: rules.mk
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/pcf/rules.mk,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/rules.mk 14 Nov 2003 16:48:24 -0000 1.1
+++ b/rules.mk 15 Apr 2004 10:14:37 -0000 1.1.4.1
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2000, 2001 by
+# Copyright (C) 2000, 2001, 2003 by
# Francesco Zappa Nardelli
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -27,49 +27,48 @@
# pcf driver directory
#
-PCF_DIR := $(SRC_)pcf
-PCF_DIR_ := $(PCF_DIR)$(SEP)
+PCF_DIR := $(SRC_DIR)/pcf
-PCF_COMPILE := $(FT_COMPILE) $I$(PCF_DIR)
+PCF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PCF_DIR))
# pcf driver sources (i.e., C files)
#
-PCF_DRV_SRC := $(PCF_DIR_)pcfread.c \
- $(PCF_DIR_)pcfdriver.c \
- $(PCF_DIR_)pcfutil.c
+PCF_DRV_SRC := $(PCF_DIR)/pcfread.c \
+ $(PCF_DIR)/pcfdrivr.c \
+ $(PCF_DIR)/pcfutil.c
# pcf driver headers
#
-PCF_DRV_H := $(PCF_DIR_)pcf.h \
- $(PCF_DIR_)pcfdriver.h \
- $(PCF_DIR_)pcfutil.h \
- $(PCF_DIR_)pcferror.h
+PCF_DRV_H := $(PCF_DIR)/pcf.h \
+ $(PCF_DIR)/pcfdrivr.h \
+ $(PCF_DIR)/pcfutil.h \
+ $(PCF_DIR)/pcferror.h
# pcf driver object(s)
#
# PCF_DRV_OBJ_M is used during `multi' builds
# PCF_DRV_OBJ_S is used during `single' builds
#
-PCF_DRV_OBJ_M := $(PCF_DRV_SRC:$(PCF_DIR_)%.c=$(OBJ_)%.$O)
-PCF_DRV_OBJ_S := $(OBJ_)pcf.$O
+PCF_DRV_OBJ_M := $(PCF_DRV_SRC:$(PCF_DIR)/%.c=$(OBJ_DIR)/%.$O)
+PCF_DRV_OBJ_S := $(OBJ_DIR)/pcf.$O
-# Windows driver source file for single build
+# pcf driver source file for single build
#
-PCF_DRV_SRC_S := $(PCF_DIR_)pcf.c
+PCF_DRV_SRC_S := $(PCF_DIR)/pcf.c
# pcf driver - single object
#
$(PCF_DRV_OBJ_S): $(PCF_DRV_SRC_S) $(PCF_DRV_SRC) $(FREETYPE_H) $(PCF_DRV_H)
- $(PCF_COMPILE) $T$@ $(PCF_DRV_SRC_S)
+ $(PCF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(PCF_DRV_SRC_S))
# pcf driver - multiple objects
#
-$(OBJ_)%.$O: $(PCF_DIR_)%.c $(FREETYPE_H) $(PCF_DRV_H)
- $(PCF_COMPILE) $T$@ $<
+$(OBJ_DIR)/%.$O: $(PCF_DIR)/%.c $(FREETYPE_H) $(PCF_DRV_H)
+ $(PCF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
# update main driver object lists
@@ -77,4 +76,5 @@
DRV_OBJS_S += $(PCF_DRV_OBJ_S)
DRV_OBJS_M += $(PCF_DRV_OBJ_M)
+
# EOF
--- pcfdriver.c DELETED ---
--- pcfdriver.h DELETED ---
- Previous message: [xorg-commit-diffs] xc/extras/freetype2/src/otlayout otlgsub.c,
1.1.4.1, 1.1.4.2
- Next message: [xorg-commit-diffs] xc/extras/freetype2/src/pfr Jamfile, 1.1.4.1,
1.1.4.2 pfrdrivr.c, 1.1.4.1, 1.1.4.2 pfrload.c, 1.1.4.1,
1.1.4.2 pfrobjs.c, 1.1.4.2, 1.1.4.3 pfrobjs.h, 1.1.4.1,
1.1.4.2 pfrsbit.c, 1.1, 1.1.4.1 pfrtypes.h, 1.1.4.1,
1.1.4.2 rules.mk, 1.1, 1.1.4.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the xorg-commit-diffs
mailing list