summaryrefslogtreecommitdiff
path: root/src/freetype2/winfonts
diff options
context:
space:
mode:
authorscuri <scuri>2009-10-20 17:20:18 +0000
committerscuri <scuri>2009-10-20 17:20:18 +0000
commit27a4f9c4ac45ff65f941964f7351b64b1e6a9f35 (patch)
tree2f68c5d9ce5bf6cbc320ac17aef0a65a3ceb99a1 /src/freetype2/winfonts
parent2b70507615b2611fce4294c65bec7264644e2665 (diff)
*** empty log message ***
Diffstat (limited to 'src/freetype2/winfonts')
-rw-r--r--src/freetype2/winfonts/winfnt.c67
-rw-r--r--src/freetype2/winfonts/winfnt.h4
2 files changed, 44 insertions, 27 deletions
diff --git a/src/freetype2/winfonts/winfnt.c b/src/freetype2/winfonts/winfnt.c
index 4aa9744..6b3a4e1 100644
--- a/src/freetype2/winfonts/winfnt.c
+++ b/src/freetype2/winfonts/winfnt.c
@@ -4,7 +4,7 @@
/* */
/* FreeType font driver for Windows FNT/FON files */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* Copyright 2003 Huw D M Davies for Codeweavers */
/* Copyright 2007 Dmitry Timoshkov for Codeweavers */
@@ -342,7 +342,7 @@
if ( !font_count || !font_offset )
{
- FT_TRACE2(( "this file doesn't contain any FNT resources!\n" ));
+ FT_TRACE2(( "this file doesn't contain any FNT resources\n" ));
error = FNT_Err_Invalid_File_Format;
goto Exit;
}
@@ -360,9 +360,11 @@
if ( face_index >= font_count )
{
- error = FNT_Err_Bad_Argument;
+ error = FNT_Err_Invalid_Argument;
goto Exit;
}
+ else if ( face_index < 0 )
+ goto Exit;
if ( FT_NEW( face->font ) )
goto Exit;
@@ -564,7 +566,7 @@
if ( face_index >= face->root.num_faces )
{
- error = FNT_Err_Bad_Argument;
+ error = FNT_Err_Invalid_Argument;
goto Exit;
}
}
@@ -610,13 +612,14 @@
char_code -= cmap->first;
if ( char_code < cmap->count )
- gindex = char_code + 1; /* we artificially increase the glyph index; */
- /* FNT_Load_Glyph reverts to the right one */
+ /* we artificially increase the glyph index; */
+ /* FNT_Load_Glyph reverts to the right one */
+ gindex = (FT_UInt)( char_code + 1 );
return gindex;
}
- static FT_UInt
+ static FT_UInt32
fnt_cmap_char_next( FNT_CMap cmap,
FT_UInt32 *pchar_code )
{
@@ -636,7 +639,7 @@
if ( char_code < cmap->count )
{
result = cmap->first + char_code;
- gindex = char_code + 1;
+ gindex = (FT_UInt)( char_code + 1 );
}
}
@@ -652,7 +655,9 @@
(FT_CMap_InitFunc) fnt_cmap_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)fnt_cmap_char_index,
- (FT_CMap_CharNextFunc) fnt_cmap_char_next
+ (FT_CMap_CharNextFunc) fnt_cmap_char_next,
+
+ NULL, NULL, NULL, NULL, NULL
};
static FT_CMap_Class const fnt_cmap_class = &fnt_cmap_class_rec;
@@ -661,16 +666,18 @@
static void
FNT_Face_Done( FNT_Face face )
{
- if ( face )
- {
- FT_Memory memory = FT_FACE_MEMORY( face );
+ FT_Memory memory;
- fnt_font_done( face );
+ if ( !face )
+ return;
- FT_FREE( face->root.available_sizes );
- face->root.num_fixed_sizes = 0;
- }
+ memory = FT_FACE_MEMORY( face );
+
+ fnt_font_done( face );
+
+ FT_FREE( face->root.available_sizes );
+ face->root.num_fixed_sizes = 0;
}
@@ -690,18 +697,14 @@
/* try to load font from a DLL */
error = fnt_face_get_dll_font( face, face_index );
+ if ( !error && face_index < 0 )
+ goto Exit;
+
if ( error == FNT_Err_Unknown_File_Format )
{
/* this didn't work; try to load a single FNT font */
FNT_Font font;
-
- if ( face_index > 0 )
- {
- error = FNT_Err_Bad_Argument;
- goto Exit;
- }
-
if ( FT_NEW( face->font ) )
goto Exit;
@@ -712,6 +715,14 @@
font->fnt_size = stream->size;
error = fnt_font_load( font, stream );
+
+ if ( !error )
+ {
+ if ( face_index > 0 )
+ error = FNT_Err_Invalid_Argument;
+ else if ( face_index < 0 )
+ goto Exit;
+ }
}
if ( error )
@@ -725,6 +736,8 @@
FT_PtrDist family_size;
+ root->face_index = face_index;
+
root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
FT_FACE_FLAG_HORIZONTAL;
@@ -772,7 +785,7 @@
* => nominal_point_size contains incorrect value;
* use pixel_height as the nominal height
*/
- if ( bsize->y_ppem > font->header.pixel_height << 6 )
+ if ( bsize->y_ppem > ( font->header.pixel_height << 6 ) )
{
FT_TRACE2(( "use pixel_height as the nominal height\n" ));
@@ -820,7 +833,7 @@
if ( font->header.face_name_offset >= font->header.file_size )
{
- FT_TRACE2(( "invalid family name offset!\n" ));
+ FT_TRACE2(( "invalid family name offset\n" ));
error = FNT_Err_Invalid_File_Format;
goto Fail;
}
@@ -901,7 +914,7 @@
switch ( req->type )
{
case FT_SIZE_REQUEST_TYPE_NOMINAL:
- if ( height == ( bsize->y_ppem + 32 ) >> 6 )
+ if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
error = FNT_Err_Ok;
break;
@@ -967,7 +980,7 @@
if ( offset >= font->header.file_size )
{
- FT_TRACE2(( "invalid FNT offset!\n" ));
+ FT_TRACE2(( "invalid FNT offset\n" ));
error = FNT_Err_Invalid_File_Format;
goto Exit;
}
diff --git a/src/freetype2/winfonts/winfnt.h b/src/freetype2/winfonts/winfnt.h
index ca75c95..70a9086 100644
--- a/src/freetype2/winfonts/winfnt.h
+++ b/src/freetype2/winfonts/winfnt.h
@@ -28,6 +28,10 @@
FT_BEGIN_HEADER
+#ifdef FT_CONFIG_OPTION_PIC
+#error "this module does not support PIC yet"
+#endif
+
typedef struct WinMZ_HeaderRec_
{
FT_UShort magic;