ref: b8850fc1fd10dd1b5a879b7c9061734867cc658b
parent: 89ca1fd6d75edf85a093535703707f484e2e8149
author: Werner Lemberg <[email protected]>
date: Wed Jun 26 08:22:10 EDT 2013
[cff] Add darkening limit to `darkening-parameters'. * src/cff/cffdrivr.c (cff_property_set): Add check.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2013-06-25 Werner Lemberg <[email protected]>
+ [cff] Add darkening limit to `darkening-parameters'.
+
+ * src/cff/cffdrivr.c (cff_property_set): Add check.
+
+2013-06-25 Werner Lemberg <[email protected]>
+
[cff] Add `darkening-parameters' property.
* include/freetype/ftcffdrv.h: Document it.
--- a/include/freetype/ftcffdrv.h
+++ b/include/freetype/ftcffdrv.h
@@ -173,8 +173,10 @@
* }
*
* The x~values give the stem width, and the y~values the darkening
- * amount. All coordinate values must be positive and monotonically
- * increasing along the x~axis; the unit is 1000th of pixels.
+ * amount. The unit is 1000th of pixels. All coordinate values must be
+ * positive; the x~values must be monotonically increasing, and the
+ * y~values smaller than or equal to 500 (corresponding to half a
+ * pixel).
*
* @note:
* This property can be used with @FT_Property_Get also.
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -600,9 +600,10 @@
FT_Int y4 = darken_params[7];
- if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 ||
- y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 ||
- x1 > x2 || x2 > x3 || x3 > x4 )
+ if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 ||
+ y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 ||
+ x1 > x2 || x2 > x3 || x3 > x4 ||
+ y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 )
return FT_THROW( Invalid_Argument );
driver->darken_params[0] = x1;