Formatting; adding file headers.

This commit is contained in:
Werner Lemberg 2002-10-07 10:12:43 +00:00
parent c4c373cee5
commit eacb9306c0
11 changed files with 291 additions and 207 deletions

View File

@ -7,21 +7,38 @@
2002-10-05 David Turner <david@freetype.org> 2002-10-05 David Turner <david@freetype.org>
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c, Adding support for embedded bitmaps to the PFR driver, and rewriting
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h, its kerning loader/handler to use all kerning pairs in a physical
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to font (and not just the first item).
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item). * src/pfr/pfr.c: Include `pfrsbit.c'.
* src/pfr/pfrgload.c: Include `pfrsbit.h'.
* src/pfr/pfrload.c (pfr_extra_item_load_kerning_pairs): Rewritten.
(pfr_phy_font_done, pfr_phy_font_load): Updated.
* src/pfr/pfrobks.c: Include `pfrsbit.h'.
(pfr_face_init): Handle kerning and embedded bitmaps.
(pfr_slot_load): Load embedded bitmaps.
(PFR_KERN_INDEX): Removed.
(pfr_face_get_kerning): Rewritten.
* src/pfr/pfrsbit.c, src/pfr/pfrsbit.h: New files.
* src/pfr/pfrtypes.h (PFR_KernItemRec): New structure.
(PFR_KERN_INDEX): New macro.
(PFR_PhyFontRec): Add items for kerning and embedded bitmaps.
* src/pfr/Jamfile (_sources) [FT2_MULTI]: Add `pfrsbit'.
* src/base/ftobjs.c (FT_Load_Glyph): Don't load bitmap fonts if
FT_LOAD_NO_RECURSE is set.
Load embedded bitmaps only if FT_LOAD_NO_BITMAP isn't set.
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py, * src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs src/tools/docmaker/tohtml.py: Fixing a few nasty bugs.
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is * src/sfnt/ttcmap0.c (tt_cmap4_validate): The validator for format 4
now capable of dealing with invalid "length" fields at the start sub-tables is now capable of dealing with invalid "length" fields at
of the sub-table. This allows fonts like "mg______.ttf" (i.e. the start of the sub-table. This allows fonts like "mg______.ttf"
Marriage) to return accurate charmaps. (i.e. Marriage) to return accurate charmaps.
* docs/CHANGES: updating * docs/CHANGES: Updated.
2002-10-05 Werner Lemberg <wl@gnu.org> 2002-10-05 Werner Lemberg <wl@gnu.org>

View File

@ -72,9 +72,9 @@ LATEST CHANGES BETWEEN 2.1.3 and 2.1.2
has been updated to support LCD-optimized display on non-paletted has been updated to support LCD-optimized display on non-paletted
displays (under Win32 and X11) displays (under Win32 and X11)
- the PFR driver now supports embedded bitmaps (all formats supported) - The PFR driver now supports embedded bitmaps (all formats supported).
- the TrueType charmap loader now supports certain "broken" fonts that - The TrueType charmap loader now supports certain "broken" fonts that
load under Windows without problems. load under Windows without problems.
- The cache API has been slightly modified (it's still a beta!): - The cache API has been slightly modified (it's still a beta!):

View File

@ -44,3 +44,6 @@ FT_END_HEADER
#endif /* __PFRGLOAD_H__ */ #endif /* __PFRGLOAD_H__ */
/* END */

View File

