ref: cb8ede4dca7e9cd1b43d2955f9199a79634c7f79
parent: 80cfbd7073992c8e914c11378364261c3f9d1ddd
author: Werner Lemberg <[email protected]>
date: Sat Dec 27 16:44:18 EST 2003
* 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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2003-12-26 Werner Lemberg <[email protected]>
+
+ * 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 <[email protected]>
* src/base/fttrigon.c, src/base/ftgloadr.c: Inlude
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -250,20 +250,27 @@
/* 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 @@
/* */
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 );
--- 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;
@@ -2091,6 +2090,12 @@
pixel_width = 1;
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;
--- 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;
--- 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_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 )