зеркало из https://github.com/mozilla/pjs.git
Bug 322345. Cap maximum ft2 font size at 1000 pixels to avoid killing freetype2 and/or the X server. r=vlad
This commit is contained in:
Родитель
61d1d8b7b6
Коммит
09b1f43ea9
|
@ -62,6 +62,10 @@
|
|||
*/
|
||||
#define MAX_OPEN_FACES 10
|
||||
|
||||
/* This is the maximum font size we allow to be passed to FT_Set_Char_Size
|
||||
*/
|
||||
#define MAX_FONT_SIZE 1000
|
||||
|
||||
/*
|
||||
* The simple 2x2 matrix is converted into separate scale and shape
|
||||
* factors so that hinting works right
|
||||
|
@ -643,9 +647,18 @@ _cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled,
|
|||
FT_Set_Transform(unscaled->face, &mat, NULL);
|
||||
|
||||
if ((unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) != 0) {
|
||||
double x_scale = sf.x_scale;
|
||||
double y_scale = sf.y_scale;
|
||||
if (x_scale > MAX_FONT_SIZE) {
|
||||
x_scale = MAX_FONT_SIZE;
|
||||
}
|
||||
if (y_scale > MAX_FONT_SIZE) {
|
||||
y_scale = MAX_FONT_SIZE;
|
||||
}
|
||||
|
||||
error = FT_Set_Char_Size (unscaled->face,
|
||||
sf.x_scale * 64.0,
|
||||
sf.y_scale * 64.0,
|
||||
x_scale * 64.0,
|
||||
y_scale * 64.0,
|
||||
0, 0);
|
||||
assert (error == 0);
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
|
||||
index 59a5acb..8851387 100644
|
||||
--- a/src/cairo-ft-font.c
|
||||
+++ b/src/cairo-ft-font.c
|
||||
@@ -62,6 +62,10 @@
|
||||
*/
|
||||
#define MAX_OPEN_FACES 10
|
||||
|
||||
+/* This is the maximum font size we allow to be passed to FT_Set_Char_Size
|
||||
+ */
|
||||
+#define MAX_FONT_SIZE 1000
|
||||
+
|
||||
/*
|
||||
* The simple 2x2 matrix is converted into separate scale and shape
|
||||
* factors so that hinting works right
|
||||
@@ -643,9 +647,18 @@ _cairo_ft_unscaled_font_set_scale (cairo
|
||||
FT_Set_Transform(unscaled->face, &mat, NULL);
|
||||
|
||||
if ((unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) != 0) {
|
||||
+ double x_scale = sf.x_scale;
|
||||
+ double y_scale = sf.y_scale;
|
||||
+ if (x_scale > MAX_FONT_SIZE) {
|
||||
+ x_scale = MAX_FONT_SIZE;
|
||||
+ }
|
||||
+ if (y_scale > MAX_FONT_SIZE) {
|
||||
+ y_scale = MAX_FONT_SIZE;
|
||||
+ }
|
||||
+
|
||||
error = FT_Set_Char_Size (unscaled->face,
|
||||
- sf.x_scale * 64.0,
|
||||
- sf.y_scale * 64.0,
|
||||
+ x_scale * 64.0,
|
||||
+ y_scale * 64.0,
|
||||
0, 0);
|
||||
assert (error == 0);
|
||||
} else {
|
Загрузка…
Ссылка в новой задаче