summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/pfr/pfrobjs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/freetype/src/pfr/pfrobjs.c')
-rw-r--r--src/3rdparty/freetype/src/pfr/pfrobjs.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/src/3rdparty/freetype/src/pfr/pfrobjs.c b/src/3rdparty/freetype/src/pfr/pfrobjs.c
index 56d617d880..0c89242c74 100644
--- a/src/3rdparty/freetype/src/pfr/pfrobjs.c
+++ b/src/3rdparty/freetype/src/pfr/pfrobjs.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR object methods (body). */
/* */
-/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 2002-2008, 2010-2011, 2013, 2014 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -23,6 +23,8 @@
#include "pfrsbit.h"
#include FT_OUTLINE_H
#include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_CALC_H
+#include FT_TRUETYPE_IDS_H
#include "pfrerror.h"
@@ -76,6 +78,8 @@
FT_UNUSED( params );
+ FT_TRACE2(( "PFR driver\n" ));
+
/* load the header and check it */
error = pfr_header_load( &face->header, stream );
if ( error )
@@ -83,8 +87,8 @@
if ( !pfr_header_check( &face->header ) )
{
- FT_TRACE4(( "pfr_face_init: not a valid PFR font\n" ));
- error = PFR_Err_Unknown_File_Format;
+ FT_TRACE2(( " not a PFR font\n" ));
+ error = FT_THROW( Unknown_File_Format );
goto Exit;
}
@@ -108,7 +112,7 @@
if ( face_index >= pfrface->num_faces )
{
FT_ERROR(( "pfr_face_init: invalid face index\n" ));
- error = PFR_Err_Invalid_Argument;
+ error = FT_THROW( Invalid_Argument );
goto Exit;
}
@@ -134,7 +138,8 @@
pfrface->face_index = face_index;
pfrface->num_glyphs = phy_font->num_chars + 1;
- pfrface->face_flags = FT_FACE_FLAG_SCALABLE;
+
+ pfrface->face_flags |= FT_FACE_FLAG_SCALABLE;
/* if all characters point to the same gps_offset 0, we */
/* assume that the font only contains bitmaps */
@@ -147,7 +152,16 @@
break;
if ( nn == phy_font->num_chars )
- pfrface->face_flags = 0; /* not scalable */
+ {
+ if ( phy_font->num_strikes > 0 )
+ pfrface->face_flags = 0; /* not scalable */
+ else
+ {
+ FT_ERROR(( "pfr_face_init: font doesn't contain glyphs\n" ));
+ error = FT_THROW( Invalid_File_Format );
+ goto Exit;
+ }
+ }
}
if ( (phy_font->flags & PFR_PHY_PROPORTIONAL) == 0 )
@@ -243,11 +257,11 @@
charmap.face = pfrface;
- charmap.platform_id = 3;
- charmap.encoding_id = 1;
+ charmap.platform_id = TT_PLATFORM_MICROSOFT;
+ charmap.encoding_id = TT_MS_ID_UNICODE_CS;
charmap.encoding = FT_ENCODING_UNICODE;
- FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL );
+ error = FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL );
#if 0
/* Select default charmap */
@@ -312,12 +326,14 @@
FT_ULong gps_offset;
+ FT_TRACE1(( "pfr_slot_load: glyph index %d\n", gindex ));
+
if ( gindex > 0 )
gindex--;
if ( !face || gindex >= face->phy_font.num_chars )
{
- error = PFR_Err_Invalid_Argument;
+ error = FT_THROW( Invalid_Argument );
goto Exit;
}
@@ -331,7 +347,7 @@
if ( load_flags & FT_LOAD_SBITS_ONLY )
{
- error = PFR_Err_Invalid_Argument;
+ error = FT_THROW( Invalid_Argument );
goto Exit;
}
@@ -456,7 +472,7 @@
FT_Vector* kerning )
{
PFR_Face face = (PFR_Face)pfrface;
- FT_Error error = PFR_Err_Ok;
+ FT_Error error = FT_Err_Ok;
PFR_PhyFont phy_font = &face->phy_font;
FT_UInt32 code1, code2, pair;
@@ -500,7 +516,7 @@
{
FT_UInt count = item->pair_count;
FT_UInt size = item->pair_size;
- FT_UInt power = (FT_UInt)ft_highpow2( (FT_UInt32)count );
+ FT_UInt power = 1 << FT_MSB( count );
FT_UInt probe = power * size;
FT_UInt extra = count - power;
FT_Byte* base = stream->cursor;