mirror of
https://github.com/rn10950/RetroZilla.git
synced 2024-11-14 19:50:12 +01:00
81 lines
2.7 KiB
Diff
81 lines
2.7 KiB
Diff
|
Index: gfx/cairo/cairo/src/cairo-ft-font.c
|
||
|
===================================================================
|
||
|
RCS file: /home/rocallahan/mozilla-cvs-mirror/mozilla/gfx/cairo/cairo/src/cairo-ft-font.c,v
|
||
|
retrieving revision 1.1.4.2
|
||
|
diff -u -t -p -1 -2 -r1.1.4.2 cairo-ft-font.c
|
||
|
--- gfx/cairo/cairo/src/cairo-ft-font.c 4 Oct 2005 03:28:22 -0000 1.1.4.2
|
||
|
+++ gfx/cairo/cairo/src/cairo-ft-font.c 30 Nov 2006 01:59:23 -0000
|
||
|
@@ -66,24 +66,28 @@
|
||
|
#define PRIVATE_FLAG_HINT_METRICS (0x01 << 24)
|
||
|
#define PRIVATE_FLAG_EMBOLDEN (0x02 << 24)
|
||
|
#define PRIVATE_FLAGS_MASK (0xff << 24)
|
||
|
|
||
|
/* This is the max number of FT_face objects we keep open at once
|
||
|
*/
|
||
|
#define MAX_OPEN_FACES 10
|
||
|
|
||
|
/* This is the max number of FT_face objects we keep open at once
|
||
|
*/
|
||
|
#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
|
||
|
*/
|
||
|
|
||
|
typedef struct _cairo_ft_font_transform {
|
||
|
double x_scale, y_scale;
|
||
|
double shape[2][2];
|
||
|
} cairo_ft_font_transform_t;
|
||
|
|
||
|
/*
|
||
|
* We create an object that corresponds to a single font on the disk;
|
||
|
@@ -627,29 +631,39 @@ _cairo_ft_unscaled_font_set_scale (cairo
|
||
|
mat.yx = - DOUBLE_TO_16_16(sf.shape[0][1]);
|
||
|
mat.xy = - DOUBLE_TO_16_16(sf.shape[1][0]);
|
||
|
mat.yy = DOUBLE_TO_16_16(sf.shape[1][1]);
|
||
|
|
||
|
unscaled->have_shape = (mat.xx != 0x10000 ||
|
||
|
mat.yx != 0x00000 ||
|
||
|
mat.xy != 0x00000 ||
|
||
|
mat.yy != 0x10000);
|
||
|
|
||
|
FT_Set_Transform(unscaled->face, &mat, NULL);
|
||
|
|
||
|
if ((unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) != 0) {
|
||
|
- pixel_width = sf.x_scale;
|
||
|
- pixel_height = sf.y_scale;
|
||
|
+ 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;
|
||
|
+ }
|
||
|
+
|
||
|
+ pixel_width = x_scale;
|
||
|
+ pixel_height = y_scale;
|
||
|
+
|
||
|
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);
|
||
|
} else {
|
||
|
double min_distance = DBL_MAX;
|
||
|
int i;
|
||
|
int best_i = 0;
|
||
|
|
||
|
pixel_width = pixel_height = 0;
|
||
|
|
||
|
for (i = 0; i < unscaled->face->num_fixed_sizes; i++) {
|
||
|
#if HAVE_FT_BITMAP_SIZE_Y_PPEM
|
||
|
double size = unscaled->face->available_sizes[i].y_ppem / 64.;
|
||
|
#else
|