Back out a5a5d2c176f7 (bug 882865) because of Android test failures on a CLOSED TREE
[gecko.git] / gfx / cairo / max-font-size.patch
blob99be23906ab4c7ecce990c69ecf02ccfb1a618dd
1 diff --git a/gfx/cairo/cairo/src/cairo-ft-font.c b/gfx/cairo/cairo/src/cairo-ft-font.c
2 --- a/gfx/cairo/cairo/src/cairo-ft-font.c
3 +++ b/gfx/cairo/cairo/src/cairo-ft-font.c
4 @@ -63,6 +63,10 @@
5 /* This is the max number of FT_face objects we keep open at once
6 */
7 #define MAX_OPEN_FACES 10
9 +/* This is the maximum font size we allow to be passed to FT_Set_Char_Size
10 + */
11 +#define MAX_FONT_SIZE 1000
14 * The simple 2x2 matrix is converted into separate scale and shape
15 @@ -682,9 +686,11 @@ _cairo_ft_unscaled_font_set_scale (cairo
16 FT_Set_Transform(unscaled->face, &mat, NULL);
18 if ((unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) != 0) {
19 + double x_scale = MIN(sf.x_scale, MAX_FONT_SIZE);
20 + double y_scale = MIN(sf.y_scale, MAX_FONT_SIZE);
21 error = FT_Set_Char_Size (unscaled->face,
22 - sf.x_scale * 64.0 + .5,
23 - sf.y_scale * 64.0 + .5,
24 + x_scale * 64.0 + .5,
25 + y_scale * 64.0 + .5,
26 0, 0);
27 if (error)
28 return _cairo_error (CAIRO_STATUS_NO_MEMORY);