* include/freetype/internal/sfnt.h (TT_Set_SBit_Strike_Func): Use FT_UInt for ppem values. * src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Use FT_UInt for ppem values. * src/sfnt/ttsbit.h: Updated. * src/base/ftobjs.c (FT_Set_Pixel_Sizes): Don't allow ppem values larger than -0FFFF.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
diff --git a/ChangeLog b/ChangeLog
index 8cf5a1b..7d37368 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2003-12-26 Werner Lemberg <wl@gnu.org>
+
+ * include/freetype/internal/sfnt.h (TT_Set_SBit_Strike_Func):
+ Use FT_UInt for ppem values.
+ * src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Use FT_UInt for
+ ppem values.
+ * src/sfnt/ttsbit.h: Updated.
+
+ * src/base/ftobjs.c (FT_Set_Pixel_Sizes): Don't allow ppem values
+ larger than -0FFFF.
+
2003-12-25 Werner Lemberg <wl@gnu.org>
* src/base/fttrigon.c, src/base/ftgloadr.c: Inlude
diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h
index 8c4d93b..2a9a645 100644
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -250,20 +250,27 @@ FT_BEGIN_HEADER
/* returns its metrics. */
/* */
/* <Input> */
- /* face :: The target face object. */
+ /* face :: */
+ /* The target face object. */
/* */
- /* x_ppem :: The horizontal resolution in points per EM. */
+ /* strike_index :: */
+ /* The strike index. */
/* */
- /* y_ppem :: The vertical resolution in points per EM. */
+ /* glyph_index :: */
+ /* The current glyph index. */
/* */
- /* glyph_index :: The current glyph index. */
+ /* load_flags :: */
+ /* The current load flags. */
/* */
- /* stream :: The input stream. */
+ /* stream :: */
+ /* The input stream. */
/* */
/* <Output> */
- /* amap :: The target pixmap. */
+ /* amap :: */
+ /* The target pixmap. */
/* */
- /* ametrics :: A big sbit metrics structure for the glyph image. */
+ /* ametrics :: */
+ /* A big sbit metrics structure for the glyph image. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. Returns an error if no */
@@ -307,8 +314,8 @@ FT_BEGIN_HEADER
/* */
typedef FT_Error
(*TT_Set_SBit_Strike_Func)( TT_Face face,
- FT_Int x_ppem,
- FT_Int y_ppem,
+ FT_UInt x_ppem,
+ FT_UInt y_ppem,
FT_ULong *astrike_index );
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index a7eda7a..8e02377 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2080,7 +2080,6 @@
metrics = &face->size->metrics;
clazz = driver->clazz;
- /* default processing -- this can be overridden by the driver */
if ( pixel_width == 0 )
pixel_width = pixel_height;
@@ -2092,6 +2091,12 @@
if ( pixel_height < 1 )
pixel_height = 1;
+ /* use `>=' to avoid potention compiler warning on 16bit platforms */
+ if ( pixel_width >= 0xFFFFU )
+ pixel_width = 0xFFFFU;
+ if ( pixel_height >= 0xFFFFU )
+ pixel_height = 0xFFFFU;
+
metrics->x_ppem = (FT_UShort)pixel_width;
metrics->y_ppem = (FT_UShort)pixel_height;
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index d4c16b1..4b4fd90 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -622,14 +622,14 @@
FT_LOCAL_DEF( FT_Error )
tt_face_set_sbit_strike( TT_Face face,
- FT_Int x_ppem,
- FT_Int y_ppem,
+ FT_UInt x_ppem,
+ FT_UInt y_ppem,
FT_ULong *astrike_index )
{
FT_ULong i;
- if ( x_ppem < 0 || x_ppem > 255 ||
+ if ( x_ppem > 255 ||
y_ppem < 1 || y_ppem > 255 )
return SFNT_Err_Invalid_PPem;
diff --git a/src/sfnt/ttsbit.h b/src/sfnt/ttsbit.h
index edc858a..89499bb 100644
--- a/src/sfnt/ttsbit.h
+++ b/src/sfnt/ttsbit.h
@@ -4,7 +4,7 @@
/* */
/* TrueType and OpenType embedded bitmap support (specification). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -37,8 +37,8 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error )
tt_face_set_sbit_strike( TT_Face face,
- FT_Int x_ppem,
- FT_Int y_ppem,
+ FT_UInt x_ppem,
+ FT_UInt y_ppem,
FT_ULong *astrike_index );
FT_LOCAL( FT_Error )