summaryrefslogtreecommitdiff
path: root/src/pk/pklib.c
diff options
context:
space:
mode:
authorParth Wazurkar <parthwazurkar@gmail.com>2018-08-13 10:11:31 +0530
committerParth Wazurkar <parthwazurkar@gmail.com>2018-08-13 10:17:40 +0530
commite3bdbb32681d730ac4d0a3355e93a3660ae60662 (patch)
tree30861c2fee48576d59af7f5886e9f4dc9a7b4178 /src/pk/pklib.c
parentae5ef67e706097a448fb02d261374ed5c82551ce (diff)
downloadfreetype2-e3bdbb32681d730ac4d0a3355e93a3660ae60662.tar.gz
[pk] Fixes.
* src/pk/pkdrivr.c(PK_Glyph_Load): - Remove unnecessary test for code_{min, max} values. - Use pointer to get metric values. * src/pk/pklib.c(pk_load_font): - Improve tracing. - Remove unnecessary variables and parameters.
Diffstat (limited to 'src/pk/pklib.c')
-rw-r--r--src/pk/pklib.c60
1 files changed, 41 insertions, 19 deletions
diff --git a/src/pk/pklib.c b/src/pk/pklib.c
index dd5a23bfb..8ede28930 100644
--- a/src/pk/pklib.c
+++ b/src/pk/pklib.c
@@ -177,11 +177,8 @@ FT_Byte bits_table[] = {
FT_Int
pk_read_14( FT_Stream stream,
- FT_Int dyn_f,
- FT_Int bw,
FT_ULong rs,
- PK_Bitmap bm,
- FT_Long cc )
+ PK_Bitmap bm )
{
FT_Long x, y, x8, xm;
FT_Byte *bm_ptr;
@@ -199,6 +196,7 @@ FT_Byte bits_table[] = {
bm_ptr = bm->bitmap;
bit16_buff = READ_UINT1( stream ) << 8;
+ FT_TRACE2(( "pk_read_14: bit16_buff is %ld\n",bit16_buff ));
rest_bit16_buff = 8;
--rs;
@@ -240,8 +238,7 @@ FT_Byte bits_table[] = {
FT_Int dyn_f,
FT_Int bw,
FT_ULong rs,
- PK_Bitmap bm,
- FT_Long cc )
+ PK_Bitmap bm )
{
FT_Long x, y, xx, yy, repeat;
FT_Int bits, b_p;
@@ -298,16 +295,16 @@ FT_Byte bits_table[] = {
FT_Memory extmemory,
PK_Glyph *goptr )
{
- PK_Glyph go;
- FT_Byte instr, pre, id;;
- FT_ULong ds, check_sum, hppp, vppp, k;
- FT_UInt flag, dny_f, bw, ess, size;
- FT_ULong cc, tfm, dx, dy, dm, w, h, rs;
- FT_Long hoff, voff, mv_x, mv_y, gptr;
- FT_Int bc, ec, nchars, index, i;
- FT_Error error = FT_Err_Ok;
- FT_Memory memory = extmemory; /* needed for FT_NEW */
- PK_Encoding encoding = NULL;
+ PK_Glyph go;
+ FT_Byte instr, pre, id;
+ FT_Long ds, check_sum, hppp, vppp, k;
+ FT_Long cc, tfm, dx, dy, dm, w, h, rs;
+ FT_Int flag, dny_f, bw, ess, size;
+ FT_Long hoff, voff, mv_x, mv_y, gptr;
+ FT_Int bc, ec, nchars, index, i;
+ FT_Error error = FT_Err_Ok;
+ FT_Memory memory = extmemory; /* needed for FT_NEW */
+ PK_Encoding encoding = NULL;
go = NULL;
nchars = -1;
@@ -329,6 +326,8 @@ FT_Byte bits_table[] = {
goto Exit;
}
+ FT_TRACE2(( "pk_load_font: PK_ID(89) found\n" ));
+
k = READ_UINT1( stream );
if ( FT_STREAM_SKIP( k ) )
goto Exit;
@@ -338,6 +337,8 @@ FT_Byte bits_table[] = {
hppp = READ_INT4( stream );
vppp = READ_INT4( stream );
+ FT_TRACE2(( "pk_load_font: checksum is %ld\n",check_sum ));
+
gptr = stream->pos;
#if 0
@@ -393,12 +394,18 @@ FT_Byte bits_table[] = {
if( FT_ALLOC(go, sizeof(PK_GlyphRec)) )
goto Exit;
+ FT_TRACE2(( "pk_load_font: Allocated sufficient memory in go\n" ));
+
if( FT_ALLOC_MULT(go->bm_table, sizeof(PK_BitmapRec), nchars) )
goto Exit;
+ FT_TRACE2(( "pk_load_font: Allocated sufficient memory in go->bm_table\n" ));
+
if ( FT_NEW_ARRAY( encoding, nchars ) )
return error;
+ FT_TRACE2(( "pk_load_font: Allocated sufficient memory in encoding\n" ));
+
go->ds = (FT_UInt)ds/(1<<20);
go->hppp = (FT_UInt)hppp/(1<<16);
go->vppp = (FT_UInt)vppp/(1<<16);
@@ -507,13 +514,28 @@ FT_Byte bits_table[] = {
go->bm_table[index].off_y = voff;
go->bm_table[index].mv_x = mv_x;
go->bm_table[index].mv_y = mv_y;
- go->bm_table[index].bitmap = (unsigned char*)malloc(h*((w+7)/8));
+ go->bm_table[index].bitmap = (unsigned char*)malloc(h*( (w+7)>>3 ));
go->bm_table[index].code = cc ; /* For backward compatibility */
go->nglyphs += 1;
encoding[index].enc = cc ;
encoding[index].glyph = index;
+ FT_TRACE6(( "pk_load_font: go->bm_table values are :\n"
+ " go->bm_table[%d].bbx_width : %ld\n"
+ " go->bm_table[%d].bbx_height : %ld\n"
+ " go->bm_table[%d].raster : %d\n"
+ " go->bm_table[%d].off_x : %d\n"
+ " go->bm_table[%d].off_y : %d\n"
+ " go->bm_table[%d].mv_x : %d\n"
+ " go->bm_table[%d].mv_y : %d\n", index, go->bm_table[index].bbx_width, index,
+ go->bm_table[index].bbx_height, index,
+ go->bm_table[index].raster, index,
+ go->bm_table[index].off_x, index,
+ go->bm_table[index].off_y, index,
+ go->bm_table[index].mv_x, index,
+ go->bm_table[index].mv_y, index ));
+
if (go->bm_table[index].bitmap == NULL)
{
@@ -525,7 +547,7 @@ FT_Byte bits_table[] = {
if (dny_f == 14)
{
- if (pk_read_14(stream, dny_f, bw, rs, &(go->bm_table[index]), cc) < 0)
+ if (pk_read_14(stream, rs, &(go->bm_table[index])) < 0)
{
FT_ERROR(( "pk_load_font: error in `pk_read_14'\n" ));
error = FT_THROW( Unknown_File_Format );
@@ -534,7 +556,7 @@ FT_Byte bits_table[] = {
}
else
{
- if (pk_read_n14(stream, dny_f, bw, rs, &(go->bm_table[index]), cc) < 0)
+ if (pk_read_n14(stream, dny_f, bw, rs, &(go->bm_table[index])) < 0)
{
FT_ERROR(( "pk_load_font: error in `pk_read_n14'\n" ));
error = FT_THROW( Unknown_File_Format );