@ -501,8 +501,8 @@
} }
#if 0 #if 0
/* load kerning pair data */ /* load kerning pair data */
FT_CALLBACK_DEF( FT_Error ) FT_CALLBACK_DEF( FT_Error )
pfr_extra_item_load_kerning_pairs( FT_Byte* p, pfr_extra_item_load_kerning_pairs( FT_Byte* p,
@ -582,7 +582,9 @@
"invalid kerning pairs table\n" )); "invalid kerning pairs table\n" ));
goto Exit; goto Exit;
} }
#else
#else /* 0 */
/* load kerning pair data */ /* load kerning pair data */
FT_CALLBACK_DEF( FT_Error ) FT_CALLBACK_DEF( FT_Error )
pfr_extra_item_load_kerning_pairs( FT_Byte* p, pfr_extra_item_load_kerning_pairs( FT_Byte* p,
@ -593,6 +595,7 @@
FT_Error error = 0; FT_Error error = 0;
FT_Memory memory = phy_font->memory; FT_Memory memory = phy_font->memory;
FT_TRACE2(( "pfr_extra_item_load_kerning_pairs()\n" )); FT_TRACE2(( "pfr_extra_item_load_kerning_pairs()\n" ));
if ( FT_NEW( item ) ) if ( FT_NEW( item ) )
@ -624,33 +627,34 @@
FT_UInt char1, char2; FT_UInt char1, char2;
FT_Byte* q; FT_Byte* q;
if ( item->flags & PFR_KERN_2BYTE_CHAR ) if ( item->flags & PFR_KERN_2BYTE_CHAR )
{ {
q = p; q = p;
char1 = PFR_NEXT_USHORT(q); char1 = PFR_NEXT_USHORT( q );
char2 = PFR_NEXT_USHORT(q); char2 = PFR_NEXT_USHORT( q );
item->pair1 = PFR_KERN_INDEX(char1,char2); item->pair1 = PFR_KERN_INDEX( char1, char2 );
q = p + item->pair_size*(item->pair_count-1); q = p + item->pair_size * ( item->pair_count - 1 );
char1 = PFR_NEXT_USHORT(q); char1 = PFR_NEXT_USHORT( q );
char2 = PFR_NEXT_USHORT(q); char2 = PFR_NEXT_USHORT( q );
item->pair2 = PFR_KERN_INDEX(char1,char2); item->pair2 = PFR_KERN_INDEX( char1, char2 );
} }
else else
{ {
q = p; q = p;
char1 = PFR_NEXT_BYTE(q); char1 = PFR_NEXT_BYTE( q );
char2 = PFR_NEXT_BYTE(q); char2 = PFR_NEXT_BYTE( q );
item->pair1 = PFR_KERN_INDEX(char1,char2); item->pair1 = PFR_KERN_INDEX( char1, char2 );
q = p + item->pair_size*(item->pair_count-1); q = p + item->pair_size * ( item->pair_count - 1 );
char1 = PFR_NEXT_BYTE(q); char1 = PFR_NEXT_BYTE( q );
char2 = PFR_NEXT_BYTE(q); char2 = PFR_NEXT_BYTE( q );
item->pair2 = PFR_KERN_INDEX(char1,char2); item->pair2 = PFR_KERN_INDEX( char1, char2 );
} }
/* add new item to the current list */ /* add new item to the current list */
@ -661,7 +665,7 @@
} }
else else
{ {
/* empty item !! */ /* empty item! */
FT_FREE( item ); FT_FREE( item );
} }
@ -676,7 +680,8 @@
"invalid kerning pairs table\n" )); "invalid kerning pairs table\n" ));
goto Exit; goto Exit;
} }
#endif #endif /* 0 */
static const PFR_ExtraItemRec pfr_phy_font_extra_items[] = static const PFR_ExtraItemRec pfr_phy_font_extra_items[] =
{ {
@ -715,8 +720,9 @@
{ {
PFR_KernItem item, next; PFR_KernItem item, next;
item = phy_font->kern_items; item = phy_font->kern_items;
while (item) while ( item )
{ {
next = item->next; next = item->next;
FT_FREE( item ); FT_FREE( item );
@ -725,6 +731,7 @@
phy_font->kern_items = NULL; phy_font->kern_items = NULL;
phy_font->kern_items_tail = NULL; phy_font->kern_items_tail = NULL;
} }
phy_font->num_kern_pairs = 0; phy_font->num_kern_pairs = 0;
} }

View File

@ -248,7 +248,7 @@
FT_ASSERT( gindex < face->phy_font.num_chars ); FT_ASSERT( gindex < face->phy_font.num_chars );
/* try to load an embedded bitmap */ /* try to load an embedded bitmap */
if ( (load_flags & (FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP)) == 0 ) if ( ( load_flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP ) ) == 0 )
{ {
error = pfr_slot_load_bitmap( slot, size, gindex ); error = pfr_slot_load_bitmap( slot, size, gindex );
if ( error == 0 ) if ( error == 0 )
@ -356,6 +356,7 @@
sure */ sure */
#if 0 #if 0
/* find the kerning for a given glyph pair */ /* find the kerning for a given glyph pair */
FT_LOCAL_DEF( FT_Error ) FT_LOCAL_DEF( FT_Error )
pfr_face_get_kerning( PFR_Face face, pfr_face_get_kerning( PFR_Face face,
@ -398,7 +399,9 @@
Exit: Exit:
return 0; return 0;
} }
#else
#else /* 0 */
/* find the kerning for a given glyph pair */ /* find the kerning for a given glyph pair */
FT_LOCAL_DEF( FT_Error ) FT_LOCAL_DEF( FT_Error )
pfr_face_get_kerning( PFR_Face face, pfr_face_get_kerning( PFR_Face face,
@ -411,6 +414,7 @@
PFR_KernItem item = phy_font->kern_items; PFR_KernItem item = phy_font->kern_items;
FT_UInt32 idx = PFR_KERN_INDEX( glyph1, glyph2 ); FT_UInt32 idx = PFR_KERN_INDEX( glyph1, glyph2 );
kerning->x = 0; kerning->x = 0;
kerning->y = 0; kerning->y = 0;
@ -433,6 +437,7 @@
FT_Stream stream = face->root.stream; FT_Stream stream = face->root.stream;
FT_Byte* p; FT_Byte* p;
if ( FT_STREAM_SEEK( item->offset ) || if ( FT_STREAM_SEEK( item->offset ) ||
FT_FRAME_ENTER( item->pair_count * item->pair_size ) ) FT_FRAME_ENTER( item->pair_count * item->pair_size ) )
goto Exit; goto Exit;
@ -443,32 +448,33 @@
{ {
FT_UInt char1, char2, charcode; FT_UInt char1, char2, charcode;
mid = (min + max) >> 1;
mid = ( min + max ) >> 1;
p = stream->cursor + mid*item->pair_size; p = stream->cursor + mid*item->pair_size;
if ( item->flags & PFR_KERN_2BYTE_CHAR ) if ( item->flags & PFR_KERN_2BYTE_CHAR )
{ {
char1 = FT_NEXT_USHORT(p); char1 = FT_NEXT_USHORT( p );
char2 = FT_NEXT_USHORT(p); char2 = FT_NEXT_USHORT( p );
} }
else else
{ {
char1 = FT_NEXT_USHORT(p); char1 = FT_NEXT_USHORT( p );
char2 = FT_NEXT_USHORT(p); char2 = FT_NEXT_USHORT( p );
} }
charcode = PFR_KERN_INDEX(char1,char2); charcode = PFR_KERN_INDEX( char1, char2 );
if ( idx == charcode ) if ( idx == charcode )
{ {
if ( item->flags & PFR_KERN_2BYTE_ADJ ) if ( item->flags & PFR_KERN_2BYTE_ADJ )
kerning->x = item->base_adj + FT_NEXT_SHORT(p); kerning->x = item->base_adj + FT_NEXT_SHORT( p );
else else
kerning->x = item->base_adj + FT_NEXT_CHAR(p); kerning->x = item->base_adj + FT_NEXT_CHAR( p );
break; break;
} }
if ( idx > charcode ) if ( idx > charcode )
min = mid+1; min = mid + 1;
else else
max = mid; max = mid;
} }

View File

@ -91,3 +91,6 @@ FT_BEGIN_HEADER
FT_END_HEADER FT_END_HEADER
#endif /* __PFROBJS_H__ */ #endif /* __PFROBJS_H__ */
/* END */

View File

@ -1,3 +1,21 @@
/***************************************************************************/
/* */
/* pfrsbit.c */
/* */
/* FreeType PFR bitmap loader (body). */
/* */
/* Copyright 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#include "pfrsbit.h" #include "pfrsbit.h"
#include "pfrload.h" #include "pfrload.h"
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
@ -8,6 +26,7 @@
#undef FT_COMPONENT #undef FT_COMPONENT
#define FT_COMPONENT trace_pfr #define FT_COMPONENT trace_pfr
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/***** *****/ /***** *****/
@ -58,7 +77,8 @@
FT_UInt val = 0; FT_UInt val = 0;
FT_UInt c = 0; FT_UInt c = 0;
n = (FT_Int)(limit - p)*8;
n = (FT_Int)( limit - p ) * 8;
if ( n > writer->total ) if ( n > writer->total )
n = writer->total; n = writer->total;
@ -66,7 +86,7 @@
for ( ; n > 0; n-- ) for ( ; n > 0; n-- )
{ {
if ( (n & 7) == reload ) if ( ( n & 7 ) == reload )
val = *p++; val = *p++;
if ( val & 0x80 ) if ( val & 0x80 )
@ -77,7 +97,7 @@
if ( --left <= 0 ) if ( --left <= 0 )
{ {
cur[0] = (FT_Byte) c; cur[0] = (FT_Byte)c;
left = writer->width; left = writer->width;
mask = 0x80; mask = 0x80;
@ -110,6 +130,7 @@
FT_UInt mask = 0x80; FT_UInt mask = 0x80;
FT_UInt c = 0; FT_UInt c = 0;
n = writer->total; n = writer->total;
phase = 1; phase = 1;
@ -128,12 +149,13 @@
{ {
FT_Int v; FT_Int v;
if ( p >= limit ) if ( p >= limit )
break; break;
v = *p++; v = *p++;
counts[0] = (v >> 4); counts[0] = v >> 4;
counts[1] = (v & 15); counts[1] = v & 15;
phase = 0; phase = 0;
count = counts[0]; count = counts[0];
} }
@ -142,8 +164,8 @@
phase = 1; phase = 1;
count = counts[1]; count = counts[1];
} }
}
while ( count == 0 ); } while ( count == 0 );
} }
if ( phase ) if ( phase )
@ -188,6 +210,7 @@
FT_UInt mask = 0x80; FT_UInt mask = 0x80;
FT_UInt c = 0; FT_UInt c = 0;
n = writer->total; n = writer->total;
phase = 1; phase = 1;
@ -205,8 +228,8 @@
count = *p++; count = *p++;
phase = phase ^ 1; phase = phase ^ 1;
}
while ( count == 0 ); } while ( count == 0 );
} }
if ( phase ) if ( phase )
@ -258,13 +281,14 @@
FT_ULong* found_size ) FT_ULong* found_size )
{ {
FT_UInt left, right, char_len; FT_UInt left, right, char_len;
FT_Bool two = (flags & 1); FT_Bool two = flags & 1;
FT_Byte* buff; FT_Byte* buff;
char_len = 4; char_len = 4;
if ( two ) char_len += 1; if ( two ) char_len += 1;
if ( flags & 2) char_len += 1; if ( flags & 2 ) char_len += 1;
if ( flags & 4) char_len += 1; if ( flags & 4 ) char_len += 1;
left = 0; left = 0;
right = count; right = count;
@ -273,16 +297,19 @@
{ {
FT_UInt middle, code; FT_UInt middle, code;
middle = (left + right) >> 1;
buff = base + middle*char_len;
/* check that we're not outside of the table */ middle = ( left + right ) >> 1;
buff = base + middle * char_len;
/* check that we are not outside of the table -- */
/* this is possible with broken fonts... */ /* this is possible with broken fonts... */
if ( buff + char_len > limit ) if ( buff + char_len > limit )
goto Fail; goto Fail;
if (two) code = PFR_NEXT_USHORT(buff); if ( two )
else code = PFR_NEXT_BYTE(buff); code = PFR_NEXT_USHORT( buff );
else
code = PFR_NEXT_BYTE( buff );
if ( code == char_code ) if ( code == char_code )
goto Found_It; goto Found_It;
@ -300,11 +327,15 @@
return; return;
Found_It: Found_It:
if (flags & 2) *found_size = PFR_NEXT_USHORT(buff); if ( flags & 2 )
else *found_size = PFR_NEXT_BYTE(buff); *found_size = PFR_NEXT_USHORT( buff );
else
*found_size = PFR_NEXT_BYTE( buff );
if (flags & 4) *found_offset = PFR_NEXT_ULONG(buff); if ( flags & 4 )
else *found_offset = PFR_NEXT_USHORT(buff); *found_offset = PFR_NEXT_ULONG( buff );
else
*found_offset = PFR_NEXT_USHORT( buff );
} }
@ -329,8 +360,9 @@
FT_Long xpos, ypos, advance; FT_Long xpos, ypos, advance;
FT_UInt xsize, ysize; FT_UInt xsize, ysize;
PFR_CHECK(1);
flags = PFR_NEXT_BYTE(p); PFR_CHECK( 1 );
flags = PFR_NEXT_BYTE( p );
xpos = 0; xpos = 0;
ypos = 0; ypos = 0;
@ -338,31 +370,31 @@
ysize = 0; ysize = 0;
advance = 0; advance = 0;
switch (flags & 3) switch ( flags & 3 )
{ {
case 0: case 0:
PFR_CHECK(1); PFR_CHECK( 1 );
b = PFR_NEXT_INT8(p); b = PFR_NEXT_INT8( p );
xpos = b >> 4; xpos = b >> 4;
ypos = ((FT_Char)(b << 4)) >> 4; ypos = ( (FT_Char)( b << 4 ) ) >> 4;
break; break;
case 1: case 1:
PFR_CHECK(2); PFR_CHECK( 2 );
xpos = PFR_NEXT_INT8(p); xpos = PFR_NEXT_INT8( p );
ypos = PFR_NEXT_INT8(p); ypos = PFR_NEXT_INT8( p );
break; break;
case 2: case 2:
PFR_CHECK(4); PFR_CHECK( 4 );
xpos = PFR_NEXT_SHORT(p); xpos = PFR_NEXT_SHORT( p );
ypos = PFR_NEXT_SHORT(p); ypos = PFR_NEXT_SHORT( p );
break; break;
case 3: case 3:
PFR_CHECK(6); PFR_CHECK( 6 );
xpos = PFR_NEXT_LONG(p); xpos = PFR_NEXT_LONG( p );
ypos = PFR_NEXT_LONG(p); ypos = PFR_NEXT_LONG( p );
break; break;
default: default:
@ -370,7 +402,7 @@
} }
flags >>= 2; flags >>= 2;
switch (flags & 3) switch ( flags & 3 )
{ {
case 0: case 0:
/* blank image */ /* blank image */
@ -379,22 +411,22 @@
break; break;
case 1: case 1:
PFR_CHECK(1); PFR_CHECK( 1 );
b = PFR_NEXT_BYTE(p); b = PFR_NEXT_BYTE( p );
xsize = (b >> 4) & 0xF; xsize = ( b >> 4 ) & 0xF;
ysize = b & 0xF; ysize = b & 0xF;
break; break;
case 2: case 2:
PFR_CHECK(2); PFR_CHECK( 2 );
xsize = PFR_NEXT_BYTE(p); xsize = PFR_NEXT_BYTE( p );
ysize = PFR_NEXT_BYTE(p); ysize = PFR_NEXT_BYTE( p );
break; break;
case 3: case 3:
PFR_CHECK(4); PFR_CHECK( 4 );
xsize = PFR_NEXT_USHORT(p); xsize = PFR_NEXT_USHORT( p );
ysize = PFR_NEXT_USHORT(p); ysize = PFR_NEXT_USHORT( p );
break; break;
default: default:
@ -402,25 +434,25 @@
} }
flags >>= 2; flags >>= 2;
switch (flags & 3) switch ( flags & 3 )
{ {
case 0: case 0:
advance = scaled_advance; advance = scaled_advance;
break; break;
case 1: case 1:
PFR_CHECK(1); PFR_CHECK( 1 );
advance = PFR_NEXT_INT8(p) << 8; advance = PFR_NEXT_INT8( p ) << 8;
break; break;
case 2: case 2:
PFR_CHECK(2); PFR_CHECK( 2 );
advance = PFR_NEXT_SHORT(p); advance = PFR_NEXT_SHORT( p );
break; break;
case 3: case 3:
PFR_CHECK(3); PFR_CHECK( 3 );
advance = PFR_NEXT_LONG(p); advance = PFR_NEXT_LONG( p );
break; break;
default: default:
@ -455,11 +487,12 @@
FT_Error error = 0; FT_Error error = 0;
PFR_BitWriterRec writer; PFR_BitWriterRec writer;
if ( target->rows > 0 && target->width > 0 ) if ( target->rows > 0 && target->width > 0 )
{ {
pfr_bitwriter_init( &writer, target, decreasing ); pfr_bitwriter_init( &writer, target, decreasing );
switch (format) switch ( format )
{ {
case 0: /* packed bits */ case 0: /* packed bits */
pfr_bitwriter_decode_bytes( &writer, p, limit ); pfr_bitwriter_decode_bytes( &writer, p, limit );
@ -505,22 +538,24 @@
PFR_Char character; PFR_Char character;
PFR_Strike strike; PFR_Strike strike;
character = &phys->chars[glyph_index]; character = &phys->chars[glyph_index];
/* Look-up a bitmap strike corresponding to the current */ /* Look-up a bitmap strike corresponding to the current */
/* character dimensions */ /* character dimensions */
{ {
FT_UInt n; FT_UInt n;
strike = phys->strikes; strike = phys->strikes;
for ( n = 0; n < phys->num_strikes; n++ ) for ( n = 0; n < phys->num_strikes; n++ )
{ {
if ( strike->x_ppm == (FT_UInt) size->root.metrics.x_ppem && if ( strike->x_ppm == (FT_UInt)size->root.metrics.x_ppem &&
strike->y_ppm == (FT_UInt) size->root.metrics.y_ppem ) strike->y_ppm == (FT_UInt)size->root.metrics.y_ppem )
{ {
goto Found_Strike; goto Found_Strike;
} }
strike++; strike++;
} }
@ -534,6 +569,7 @@
{ {
FT_UInt char_len; FT_UInt char_len;
char_len = 4; char_len = 4;
if ( strike->flags & 1 ) char_len += 1; if ( strike->flags & 1 ) char_len += 1;
if ( strike->flags & 2 ) char_len += 1; if ( strike->flags & 2 ) char_len += 1;
@ -554,7 +590,7 @@
FT_FRAME_EXIT(); FT_FRAME_EXIT();
if (gps_size == 0) if ( gps_size == 0 )
{ {
/* Could not find a bitmap program string for this glyph */ /* Could not find a bitmap program string for this glyph */
error = FT_Err_Invalid_Argument; error = FT_Err_Invalid_Argument;
@ -568,11 +604,12 @@
FT_UInt xsize, ysize, format; FT_UInt xsize, ysize, format;
FT_Byte* p; FT_Byte* p;
advance = FT_MulDiv( size->root.metrics.x_ppem << 8, advance = FT_MulDiv( size->root.metrics.x_ppem << 8,
character->advance, character->advance,
phys->metrics_resolution ); phys->metrics_resolution );
/* XXX: handle linearHoriAdvance correctly !! */ /* XXX: handle linearHoriAdvance correctly! */
if ( FT_STREAM_SEEK( face->header.gps_section_offset + gps_offset ) || if ( FT_STREAM_SEEK( face->header.gps_section_offset + gps_offset ) ||
FT_FRAME_ENTER( gps_size ) ) FT_FRAME_ENTER( gps_size ) )
@ -589,16 +626,16 @@
glyph->root.format = FT_GLYPH_FORMAT_BITMAP; glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
/* Set up glyph bitmap and metrics */ /* Set up glyph bitmap and metrics */
glyph->root.bitmap.width = (FT_Int) xsize; glyph->root.bitmap.width = (FT_Int)xsize;
glyph->root.bitmap.rows = (FT_Int) ysize; glyph->root.bitmap.rows = (FT_Int)ysize;
glyph->root.bitmap.pitch = (FT_Long)(xsize+7) >> 3; glyph->root.bitmap.pitch = (FT_Long)( xsize + 7 ) >> 3;
glyph->root.bitmap.pixel_mode = FT_PIXEL_MODE_MONO; glyph->root.bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
glyph->root.metrics.width = (FT_Long)xsize << 6; glyph->root.metrics.width = (FT_Long)xsize << 6;
glyph->root.metrics.height = (FT_Long)ysize << 6; glyph->root.metrics.height = (FT_Long)ysize << 6;
glyph->root.metrics.horiBearingX = xpos << 6; glyph->root.metrics.horiBearingX = xpos << 6;
glyph->root.metrics.horiBearingY = ypos << 6; glyph->root.metrics.horiBearingY = ypos << 6;
glyph->root.metrics.horiAdvance = ((advance >> 2) + 32) & -64; glyph->root.metrics.horiAdvance = ( ( advance >> 2 ) + 32 ) & -64;
glyph->root.metrics.vertBearingX = - glyph->root.metrics.width >> 1; glyph->root.metrics.vertBearingX = - glyph->root.metrics.width >> 1;
glyph->root.metrics.vertBearingY = 0; glyph->root.metrics.vertBearingY = 0;
glyph->root.metrics.vertAdvance = size->root.metrics.height; glyph->root.metrics.vertAdvance = size->root.metrics.height;
@ -609,21 +646,25 @@
/* Allocate and read bitmap data */ /* Allocate and read bitmap data */
{ {
FT_Memory memory = face->root.memory; FT_Memory memory = face->root.memory;
FT_Long len = glyph->root.bitmap.pitch*ysize; FT_Long len = glyph->root.bitmap.pitch * ysize;
if ( !FT_ALLOC( glyph->root.bitmap.buffer, len ) ) if ( !FT_ALLOC( glyph->root.bitmap.buffer, len ) )
{ {
error = pfr_load_bitmap_bits( p, error = pfr_load_bitmap_bits( p,
stream->limit, stream->limit,
format, format,
(face->header.color_flags & 2), face->header.color_flags & 2,
&glyph->root.bitmap ); &glyph->root.bitmap );
} }
} }
} }
FT_FRAME_EXIT(); FT_FRAME_EXIT();
} }
Exit: Exit:
return error; return error;
} }
/* END */

View File

@ -1,8 +1,8 @@
/***************************************************************************/ /***************************************************************************/
/* */ /* */
/* pfrsbit.c */ /* pfrsbit.h */
/* */ /* */
/* FreeType PFR bitmap loader */ /* FreeType PFR bitmap loader (specification). */
/* */ /* */
/* Copyright 2002 by */ /* Copyright 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
@ -15,6 +15,7 @@
/* */ /* */
/***************************************************************************/ /***************************************************************************/
#ifndef __PFRSBIT_H__ #ifndef __PFRSBIT_H__
#define __PFRSBIT_H__ #define __PFRSBIT_H__
@ -30,3 +31,6 @@ FT_BEGIN_HEADER
FT_END_HEADER FT_END_HEADER
#endif /* __PFR_SBIT_H__ */ #endif /* __PFR_SBIT_H__ */
/* END */

View File

@ -192,6 +192,7 @@ FT_BEGIN_HEADER
/************************************************************************/ /************************************************************************/
typedef struct PFR_KernItemRec_* PFR_KernItem; typedef struct PFR_KernItemRec_* PFR_KernItem;
typedef struct PFR_KernItemRec_ typedef struct PFR_KernItemRec_
{ {
PFR_KernItem next; PFR_KernItem next;
@ -205,7 +206,8 @@ FT_BEGIN_HEADER
} PFR_KernItemRec; } PFR_KernItemRec;
#define PFR_KERN_INDEX( g1, g2 ) ( ( (FT_UInt32)(g1) << 16 ) | (FT_UInt16)(g2) ) #define PFR_KERN_INDEX( g1, g2 ) \
( ( (FT_UInt32)(g1) << 16 ) | (FT_UInt16)(g2) )
typedef struct PFR_KernPairRec_ typedef struct PFR_KernPairRec_
{ {

View File

@ -597,7 +597,8 @@
FT_Byte *ends, *starts, *offsets, *deltas, *glyph_ids; FT_Byte *ends, *starts, *offsets, *deltas, *glyph_ids;
FT_UInt num_segs; FT_UInt num_segs;
/* in certain fonts, the 'length' field is invalid and goes */
/* in certain fonts, the `length' field is invalid and goes */
/* out of bound. We try to correct this here... */ /* out of bound. We try to correct this here... */
if ( length < 16 ) if ( length < 16 )
FT_INVALID_TOO_SHORT; FT_INVALID_TOO_SHORT;