ref: 779afe4b91f579e6db0d59f23076a7c6d8c26a14
parent: deb5510a547e94ce6d46766f447c22e696941c40
author: Werner Lemberg <[email protected]>
date: Sun Jun 22 11:33:53 EDT 2003
* src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in computation of glyph_index. (FNT_Size_Set_Pixels): To find a strike, first check pixel_height only, then try to find a better hit by comparing pixel_width also. Without this fix it isn't possible to access all strikes. Also compute metrics.max_advance to be in sync with other bitmap drivers. * src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code. (FT_Set_Pixel_Size): Assign value to `metrics' after validation of arguments. Synchronize computation of height and width for bitmap strikes. The `width' field in the FT_Bitmap_Size structure is now only useful to enumerate different strikes. The `max_advance' field of the FT_Size_Metrics structure should be used to get the (maximum) width of a strike. * src/bdf/bdfdrivr.c (BDF_Face_Init): Don't use AVERAGE_WIDTH for computing `available_sizes->width' but make it always equal to `available_sizes->height'. * src/pcf/pcfread.c (pcf_load_font): Don't use RESOLUTION_X for computing `available_sizes->width' but make it always equal to `available_sizes->height'. * src/truetype/ttdriver.c (Set_Pixel_Sizes): Pass only single argument to function. * src/psnames/psmodule.c (ps_unicode_value): Handle `.' after `uniXXXX' and `uXXXX[X[X]]'. * src/bdf/bdfdrivr.c: s/FT_Err_/BDF_Err/. * src/cache/ftccache.c, src/cache/ftcsbits.c, src/cache/ftlru.c: s/FT_Err_/FTC_Err_/. * src/cff/cffcmap.c: s/FT_Err_/CFF_Err_/. * src/pcf/pcfdrivr.c: s/FT_Err_/PCF_Err_/. * src/psaux/t1cmap.c: Include psauxerr.h. s/FT_Err_/PSaux_Err_/. * src/pshinter/pshnterr.h: New file. * src/pshinter/rules.mk: Updated. * src/pshinter/pshalgo.c, src/pshinter/pshrec.c: Include pshnterr.h. s/FT_Err_/PSH_Err_/. * src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c: s/FT_Err_/PFR_Err_/. * src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c: s/FT_Err_/SFNT_Err_/. * src/truetype/ttgload.c: s/FT_Err_/TT_Err_/. * src/gzip/ftgzip.c: Load FT_MODULE_ERRORS_H and define FT_ERR_PREFIX and FT_ERR_BASE. s/FT_Err_/Gzip_Err_/.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,61 @@
+2003-06-21 Werner Lemberg <[email protected]>
+
+ * src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in
+ computation of glyph_index.
+ (FNT_Size_Set_Pixels): To find a strike, first check pixel_height
+ only, then try to find a better hit by comparing pixel_width also.
+ Without this fix it isn't possible to access all strikes.
+ Also compute metrics.max_advance to be in sync with other bitmap
+ drivers.
+
+ * src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code.
+ (FT_Set_Pixel_Size): Assign value to `metrics' after validation of
+ arguments.
+
+2003-06-20 Werner Lemberg <[email protected]>
+
+ Synchronize computation of height and width for bitmap strikes. The
+ `width' field in the FT_Bitmap_Size structure is now only useful to
+ enumerate different strikes. The `max_advance' field of the
+ FT_Size_Metrics structure should be used to get the (maximum) width
+ of a strike.
+
+ * src/bdf/bdfdrivr.c (BDF_Face_Init): Don't use AVERAGE_WIDTH for
+ computing `available_sizes->width' but make it always equal to
+ `available_sizes->height'.
+
+ * src/pcf/pcfread.c (pcf_load_font): Don't use RESOLUTION_X for
+ computing `available_sizes->width' but make it always equal to
+ `available_sizes->height'.
+
+ * src/truetype/ttdriver.c (Set_Pixel_Sizes): Pass only single
+ argument to function.
+
+ * src/psnames/psmodule.c (ps_unicode_value): Handle `.' after
+ `uniXXXX' and `uXXXX[X[X]]'.
+
+2003-06-19 Werner Lemberg <[email protected]>
+
+ * src/bdf/bdfdrivr.c: s/FT_Err_/BDF_Err/.
+ * src/cache/ftccache.c, src/cache/ftcsbits.c, src/cache/ftlru.c:
+ s/FT_Err_/FTC_Err_/.
+ * src/cff/cffcmap.c: s/FT_Err_/CFF_Err_/.
+ * src/pcf/pcfdrivr.c: s/FT_Err_/PCF_Err_/.
+ * src/psaux/t1cmap.c: Include psauxerr.h.
+ s/FT_Err_/PSaux_Err_/.
+ * src/pshinter/pshnterr.h: New file.
+ * src/pshinter/rules.mk: Updated.
+ * src/pshinter/pshalgo.c, src/pshinter/pshrec.c: Include pshnterr.h.
+ s/FT_Err_/PSH_Err_/.
+ * src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c:
+ s/FT_Err_/PFR_Err_/.
+ * src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
+ src/sfnt/ttload.c: s/FT_Err_/SFNT_Err_/.
+ * src/truetype/ttgload.c: s/FT_Err_/TT_Err_/.
+ * src/gzip/ftgzip.c: Load FT_MODULE_ERRORS_H and define
+ FT_ERR_PREFIX and FT_ERR_BASE.
+ s/FT_Err_/Gzip_Err_/.
+
2003-06-19 Dirck Blaskey <[email protected]>
* src/cff/cffload (cff_encoding_load): `nleft' must be FT_UInt,
@@ -376,7 +434,7 @@
2003-05-30 Werner Lemberg <[email protected]>
Avoid overwriting of numeric font dictionary entries for synthetic
- fonts. Additionally, some entries were handled as `integer' instead
+ fonts. Additionally, some entries were handled as `integer' instead
of `number'.
* include/freetype/internal/psaux.h (T1_FieldType): Add
@@ -443,7 +501,7 @@
s/ps3/ps/.
* src/pshinter/pshrec.c, src/pshinter/pshinter.c: Updated.
- * src/pshinter/rules.mk, src/pshinter/Jamfile: Updated
+ * src/pshinter/rules.mk, src/pshinter/Jamfile: Updated.
* src/pshinter/pshglob.[ch] (psh_dimension_snap_width): Commented
out.
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -218,7 +218,12 @@
/* <Fields> */
/* height :: The character height in pixels. */
/* */
- /* width :: The character width in pixels. */
+ /* width :: The character width in pixels. For drivers which */
+ /* contain a single bitmap strike only (BDF, PCF) this */
+ /* field is always equal to `height'. To get the */
+ /* (maximum) width of a bitmap strike use */
+ /* `face->size->metrics.max_advance' after a call to */
+ /* @FT_Set_Pixel_Sizes. */
/* */
typedef struct FT_Bitmap_Size_
{
@@ -697,8 +702,8 @@
/* */
/* num_fixed_sizes :: The number of fixed sizes available in this */
/* face. This should be set to 0 for scalable */
- /* fonts, unless its face includes a complete */
- /* set of glyphs (called a `strike') for the */
+ /* fonts, unless its face includes a set of */
+ /* glyphs (called a `strike') for the */
/* specified sizes. */
/* */
/* available_sizes :: An array of sizes specifying the available */
@@ -907,7 +912,7 @@
/* */
/* FT_FACE_FLAG_GLYPH_NAMES :: */
/* Indicates that the font contains glyph names that can be */
- /* retrieved through @FT_Get_Glyph_Names. Note that some TrueType */
+ /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */
/* fonts contain broken glyph name tables. Use the function */
/* @FT_Has_PS_Glyph_Name when needed. */
/* */
@@ -1056,7 +1061,7 @@
/* */
/* @description: */
/* A macro that returns true whenever a face object contains some */
- /* glyph names that can be accessed through @FT_Get_Glyph_Names. */
+ /* glyph names that can be accessed through @FT_Get_Glyph_Name. */
/* */
#define FT_HAS_GLYPH_NAMES( face ) \
( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
@@ -1136,10 +1141,12 @@
/* units to fractional (26.6) pixel coordinates. */
/* */
/* ascender :: The ascender, expressed in 26.6 fixed point */
- /* pixels. Always positive. */
+ /* pixels. Positive for ascenders above the */
+ /* baseline. */
/* */
/* descender :: The descender, expressed in 26.6 fixed point */
- /* pixels. Always negative. */
+ /* pixels. Negative for descenders below the */
+ /* baseline. */
/* */
/* height :: The text height, expressed in 26.6 fixed point */
/* pixels. Always positive. */
@@ -1167,7 +1174,7 @@
FT_UShort y_ppem; /* vertical pixels per EM */
FT_Fixed x_scale; /* two scales used to convert font units */
- FT_Fixed y_scale; /* to 26.6 frac. pixel coordinates.. */
+ FT_Fixed y_scale; /* to 26.6 frac. pixel coordinates */
FT_Pos ascender; /* ascender in 26.6 frac. pixels */
FT_Pos descender; /* descender in 26.6 frac. pixels */
@@ -1871,7 +1878,7 @@
/* */
/* <Note> */
/* When dealing with fixed-size faces (i.e., non-scalable formats), */
- /* use the function @FT_Set_Pixel_Sizes. */
+ /* @FT_Set_Pixel_Sizes provides a more convenient interface. */
/* */
FT_EXPORT( FT_Error )
FT_Set_Char_Size( FT_Face face,
@@ -1920,6 +1927,10 @@
/* guarantee in any way that you will get glyph bitmaps that all fit */
/* within an 8x8 cell (sometimes even far from it). */
/* */
+ /* For bitmap fonts, `pixel_height' usually is a reliable value for */
+ /* the height of the bitmap cell. Drivers for bitmap font formats */
+ /* which contain a single bitmap strike only (BDF, PCF) ignore */
+ /* `pixel_width'. */
FT_EXPORT( FT_Error )
FT_Set_Pixel_Sizes( FT_Face face,
FT_UInt pixel_width,
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1994,6 +1994,7 @@
driver = face->driver;
metrics = &face->size->metrics;
+ clazz = driver->clazz;
if ( !char_width )
char_width = char_height;
@@ -2007,9 +2008,6 @@
if ( !vert_resolution )
vert_resolution = 72;
- driver = face->driver;
- clazz = driver->clazz;
-
/* default processing -- this can be overridden by the driver */
if ( char_width < 1 * 64 )
char_width = 1 * 64;
@@ -2016,8 +2014,7 @@
if ( char_height < 1 * 64 )
char_height = 1 * 64;
- /* Compute pixel sizes in 26.6 units. we use rounding
- */
+ /* Compute pixel sizes in 26.6 units with rounding */
dim_x = ( ( char_width * horz_resolution + (36+32*72) ) / 72 ) & -64;
dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & -64;
@@ -2055,14 +2052,15 @@
FT_Error error = FT_Err_Ok;
FT_Driver driver;
FT_Driver_Class clazz;
- FT_Size_Metrics* metrics = &face->size->metrics;
+ FT_Size_Metrics* metrics;
if ( !face || !face->size || !face->driver )
return FT_Err_Invalid_Face_Handle;
- driver = face->driver;
- clazz = driver->clazz;
+ driver = face->driver;
+ metrics = &face->size->metrics;
+ clazz = driver->clazz;
/* default processing -- this can be overridden by the driver */
if ( pixel_width == 0 )
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -65,7 +65,7 @@
cmap->num_encodings = face->bdffont->glyphs_used;
cmap->encodings = face->en_table;
- return FT_Err_Ok;
+ return BDF_Err_Ok;
}
@@ -305,15 +305,9 @@
if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
goto Exit;
- prop = bdf_get_font_property( font, "AVERAGE_WIDTH" );
- if ( ( prop != NULL ) && ( prop->value.int32 >= 10 ) )
- root->available_sizes->width = (short)( prop->value.int32 / 10 );
-
prop = bdf_get_font_property( font, "PIXEL_SIZE" );
- if ( prop != NULL ) {
- root->available_sizes->height =
- root->available_sizes->width = (short) prop->value.int32;
- }
+ if ( prop != NULL )
+ root->available_sizes->height = (short) prop->value.int32;
else
{
prop = bdf_get_font_property( font, "POINT_SIZE" );
@@ -333,20 +327,18 @@
}
}
- if ( root->available_sizes->width == 0 )
+ if ( root->available_sizes->height == 0 )
{
- if ( root->available_sizes->height == 0 )
- {
- /* some fonts have broken SIZE declaration (jiskan24.bdf) */
- FT_ERROR(( "BDF_Face_Init: reading size\n" ));
- root->available_sizes->width = (FT_Short)font->point_size;
- }
- else
- root->available_sizes->width = root->available_sizes->height;
+ /* some fonts have broken SIZE declaration (jiskan24.bdf) */
+ FT_ERROR(( "BDF_Face_Init: reading size\n" ));
+ root->available_sizes->height = (FT_Short)font->point_size;
}
- if ( root->available_sizes->height == 0 )
- root->available_sizes->height = root->available_sizes->width;
+ /* `width' is just an enumeration value for different bitmap strikes */
+ /* in a single font. Since a BDF font has a single strike only, */
+ /* make this value the same as the height. */
+ root->available_sizes->width = root->available_sizes->height;
+
/* encoding table */
{
bdf_glyph_t* cur = font->glyphs;
@@ -682,7 +674,7 @@
}
Fail:
- return FT_Err_Invalid_Argument;
+ return BDF_Err_Invalid_Argument;
}
--- a/src/cache/ftccache.c
+++ b/src/cache/ftccache.c
@@ -173,7 +173,7 @@
if ( *pnode == NULL )
{
FT_ERROR(( "ftc_node_hash_unlink: unknown node!\n" ));
- return FT_Err_Ok;
+ return FTC_Err_Ok;
}
if ( *pnode == node )
@@ -551,7 +551,7 @@
FTC_Query query,
FTC_Node *anode )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error = FTC_Err_Ok;
FTC_Manager manager;
FT_LruNode lru;
FT_UInt free_count = 0;
@@ -743,7 +743,7 @@
}
Fail:
- if ( error != FT_Err_Out_Of_Memory )
+ if ( error != FTC_Err_Out_Of_Memory )
goto Exit;
/* There is not enough memory; try to release some unused nodes
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -216,7 +216,7 @@
/* we mark unloaded glyphs with `sbit.buffer == 0' */
/* and 'width == 255', 'height == 0' */
/* */
- if ( error && error != FT_Err_Out_Of_Memory )
+ if ( error && error != FTC_Err_Out_Of_Memory )
{
sbit->width = 255;
error = 0;
--- a/src/cache/ftlru.c
+++ b/src/cache/ftlru.c
@@ -198,7 +198,7 @@
* This loop will only exit when:
*
* - a new node was successfully created, or an old node flushed
- * - an error other than FT_Err_Out_Of_Memory is detected
+ * - an error other than FTC_Err_Out_Of_Memory is detected
* - the list of nodes is empty, and it isn't possible to create
* new nodes
*
@@ -228,7 +228,7 @@
if ( node == NULL )
{
FT_ASSERT( list->num_nodes == 0 );
- error = FT_Err_Out_Of_Memory;
+ error = FTC_Err_Out_Of_Memory;
goto Exit;
}
@@ -298,7 +298,7 @@
goto Exit;
Fail:
- if ( error != FT_Err_Out_Of_Memory )
+ if ( error != FTC_Err_Out_Of_Memory )
goto Exit;
drop_last = 1;
--- a/src/cff/cffcmap.c
+++ b/src/cff/cffcmap.c
@@ -189,7 +189,7 @@
{
/* there are no unicode characters in here! */
FT_FREE( cmap->pairs );
- error = FT_Err_Invalid_Argument;
+ error = CFF_Err_Invalid_Argument;
}
else
{
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -275,7 +275,6 @@
}
-
/*************************************************************************/
/* */
/* <Function> */
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -26,6 +26,17 @@
#include FT_INTERNAL_DEBUG_H
#include <string.h>
+
+#include FT_MODULE_ERRORS_H
+
+#undef __FTERRORS_H__
+
+#define FT_ERR_PREFIX Gzip_Err_
+#define FT_ERR_BASE FT_Mod_Err_Gzip
+
+#include FT_ERRORS_H
+
+
#ifdef FT_CONFIG_OPTION_USE_ZLIB
#ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB
@@ -181,7 +192,7 @@
head[2] != Z_DEFLATED ||
(head[3] & FT_GZIP_RESERVED) )
{
- error = FT_Err_Invalid_File_Format;
+ error = Gzip_Err_Invalid_File_Format;
goto Exit;
}
@@ -276,7 +287,7 @@
if ( inflateInit2( zstream, -MAX_WBITS ) != Z_OK ||
zstream->next_in == NULL )
{
- error = FT_Err_Invalid_File_Format;
+ error = Gzip_Err_Invalid_File_Format;
goto Exit;
}
@@ -347,7 +358,7 @@
size = stream->read( stream, stream->pos, zip->input,
FT_GZIP_BUFFER_SIZE );
if ( size == 0 )
- return FT_Err_Invalid_Stream_Operation;
+ return Gzip_Err_Invalid_Stream_Operation;
}
else
{
@@ -356,7 +367,7 @@
size = FT_GZIP_BUFFER_SIZE;
if ( size == 0 )
- return FT_Err_Invalid_Stream_Operation;
+ return Gzip_Err_Invalid_Stream_Operation;
FT_MEM_COPY( zip->input, stream->base + stream->pos, size );
}
@@ -398,12 +409,12 @@
{
zip->limit = zstream->next_out;
if ( zip->limit == zip->cursor )
- error = FT_Err_Invalid_Stream_Operation;
+ error = Gzip_Err_Invalid_Stream_Operation;
break;
}
else if ( err != Z_OK )
{
- error = FT_Err_Invalid_Stream_Operation;
+ error = Gzip_Err_Invalid_Stream_Operation;
break;
}
}
@@ -585,7 +596,7 @@
FT_UNUSED( stream );
FT_UNUSED( source );
- return FT_Err_Unimplemented_Feature;
+ return Gzip_Err_Unimplemented_Feature;
}
#endif /* !FT_CONFIG_OPTION_USE_ZLIB */
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -63,7 +63,7 @@
cmap->num_encodings = (FT_UInt)face->nencodings;
cmap->encodings = face->encodings;
- return FT_Err_Ok;
+ return PCF_Err_Ok;
}
@@ -245,7 +245,7 @@
/* this didn't work, try gzip support! */
error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream );
- if ( error2 == FT_Err_Unimplemented_Feature )
+ if ( error2 == PCF_Err_Unimplemented_Feature )
goto Fail;
error = error2;
@@ -454,9 +454,9 @@
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.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;
@@ -499,7 +499,7 @@
return 0;
}
- return FT_Err_Invalid_Argument;
+ return PCF_Err_Invalid_Argument;
}
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -919,7 +919,6 @@
{
FT_Face root = FT_FACE( face );
PCF_Property prop;
- int size_set = 0;
root->num_faces = 1;
@@ -986,45 +985,32 @@
prop = pcf_find_property( face, "PIXEL_SIZE" );
if ( prop != NULL )
- {
- root->available_sizes->height =
- root->available_sizes->width = (FT_Short)( prop->value.integer );
-
- size_set = 1;
- }
+ root->available_sizes->height = (FT_Short)( prop->value.integer );
else
{
prop = pcf_find_property( face, "POINT_SIZE" );
if ( prop != NULL )
{
- PCF_Property xres, yres;
+ PCF_Property yres;
- xres = pcf_find_property( face, "RESOLUTION_X" );
yres = pcf_find_property( face, "RESOLUTION_Y" );
-
- if ( ( yres != NULL ) && ( xres != NULL ) )
- {
+ if ( yres != NULL )
root->available_sizes->height =
(FT_Short)( prop->value.integer *
yres->value.integer / 720 );
-
- root->available_sizes->width =
- (FT_Short)( prop->value.integer *
- xres->value.integer / 720 );
-
- size_set = 1;
- }
}
}
- if (size_set == 0 )
- {
- root->available_sizes->width = 12;
+ if ( root->available_sizes->height == 0 )
root->available_sizes->height = 12;
- }
- /* set-up charset */
+ /* `width' is just an enumeration value for different bitmap strikes */
+ /* in a single font. Since a PCF font has a single strike only, */
+ /* make this value the same as the height. */
+ root->available_sizes->width = root->available_sizes->height;
+
+ /* set up charset */
{
PCF_Property charset_registry = 0, charset_encoding = 0;
--- a/src/pfr/pfrdrivr.c
+++ b/src/pfr/pfrdrivr.c
@@ -47,7 +47,7 @@
phys->metrics_resolution );
}
- return FT_Err_Ok;
+ return PFR_Err_Ok;
}
@@ -56,7 +56,7 @@
FT_UInt gindex,
FT_Pos *aadvance )
{
- FT_Error error = FT_Err_Bad_Argument;
+ FT_Error error = PFR_Err_Bad_Argument;
*aadvance = 0;
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -296,7 +296,7 @@
if ( load_flags & FT_LOAD_SBITS_ONLY )
{
- error = FT_Err_Invalid_Argument;
+ error = PFR_Err_Invalid_Argument;
goto Exit;
}
@@ -417,7 +417,7 @@
FT_UInt glyph2,
FT_Vector* kerning )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error = PFR_Err_Ok;
PFR_PhyFont phy_font = &face->phy_font;
PFR_KernItem item = phy_font->kern_items;
FT_UInt32 idx = PFR_KERN_INDEX( glyph1, glyph2 );
--- a/src/pfr/pfrsbit.c
+++ b/src/pfr/pfrsbit.c
@@ -508,7 +508,7 @@
default:
FT_ERROR(( "pfr_read_bitmap_data: invalid image type\n" ));
- error = FT_Err_Invalid_File_Format;
+ error = PFR_Err_Invalid_File_Format;
}
}
@@ -560,7 +560,7 @@
}
/* couldn't find it */
- return FT_Err_Invalid_Argument;
+ return PFR_Err_Invalid_Argument;
}
Found_Strike:
@@ -593,7 +593,7 @@
if ( gps_size == 0 )
{
/* Could not find a bitmap program string for this glyph */
- error = FT_Err_Invalid_Argument;
+ error = PFR_Err_Invalid_Argument;
goto Exit;
}
}
--- a/src/psaux/t1cmap.c
+++ b/src/psaux/t1cmap.c
@@ -20,7 +20,9 @@
#include FT_INTERNAL_DEBUG_H
+#include "psauxerr.h"
+
/*************************************************************************/
/*************************************************************************/
/***** *****/
@@ -320,7 +322,7 @@
{
/* there are no unicode characters in here! */
FT_FREE( cmap->pairs );
- error = FT_Err_Invalid_Argument;
+ error = PSaux_Err_Invalid_Argument;
}
else
{
--- a/src/pshinter/pshalgo.c
+++ b/src/pshinter/pshalgo.c
@@ -21,7 +21,9 @@
#include FT_INTERNAL_DEBUG_H
#include "pshalgo.h"
+#include "pshnterr.h"
+
#undef FT_COMPONENT
#define FT_COMPONENT trace_pshalgo2
@@ -1900,7 +1902,7 @@
/* something to do? */
if ( outline->n_points == 0 || outline->n_contours == 0 )
- return FT_Err_Ok;
+ return PSH_Err_Ok;
#ifdef DEBUG_HINTER
--- a/src/pshinter/pshrec.c
+++ b/src/pshinter/pshrec.c
@@ -23,6 +23,8 @@
#include "pshrec.h"
#include "pshalgo.h"
+#include "pshnterr.h"
+
#undef FT_COMPONENT
#define FT_COMPONENT trace_pshrec
@@ -820,7 +822,7 @@
break;
default:
- hints->error = FT_Err_Invalid_Argument;
+ hints->error = PSH_Err_Invalid_Argument;
hints->hint_type = hint_type;
FT_ERROR(( "ps_hints_open: invalid charstring type!\n" ));
@@ -934,7 +936,7 @@
else
{
FT_ERROR(( "ps_hints_t1stem3: called with invalid hint type!\n" ));
- error = FT_Err_Invalid_Argument;
+ error = PSH_Err_Invalid_Argument;
goto Fail;
}
}
@@ -975,7 +977,7 @@
else
{
/* invalid hint type */
- error = FT_Err_Invalid_Argument;
+ error = PSH_Err_Invalid_Argument;
goto Fail;
}
}
--- a/src/pshinter/rules.mk
+++ b/src/pshinter/rules.mk
@@ -33,7 +33,8 @@
# PSHINTER driver headers
#
-PSHINTER_DRV_H := $(PSHINTER_DRV_SRC:%c=%h)
+PSHINTER_DRV_H := $(PSHINTER_DRV_SRC:%c=%h) \
+ $(PSHINTER_DIR)/pshnterr.h
# PSHINTER driver object(s)
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -85,7 +85,7 @@
}
/* there must be exactly four hex digits */
- if ( *p == '\0' && count == 0 )
+ if ( ( *p == '\0' || *p == '.' ) && count == 0 )
return value;
}
@@ -120,7 +120,7 @@
value = ( value << 4 ) + d;
}
- if ( *p == '\0' && count <= 2 )
+ if ( ( *p == '\0' || *p == '.' ) && count <= 2 )
return value;
}
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -149,7 +149,7 @@
FT_Memory memory = face->root.memory;
TT_NameEntryRec* name = face->name_table.names + found_win;
FT_UInt len = name->stringLength / 2;
- FT_Error error = FT_Err_Ok;
+ FT_Error error = SFNT_Err_Ok;
FT_UNUSED( error );
@@ -191,7 +191,7 @@
FT_Memory memory = face->root.memory;
TT_NameEntryRec* name = face->name_table.names + found_apple;
FT_UInt len = name->stringLength;
- FT_Error error = FT_Err_Ok;
+ FT_Error error = SFNT_Err_Ok;
FT_UNUSED( error );
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -258,7 +258,7 @@
{
if ( rec->string == NULL )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error = SFNT_Err_Ok;
FT_Stream stream = face->name_table.stream;
FT_UNUSED( error );
--- a/src/sfnt/ttcmap0.c
+++ b/src/sfnt/ttcmap0.c
@@ -1807,7 +1807,7 @@
if ( p + 4 > limit )
- return FT_Err_Invalid_Table;
+ return SFNT_Err_Invalid_Table;
/* only recognize format 0 */
if ( TT_NEXT_USHORT( p ) != 0 )
@@ -1815,7 +1815,7 @@
p -= 2;
FT_ERROR(( "tt_face_build_cmaps: unsupported `cmap' table format = %d\n",
TT_PEEK_USHORT( p ) ));
- return FT_Err_Invalid_Table;
+ return SFNT_Err_Invalid_Table;
}
num_cmaps = TT_NEXT_USHORT( p );
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -235,7 +235,7 @@
return error;
Bad_Format:
- error = FT_Err_Unknown_File_Format;
+ error = SFNT_Err_Unknown_File_Format;
goto Exit;
}
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -242,11 +242,6 @@
/* A driver method used to reset a size's character sizes (horizontal */
/* and vertical) expressed in integer pixels. */
/* */
- /* <Input> */
- /* pixel_width :: The character width expressed in integer pixels. */
- /* */
- /* pixel_height :: The character height expressed in integer pixels. */
- /* */
/* <InOut> */
/* size :: A handle to the target size object. */
/* */
@@ -254,13 +249,8 @@
/* FreeType error code. 0 means success. */
/* */
static FT_Error
- Set_Pixel_Sizes( TT_Size size,
- FT_UInt pixel_width,
- FT_UInt pixel_height )
+ Set_Pixel_Sizes( TT_Size size )
{
- FT_UNUSED( pixel_width );
- FT_UNUSED( pixel_height );
-
/* many things have been pre-computed by the base layer */
size->metrics = size->root.metrics;
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1681,7 +1681,7 @@
/* return immediately if we only want the embedded bitmaps */
if ( load_flags & FT_LOAD_SBITS_ONLY )
- return FT_Err_Invalid_Argument;
+ return TT_Err_Invalid_Argument;
/* seek to the beginning of the glyph table. For Type 42 fonts */
/* the table might be accessed from a Postscript stream or something */
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -554,7 +554,7 @@
T42_Face t42face = (T42_Face)face;
- FT_Activate_Size(size->ttsize);
+ FT_Activate_Size( size->ttsize );
return FT_Set_Char_Size( t42face->ttf_face,
char_width,
@@ -573,7 +573,7 @@
T42_Face t42face = (T42_Face)face;
- FT_Activate_Size(size->ttsize);
+ FT_Activate_Size( size->ttsize );
return FT_Set_Pixel_Sizes( t42face->ttf_face,
pixel_width,
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -402,7 +402,6 @@
static FT_CMap_Class fnt_cmap_class = &fnt_cmap_class_rec;
-
static void
FNT_Face_Done( FNT_Face face )
{
@@ -495,6 +494,7 @@
{
FT_CharMapRec charmap;
+
charmap.encoding = FT_ENCODING_UNICODE;
charmap.platform_id = 3;
charmap.encoding_id = 1;
@@ -547,25 +547,41 @@
FNT_Face face = (FNT_Face)FT_SIZE_FACE( size );
FNT_Font cur = face->fonts;
FNT_Font limit = cur + face->num_fonts;
+ FNT_Font hit;
size->font = 0;
+ hit = 0;
+
for ( ; cur < limit; cur++ )
{
- /* we only compare the character height, as fonts used some strange */
- /* values */
if ( cur->header.pixel_height == size->root.metrics.y_ppem )
{
- size->font = cur;
+ hit = cur;
+ break;
+ }
+ }
- size->root.metrics.ascender = cur->header.ascent * 64;
- size->root.metrics.descender = ( cur->header.pixel_height -
- cur->header.ascent ) * 64;
- size->root.metrics.height = cur->header.pixel_height * 64;
+ /* try to find a better hit */
+ for ( ; cur < limit; cur++ )
+ {
+ if ( cur->header.pixel_height == size->root.metrics.y_ppem &&
+ cur->header.pixel_width == size->root.metrics.x_ppem )
+ {
+ hit = cur;
break;
}
}
+ if ( hit ) {
+ size->font = hit;
+ size->root.metrics.ascender = hit->header.ascent * 64;
+ size->root.metrics.descender = ( hit->header.pixel_height -
+ hit->header.ascent ) * 64;
+ size->root.metrics.height = hit->header.pixel_height * 64;
+ size->root.metrics.max_advance = hit->header.max_width * 64;
+ }
+
return ( size->font ? FNT_Err_Ok : FNT_Err_Invalid_Pixel_Size );
}
@@ -597,7 +613,8 @@
if ( glyph_index > 0 )
glyph_index--;
else
- glyph_index = font->header.default_char - font->header.first_char;
+ glyph_index = font->header.default_char;
+ glyph_index -= font->header.first_char;
new_format = FT_BOOL( font->header.version == 0x300 );
len = new_format ? 6 : 4;