diff --git a/cairo-1.8.6.tar.bz2 b/cairo-1.8.6.tar.bz2 deleted file mode 100644 index 62b6ac5..0000000 --- a/cairo-1.8.6.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5dadecd3cbac523d4f58a2b405e5470a0bea85837bd9ac93a35e1fc3f2048d64 -size 5367354 diff --git a/cairo-1.9.2.tar.bz2 b/cairo-1.9.2.tar.bz2 new file mode 100644 index 0000000..0c5562a --- /dev/null +++ b/cairo-1.9.2.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b1a90c6f6d3f23bfd299b988b63de48551e5b1455b7d87119f05ad8d4598316 +size 9580159 diff --git a/cairo-lcd-filter-fdo10301.patch b/cairo-lcd-filter-fdo10301.patch deleted file mode 100644 index 41805ae..0000000 --- a/cairo-lcd-filter-fdo10301.patch +++ /dev/null @@ -1,1354 +0,0 @@ -Index: cairo-1.8.6/src/cairo-font-options.c -=================================================================== ---- cairo-1.8.6.orig/src/cairo-font-options.c -+++ cairo-1.8.6/src/cairo-font-options.c -@@ -39,6 +39,7 @@ - static const cairo_font_options_t _cairo_font_options_nil = { - CAIRO_ANTIALIAS_DEFAULT, - CAIRO_SUBPIXEL_ORDER_DEFAULT, -+ CAIRO_LCD_FILTER_DEFAULT, - CAIRO_HINT_STYLE_DEFAULT, - CAIRO_HINT_METRICS_DEFAULT - }; -@@ -54,6 +55,7 @@ _cairo_font_options_init_default (cairo_ - { - options->antialias = CAIRO_ANTIALIAS_DEFAULT; - options->subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT; -+ options->lcd_filter = CAIRO_LCD_FILTER_DEFAULT; - options->hint_style = CAIRO_HINT_STYLE_DEFAULT; - options->hint_metrics = CAIRO_HINT_METRICS_DEFAULT; - } -@@ -64,6 +66,7 @@ _cairo_font_options_init_copy (cairo_fon - { - options->antialias = other->antialias; - options->subpixel_order = other->subpixel_order; -+ options->lcd_filter = other->lcd_filter; - options->hint_style = other->hint_style; - options->hint_metrics = other->hint_metrics; - } -@@ -189,6 +192,8 @@ cairo_font_options_merge (cairo_font_opt - options->antialias = other->antialias; - if (other->subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT) - options->subpixel_order = other->subpixel_order; -+ if (other->lcd_filter != CAIRO_LCD_FILTER_DEFAULT) -+ options->lcd_filter = other->lcd_filter; - if (other->hint_style != CAIRO_HINT_STYLE_DEFAULT) - options->hint_style = other->hint_style; - if (other->hint_metrics != CAIRO_HINT_METRICS_DEFAULT) -@@ -221,6 +226,7 @@ cairo_font_options_equal (const cairo_fo - - return (options->antialias == other->antialias && - options->subpixel_order == other->subpixel_order && -+ options->lcd_filter == other->lcd_filter && - options->hint_style == other->hint_style && - options->hint_metrics == other->hint_metrics); - } -@@ -246,7 +252,8 @@ cairo_font_options_hash (const cairo_fon - - return ((options->antialias) | - (options->subpixel_order << 4) | -- (options->hint_style << 8) | -+ (options->lcd_filter << 8) | -+ (options->hint_style << 12) | - (options->hint_metrics << 16)); - } - slim_hidden_def (cairo_font_options_hash); -@@ -328,6 +335,48 @@ cairo_font_options_get_subpixel_order (c - } - - /** -+ * _cairo_font_options_set_lcd_filter: -+ * @options: a #cairo_font_options_t -+ * @lcd_filter: the new LCD filter -+ * -+ * Sets the LCD filter for the font options object. The LCD filter -+ * specifies how pixels are filtered when rendered with an antialiasing -+ * mode of %CAIRO_ANTIALIAS_SUBPIXEL. See the documentation for -+ * #cairo_lcd_filter_t for full details. -+ * -+ * Since: 1.8 -+ **/ -+void -+_cairo_font_options_set_lcd_filter (cairo_font_options_t *options, -+ cairo_lcd_filter_t lcd_filter) -+{ -+ if (cairo_font_options_status (options)) -+ return; -+ -+ options->lcd_filter = lcd_filter; -+} -+ -+/** -+ * _cairo_font_options_get_lcd_filter: -+ * @options: a #cairo_font_options_t -+ * -+ * Gets the LCD filter for the font options object. -+ * See the documentation for #cairo_lcd_filter_t for full details. -+ * -+ * Return value: the LCD filter for the font options object -+ * -+ * Since: 1.8 -+ **/ -+cairo_lcd_filter_t -+_cairo_font_options_get_lcd_filter (const cairo_font_options_t *options) -+{ -+ if (cairo_font_options_status ((cairo_font_options_t *) options)) -+ return CAIRO_LCD_FILTER_DEFAULT; -+ -+ return options->lcd_filter; -+} -+ -+/** - * cairo_font_options_set_hint_style: - * @options: a #cairo_font_options_t - * @hint_style: the new hint style -Index: cairo-1.8.6/src/cairo-ft-font.c -=================================================================== ---- cairo-1.8.6.orig/src/cairo-ft-font.c -+++ cairo-1.8.6/src/cairo-ft-font.c -@@ -57,6 +57,30 @@ - #include FT_SYNTHESIS_H - #endif - -+#if HAVE_FT_LIBRARY_SETLCDFILTER -+#include FT_LCD_FILTER_H -+#endif -+ -+/* Fontconfig version older than 2.6 didn't have these options */ -+#ifndef FC_LCD_FILTER -+#define FC_LCD_FILTER "lcdfilter" -+#endif -+/* Some Ubuntu versions defined FC_LCD_FILTER without defining the following */ -+#ifndef FC_LCD_NONE -+#define FC_LCD_NONE 0 -+#define FC_LCD_DEFAULT 1 -+#define FC_LCD_LIGHT 2 -+#define FC_LCD_LEGACY 3 -+#endif -+ -+/* FreeType version older than 2.3.5(?) didn't have these options */ -+#ifndef FT_LCD_FILTER_NONE -+#define FT_LCD_FILTER_NONE 0 -+#define FT_LCD_FILTER_DEFAULT 1 -+#define FT_LCD_FILTER_LIGHT 2 -+#define FT_LCD_FILTER_LEGACY 16 -+#endif -+ - #define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0)) - #define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0) - #define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0)) -@@ -156,6 +180,25 @@ typedef struct _cairo_ft_unscaled_font_m - int num_open_faces; - } cairo_ft_unscaled_font_map_t; - -+static cairo_bool_t _ft_can_lcd_filter (void) { -+#if HAVE_FT_LIBRARY_SETLCDFILTER -+ FT_Library library; -+ FT_Error fterror; -+ -+ FT_Init_FreeType(&library); -+ fterror = FT_Library_SetLcdFilter(library, FT_LCD_FILTER_DEFAULT); -+ -+ if (fterror != FT_Err_Unimplemented_Feature) -+ return TRUE; -+ else -+ return FALSE; -+ -+ FT_Done_FreeType(library); -+#else -+ return FALSE; -+#endif -+} -+ - static cairo_ft_unscaled_font_map_t *cairo_ft_unscaled_font_map = NULL; - - static void -@@ -737,6 +780,282 @@ _cairo_ft_unscaled_font_set_scale (cairo - return CAIRO_STATUS_SUCCESS; - } - -+/* we sometimes need to convert the glyph bitmap in a FT_GlyphSlot -+ * into a different format. For example, we want to convert a -+ * FT_PIXEL_MODE_LCD or FT_PIXEL_MODE_LCD_V bitmap into a 32-bit -+ * ARGB or ABGR bitmap. -+ * -+ * this function prepares a target descriptor for this operation. -+ * -+ * input :: target bitmap descriptor. The function will set its -+ * 'width', 'rows' and 'pitch' fields, and only these -+ * -+ * slot :: the glyph slot containing the source bitmap. this -+ * function assumes that slot->format == FT_GLYPH_FORMAT_BITMAP -+ * -+ * mode :: the requested final rendering mode. supported values are -+ * MONO, NORMAL (i.e. gray), LCD and LCD_V -+ * -+ * the function returns the size in bytes of the corresponding buffer, -+ * it's up to the caller to allocate the corresponding memory block -+ * before calling _fill_xrender_bitmap -+ * -+ * it also returns -1 in case of error (e.g. incompatible arguments, -+ * like trying to convert a gray bitmap into a monochrome one) -+ */ -+static int -+_compute_xrender_bitmap_size(FT_Bitmap *target, -+ FT_GlyphSlot slot, -+ FT_Render_Mode mode) -+{ -+ FT_Bitmap *ftbit; -+ int width, height, pitch; -+ -+ if (slot->format != FT_GLYPH_FORMAT_BITMAP) -+ return -1; -+ -+ /* compute the size of the final bitmap */ -+ ftbit = &slot->bitmap; -+ -+ width = ftbit->width; -+ height = ftbit->rows; -+ pitch = (width + 3) & ~3; -+ -+ switch (ftbit->pixel_mode) { -+ case FT_PIXEL_MODE_MONO: -+ if (mode == FT_RENDER_MODE_MONO) { -+ pitch = (((width + 31) & ~31) >> 3); -+ break; -+ } -+ /* fall-through */ -+ -+ case FT_PIXEL_MODE_GRAY: -+ if (mode == FT_RENDER_MODE_LCD || -+ mode == FT_RENDER_MODE_LCD_V) -+ { -+ /* each pixel is replicated into a 32-bit ARGB value */ -+ pitch = width * 4; -+ } -+ break; -+ -+ case FT_PIXEL_MODE_LCD: -+ if (mode != FT_RENDER_MODE_LCD) -+ return -1; -+ -+ /* horz pixel triplets are packed into 32-bit ARGB values */ -+ width /= 3; -+ pitch = width * 4; -+ break; -+ -+ case FT_PIXEL_MODE_LCD_V: -+ if (mode != FT_RENDER_MODE_LCD_V) -+ return -1; -+ -+ /* vert pixel triplets are packed into 32-bit ARGB values */ -+ height /= 3; -+ pitch = width * 4; -+ break; -+ -+ default: /* unsupported source format */ -+ return -1; -+ } -+ -+ target->width = width; -+ target->rows = height; -+ target->pitch = pitch; -+ target->buffer = NULL; -+ -+ return pitch * height; -+} -+ -+/* this functions converts the glyph bitmap found in a FT_GlyphSlot -+ * into a different format (see _compute_xrender_bitmap_size) -+ * -+ * you should call this function after _compute_xrender_bitmap_size -+ * -+ * target :: target bitmap descriptor. Note that its 'buffer' pointer -+ * must point to memory allocated by the caller -+ * -+ * slot :: the glyph slot containing the source bitmap -+ * -+ * mode :: the requested final rendering mode -+ * -+ * bgr :: boolean, set if BGR or VBGR pixel ordering is needed -+ */ -+static void -+_fill_xrender_bitmap(FT_Bitmap *target, -+ FT_GlyphSlot slot, -+ FT_Render_Mode mode, -+ int bgr) -+{ -+ FT_Bitmap *ftbit = &slot->bitmap; -+ unsigned char *srcLine = ftbit->buffer; -+ unsigned char *dstLine = target->buffer; -+ int src_pitch = ftbit->pitch; -+ int width = target->width; -+ int height = target->rows; -+ int pitch = target->pitch; -+ int subpixel; -+ int h; -+ -+ subpixel = (mode == FT_RENDER_MODE_LCD || -+ mode == FT_RENDER_MODE_LCD_V); -+ -+ if (src_pitch < 0) -+ srcLine -= src_pitch * (ftbit->rows - 1); -+ -+ target->pixel_mode = ftbit->pixel_mode; -+ -+ switch (ftbit->pixel_mode) { -+ case FT_PIXEL_MODE_MONO: -+ if (subpixel) { -+ /* convert mono to ARGB32 values */ -+ -+ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) { -+ int x; -+ -+ for (x = 0; x < width; x++) { -+ if (srcLine[(x >> 3)] & (0x80 >> (x & 7))) -+ ((unsigned int *) dstLine)[x] = 0xffffffffU; -+ } -+ } -+ target->pixel_mode = FT_PIXEL_MODE_LCD; -+ -+ } else if (mode == FT_RENDER_MODE_NORMAL) { -+ /* convert mono to 8-bit gray */ -+ -+ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) { -+ int x; -+ -+ for (x = 0; x < width; x++) { -+ if (srcLine[(x >> 3)] & (0x80 >> (x & 7))) -+ dstLine[x] = 0xff; -+ } -+ } -+ target->pixel_mode = FT_PIXEL_MODE_GRAY; -+ -+ } else { -+ /* copy mono to mono */ -+ -+ int bytes = (width + 7) >> 3; -+ -+ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) -+ memcpy (dstLine, srcLine, bytes); -+ } -+ break; -+ -+ case FT_PIXEL_MODE_GRAY: -+ if (subpixel) { -+ /* convert gray to ARGB32 values */ -+ -+ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) { -+ int x; -+ unsigned int *dst = (unsigned int *) dstLine; -+ -+ for (x = 0; x < width; x++) { -+ unsigned int pix = srcLine[x]; -+ -+ pix |= (pix << 8); -+ pix |= (pix << 16); -+ -+ dst[x] = pix; -+ } -+ } -+ target->pixel_mode = FT_PIXEL_MODE_LCD; -+ } else { -+ /* copy gray into gray */ -+ -+ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) -+ memcpy (dstLine, srcLine, width); -+ } -+ break; -+ -+ case FT_PIXEL_MODE_LCD: -+ if (!bgr) { -+ /* convert horizontal RGB into ARGB32 */ -+ -+ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) { -+ int x; -+ unsigned char *src = srcLine; -+ unsigned int *dst = (unsigned int *) dstLine; -+ -+ for (x = 0; x < width; x++, src += 3) { -+ unsigned int pix; -+ -+ pix = ((unsigned int)src[0] << 16) | -+ ((unsigned int)src[1] << 8) | -+ ((unsigned int)src[2] ) | -+ ((unsigned int)src[1] << 24) ; -+ -+ dst[x] = pix; -+ } -+ } -+ } else { -+ /* convert horizontal BGR into ARGB32 */ -+ -+ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) { -+ -+ int x; -+ unsigned char *src = srcLine; -+ unsigned int *dst = (unsigned int *) dstLine; -+ -+ for (x = 0; x < width; x++, src += 3) { -+ unsigned int pix; -+ -+ pix = ((unsigned int)src[2] << 16) | -+ ((unsigned int)src[1] << 8) | -+ ((unsigned int)src[0] ) | -+ ((unsigned int)src[1] << 24) ; -+ -+ dst[x] = pix; -+ } -+ } -+ } -+ break; -+ -+ default: /* FT_PIXEL_MODE_LCD_V */ -+ /* convert vertical RGB into ARGB32 */ -+ if (!bgr) { -+ -+ for (h = height; h > 0; h--, srcLine += 3 * src_pitch, dstLine += pitch) { -+ int x; -+ unsigned char* src = srcLine; -+ unsigned int* dst = (unsigned int *) dstLine; -+ -+ for (x = 0; x < width; x++, src += 1) { -+ unsigned int pix; -+ -+ pix = ((unsigned int)src[0] << 16) | -+ ((unsigned int)src[src_pitch] << 8) | -+ ((unsigned int)src[src_pitch*2] ) | -+ ((unsigned int)src[src_pitch] << 24) ; -+ -+ dst[x] = pix; -+ } -+ } -+ } else { -+ -+ for (h = height; h > 0; h--, srcLine += 3*src_pitch, dstLine += pitch) { -+ int x; -+ unsigned char *src = srcLine; -+ unsigned int *dst = (unsigned int *) dstLine; -+ -+ for (x = 0; x < width; x++, src += 1) { -+ unsigned int pix; -+ -+ pix = ((unsigned int)src[src_pitch * 2] << 16) | -+ ((unsigned int)src[src_pitch] << 8) | -+ ((unsigned int)src[0] ) | -+ ((unsigned int)src[src_pitch] << 24) ; -+ -+ dst[x] = pix; -+ } -+ } -+ } -+ } -+} -+ -+ - /* Empirically-derived subpixel filtering values thanks to Keith - * Packard and libXft. */ - static const int filters[3][3] = { -@@ -766,7 +1085,6 @@ _get_bitmap_surface (FT_Bitmap *bi - int width, height, stride; - unsigned char *data; - int format = CAIRO_FORMAT_A8; -- cairo_bool_t subpixel = FALSE; - - width = bitmap->width; - height = bitmap->rows; -@@ -808,7 +1126,7 @@ _get_bitmap_surface (FT_Bitmap *bi - - #ifndef WORDS_BIGENDIAN - { -- uint8_t *d = data; -+ uint8_t *d = data; - int count = stride * height; - - while (count--) { -@@ -835,108 +1153,115 @@ _get_bitmap_surface (FT_Bitmap *bi - data = _cairo_malloc_ab (height, stride); - if (!data) - return _cairo_error (CAIRO_STATUS_NO_MEMORY); -- - memcpy (data, bitmap->buffer, stride * height); - } -- format = CAIRO_FORMAT_A8; -- break; -- case CAIRO_ANTIALIAS_SUBPIXEL: { -- int x, y; -- unsigned char *in_line, *out_line, *in; -- unsigned int *out; -- unsigned int red, green, blue; -- int rf, gf, bf; -- int s; -- int o, os; -- unsigned char *data_rgba; -- unsigned int width_rgba, stride_rgba; -- int vmul = 1; -- int hmul = 1; -- -- switch (font_options->subpixel_order) { -- case CAIRO_SUBPIXEL_ORDER_DEFAULT: -- case CAIRO_SUBPIXEL_ORDER_RGB: -- case CAIRO_SUBPIXEL_ORDER_BGR: -- default: -- width /= 3; -- hmul = 3; -- break; -- case CAIRO_SUBPIXEL_ORDER_VRGB: -- case CAIRO_SUBPIXEL_ORDER_VBGR: -- vmul = 3; -- height /= 3; -- break; -- } -- /* -- * Filter the glyph to soften the color fringes -- */ -- width_rgba = width; -- stride = bitmap->pitch; -- stride_rgba = (width_rgba * 4 + 3) & ~3; -- data_rgba = calloc (stride_rgba, height); -- if (data_rgba == NULL) { -- if (own_buffer) -+ format = CAIRO_FORMAT_A8; -+ break; -+ case CAIRO_ANTIALIAS_SUBPIXEL: -+ if (_ft_can_lcd_filter()) { -+ /* if we get there, the data from the source bitmap -+ * really comes from _fill_xrender_bitmap, and is -+ * made of 32-bit ARGB or ABGR values */ -+ assert (own_buffer != 0); -+ assert (bitmap->pixel_mode != FT_PIXEL_MODE_GRAY); -+ -+ data = bitmap->buffer; -+ stride = bitmap->pitch; -+ format = CAIRO_FORMAT_ARGB32; -+ } else { -+ int x, y; -+ unsigned char *in_line, *out_line, *in; -+ unsigned int *out; -+ unsigned int red, green, blue; -+ int rf, gf, bf; -+ int s; -+ int o, os; -+ unsigned char *data_rgba; -+ unsigned int width_rgba, stride_rgba; -+ int vmul = 1; -+ int hmul = 1; -+ -+ switch (font_options->subpixel_order) { -+ case CAIRO_SUBPIXEL_ORDER_DEFAULT: -+ case CAIRO_SUBPIXEL_ORDER_RGB: -+ case CAIRO_SUBPIXEL_ORDER_BGR: -+ default: -+ width /= 3; -+ hmul = 3; -+ break; -+ case CAIRO_SUBPIXEL_ORDER_VRGB: -+ case CAIRO_SUBPIXEL_ORDER_VBGR: -+ vmul = 3; -+ height /= 3; -+ break; -+ } -+ /* -+ * Filter the glyph to soften the color fringes -+ */ -+ width_rgba = width; -+ stride = bitmap->pitch; -+ stride_rgba = (width_rgba * 4 + 3) & ~3; -+ data_rgba = calloc (stride_rgba, height); -+ if (data_rgba == NULL) { -+ if (own_buffer) - free (bitmap->buffer); -- return _cairo_error (CAIRO_STATUS_NO_MEMORY); -- } -+ return _cairo_error (CAIRO_STATUS_NO_MEMORY); -+ } - -- os = 1; -- switch (font_options->subpixel_order) { -- case CAIRO_SUBPIXEL_ORDER_VRGB: -- os = stride; -- case CAIRO_SUBPIXEL_ORDER_DEFAULT: -- case CAIRO_SUBPIXEL_ORDER_RGB: -- default: -- rf = 0; -- gf = 1; -- bf = 2; -- break; -- case CAIRO_SUBPIXEL_ORDER_VBGR: -- os = stride; -- case CAIRO_SUBPIXEL_ORDER_BGR: -- bf = 0; -- gf = 1; -- rf = 2; -- break; -- } -- in_line = bitmap->buffer; -- out_line = data_rgba; -- for (y = 0; y < height; y++) -- { -- in = in_line; -- out = (unsigned int *) out_line; -- in_line += stride * vmul; -- out_line += stride_rgba; -- for (x = 0; x < width * hmul; x += hmul) -- { -- red = green = blue = 0; -- o = 0; -- for (s = 0; s < 3; s++) -- { -- red += filters[rf][s]*in[x+o]; -- green += filters[gf][s]*in[x+o]; -- blue += filters[bf][s]*in[x+o]; -- o += os; -- } -- red = red / 65536; -- green = green / 65536; -- blue = blue / 65536; -- *out++ = (green << 24) | (red << 16) | (green << 8) | blue; -- } -- } -- -- /* Images here are stored in native format. The -- * backend must convert to its own format as needed -- */ -- -- if (own_buffer) -+ os = 1; -+ switch (font_options->subpixel_order) { -+ case CAIRO_SUBPIXEL_ORDER_VRGB: -+ os = stride; -+ case CAIRO_SUBPIXEL_ORDER_DEFAULT: -+ case CAIRO_SUBPIXEL_ORDER_RGB: -+ default: -+ rf = 0; -+ gf = 1; -+ bf = 2; -+ break; -+ case CAIRO_SUBPIXEL_ORDER_VBGR: -+ os = stride; -+ case CAIRO_SUBPIXEL_ORDER_BGR: -+ bf = 0; -+ gf = 1; -+ rf = 2; -+ break; -+ } -+ in_line = bitmap->buffer; -+ out_line = data_rgba; -+ for (y = 0; y < height; y++) -+ { -+ in = in_line; -+ out = (unsigned int *) out_line; -+ in_line += stride * vmul; -+ out_line += stride_rgba; -+ for (x = 0; x < width * hmul; x += hmul) -+ { -+ red = green = blue = 0; -+ o = 0; -+ for (s = 0; s < 3; s++) -+ { -+ red += filters[rf][s]*in[x+o]; -+ green += filters[gf][s]*in[x+o]; -+ blue += filters[bf][s]*in[x+o]; -+ o += os; -+ } -+ red = red / 65536; -+ green = green / 65536; -+ blue = blue / 65536; -+ *out++ = (green << 24) | (red << 16) | (green << 8) | blue; -+ } -+ } -+ -+ /* Images here are stored in native format. The -+ * backend must convert to its own format as needed -+ */ -+ if (own_buffer) - free (bitmap->buffer); -- data = data_rgba; -- stride = stride_rgba; -- format = CAIRO_FORMAT_ARGB32; -- subpixel = TRUE; -- break; -- } -+ data = data_rgba; -+ stride = stride_rgba; -+ format = CAIRO_FORMAT_ARGB32; -+ } - } - break; - case FT_PIXEL_MODE_GRAY2: -@@ -957,7 +1282,7 @@ _get_bitmap_surface (FT_Bitmap *bi - return (*surface)->base.status; - } - -- if (subpixel) -+ if (font_options->antialias == CAIRO_ANTIALIAS_SUBPIXEL) - pixman_image_set_component_alpha ((*surface)->pixman_image, TRUE); - - _cairo_image_surface_assume_ownership_of_data ((*surface)); -@@ -985,16 +1310,67 @@ _render_glyph_outline (FT_Face - cairo_font_options_t *font_options, - cairo_image_surface_t **surface) - { -+ int rgba = FC_RGBA_UNKNOWN; -+ int lcd_filter = FT_LCD_FILTER_LEGACY; - FT_GlyphSlot glyphslot = face->glyph; - FT_Outline *outline = &glyphslot->outline; - FT_Bitmap bitmap; - FT_BBox cbox; -- FT_Matrix matrix; -- int hmul = 1; -- int vmul = 1; -- unsigned int width, height, stride; -- cairo_bool_t subpixel = FALSE; -+ unsigned int width, height; -+ double device_offset_left, device_offset_top; - cairo_status_t status; -+ cairo_bool_t ft_can_filter = FALSE; -+ FT_Error fterror; -+ FT_Library library = glyphslot->library; -+ FT_Render_Mode render_mode = FT_RENDER_MODE_NORMAL; -+ -+#if HAVE_FT_LIBRARY_SETLCDFILTER -+ fterror = FT_Library_SetLcdFilter (library, FT_LCD_FILTER_NONE); -+ if(fterror != FT_Err_Unimplemented_Feature) -+ ft_can_filter = TRUE; -+#endif -+ -+ switch (font_options->antialias) { -+ case CAIRO_ANTIALIAS_NONE: -+ render_mode = FT_RENDER_MODE_MONO; -+ break; -+ case CAIRO_ANTIALIAS_SUBPIXEL: -+ switch (font_options->lcd_filter) { -+ case CAIRO_LCD_FILTER_NONE: -+ lcd_filter = FT_LCD_FILTER_NONE; -+ break; -+ case CAIRO_LCD_FILTER_DEFAULT: -+ case CAIRO_LCD_FILTER_INTRA_PIXEL: -+ lcd_filter = FT_LCD_FILTER_LEGACY; -+ break; -+ case CAIRO_LCD_FILTER_FIR3: -+ lcd_filter = FT_LCD_FILTER_LIGHT; -+ break; -+ case CAIRO_LCD_FILTER_FIR5: -+ lcd_filter = FT_LCD_FILTER_DEFAULT; -+ break; -+ } -+ -+ if (ft_can_filter) { -+ switch (font_options->subpixel_order) { -+ case CAIRO_SUBPIXEL_ORDER_DEFAULT: -+ case CAIRO_SUBPIXEL_ORDER_RGB: -+ case CAIRO_SUBPIXEL_ORDER_BGR: -+ render_mode = FT_RENDER_MODE_LCD; -+ break; -+ -+ case CAIRO_SUBPIXEL_ORDER_VRGB: -+ case CAIRO_SUBPIXEL_ORDER_VBGR: -+ render_mode = FT_RENDER_MODE_LCD_V; -+ break; -+ } -+ } -+ -+ break; -+ case CAIRO_ANTIALIAS_DEFAULT: -+ case CAIRO_ANTIALIAS_GRAY: -+ render_mode = FT_RENDER_MODE_NORMAL; -+ } - - FT_Outline_Get_CBox (outline, &cbox); - -@@ -1005,20 +1381,21 @@ _render_glyph_outline (FT_Face - - width = (unsigned int) ((cbox.xMax - cbox.xMin) >> 6); - height = (unsigned int) ((cbox.yMax - cbox.yMin) >> 6); -- stride = (width * hmul + 3) & ~3; - - if (width * height == 0) { - cairo_format_t format; - /* Looks like fb handles zero-sized images just fine */ -- switch (font_options->antialias) { -- case CAIRO_ANTIALIAS_NONE: -+ switch (render_mode) { -+ case FT_RENDER_MODE_MONO: - format = CAIRO_FORMAT_A1; - break; -- case CAIRO_ANTIALIAS_SUBPIXEL: -+ case FT_RENDER_MODE_LCD: -+ case FT_RENDER_MODE_LCD_V: - format= CAIRO_FORMAT_ARGB32; - break; -- case CAIRO_ANTIALIAS_DEFAULT: -- case CAIRO_ANTIALIAS_GRAY: -+ case FT_RENDER_MODE_LIGHT: -+ case FT_RENDER_MODE_NORMAL: -+ case FT_RENDER_MODE_MAX: - default: - format = CAIRO_FORMAT_A8; - break; -@@ -1028,75 +1405,134 @@ _render_glyph_outline (FT_Face - cairo_image_surface_create_for_data (NULL, format, 0, 0, 0); - if ((*surface)->base.status) - return (*surface)->base.status; -- } else { -- -- matrix.xx = matrix.yy = 0x10000L; -- matrix.xy = matrix.yx = 0; -- -- switch (font_options->antialias) { -- case CAIRO_ANTIALIAS_NONE: -- bitmap.pixel_mode = FT_PIXEL_MODE_MONO; -- bitmap.num_grays = 1; -- stride = ((width + 31) & -32) >> 3; -- break; -- case CAIRO_ANTIALIAS_DEFAULT: -- case CAIRO_ANTIALIAS_GRAY: -- bitmap.pixel_mode = FT_PIXEL_MODE_GRAY; -- bitmap.num_grays = 256; -- stride = (width + 3) & -4; -- break; -- case CAIRO_ANTIALIAS_SUBPIXEL: -- switch (font_options->subpixel_order) { -- case CAIRO_SUBPIXEL_ORDER_RGB: -- case CAIRO_SUBPIXEL_ORDER_BGR: -- case CAIRO_SUBPIXEL_ORDER_DEFAULT: -- default: -- matrix.xx *= 3; -- hmul = 3; -- subpixel = TRUE; -- break; -- case CAIRO_SUBPIXEL_ORDER_VRGB: -- case CAIRO_SUBPIXEL_ORDER_VBGR: -- matrix.yy *= 3; -- vmul = 3; -- subpixel = TRUE; -- break; -- } -- FT_Outline_Transform (outline, &matrix); -- -- bitmap.pixel_mode = FT_PIXEL_MODE_GRAY; -- bitmap.num_grays = 256; -- stride = (width * hmul + 3) & -4; -- } -- -- bitmap.pitch = stride; -- bitmap.width = width * hmul; -- bitmap.rows = height * vmul; -- bitmap.buffer = calloc (stride, bitmap.rows); -- if (bitmap.buffer == NULL) -- return _cairo_error (CAIRO_STATUS_NO_MEMORY); -- -- FT_Outline_Translate (outline, -cbox.xMin*hmul, -cbox.yMin*vmul); -- -- if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) { -- free (bitmap.buffer); -- return _cairo_error (CAIRO_STATUS_NO_MEMORY); -- } -- -+ } else { -+ int bitmap_size; -+ if (ft_can_filter) { -+ switch (render_mode) { -+ case FT_RENDER_MODE_LCD: -+ if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_BGR) { -+ rgba = FC_RGBA_BGR; -+ } else { -+ rgba = FC_RGBA_RGB; -+ } -+ break; -+ case FT_RENDER_MODE_LCD_V: -+ if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_VBGR) { -+ rgba = FC_RGBA_VBGR; -+ } else { -+ rgba = FC_RGBA_VRGB; -+ } -+ break; -+ case FT_RENDER_MODE_MONO: -+ case FT_RENDER_MODE_LIGHT: -+ case FT_RENDER_MODE_NORMAL: -+ case FT_RENDER_MODE_MAX: -+ default: -+ break; -+ } -+ -+ #if HAVE_FT_LIBRARY_SETLCDFILTER -+ FT_Library_SetLcdFilter (library, lcd_filter); -+ #endif -+ -+ fterror = FT_Render_Glyph (face->glyph, render_mode); -+ -+ #if HAVE_FT_LIBRARY_SETLCDFILTER -+ FT_Library_SetLcdFilter (library, FT_LCD_FILTER_NONE); -+ #endif -+ -+ if (fterror != 0) -+ return _cairo_error (CAIRO_STATUS_NO_MEMORY); -+ -+ bitmap_size = _compute_xrender_bitmap_size (&bitmap, -+ face->glyph, -+ render_mode); -+ if (bitmap_size < 0) -+ return _cairo_error (CAIRO_STATUS_NO_MEMORY); -+ -+ bitmap.buffer = calloc (1, bitmap_size); -+ if (bitmap.buffer == NULL) -+ return _cairo_error (CAIRO_STATUS_NO_MEMORY); -+ -+ _fill_xrender_bitmap (&bitmap, face->glyph, render_mode, -+ (rgba == FC_RGBA_BGR || rgba == FC_RGBA_VBGR)); -+ -+ device_offset_left = (double)-glyphslot->bitmap_left; -+ device_offset_top = (double)+glyphslot->bitmap_top; -+ } else { -+ FT_Matrix matrix; -+ int hmul = 1; -+ int vmul = 1; -+ unsigned int stride; -+ -+ stride = (width * hmul + 3) & ~3; -+ -+ matrix.xx = matrix.yy = 0x10000L; -+ matrix.xy = matrix.yx = 0; -+ -+ switch (font_options->antialias) { -+ case CAIRO_ANTIALIAS_NONE: -+ bitmap.pixel_mode = FT_PIXEL_MODE_MONO; -+ bitmap.num_grays = 1; -+ stride = ((width + 31) & -32) >> 3; -+ break; -+ case CAIRO_ANTIALIAS_DEFAULT: -+ case CAIRO_ANTIALIAS_GRAY: -+ bitmap.pixel_mode = FT_PIXEL_MODE_GRAY; -+ bitmap.num_grays = 256; -+ stride = (width + 3) & -4; -+ break; -+ case CAIRO_ANTIALIAS_SUBPIXEL: -+ switch (font_options->subpixel_order) { -+ case CAIRO_SUBPIXEL_ORDER_RGB: -+ case CAIRO_SUBPIXEL_ORDER_BGR: -+ case CAIRO_SUBPIXEL_ORDER_DEFAULT: -+ default: -+ matrix.xx *= 3; -+ hmul = 3; -+ break; -+ case CAIRO_SUBPIXEL_ORDER_VRGB: -+ case CAIRO_SUBPIXEL_ORDER_VBGR: -+ matrix.yy *= 3; -+ vmul = 3; -+ break; -+ } -+ -+ FT_Outline_Transform (outline, &matrix); -+ -+ bitmap.pixel_mode = FT_PIXEL_MODE_GRAY; -+ bitmap.num_grays = 256; -+ stride = (width * hmul + 3) & -4; -+ } -+ bitmap.pitch = stride; -+ bitmap.width = width * hmul; -+ bitmap.rows = height * vmul; -+ bitmap.buffer = calloc (stride, bitmap.rows); -+ if (bitmap.buffer == NULL) -+ return _cairo_error (CAIRO_STATUS_NO_MEMORY); -+ FT_Outline_Translate (outline, -cbox.xMin*hmul, -cbox.yMin*vmul); -+ if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) { -+ free (bitmap.buffer); -+ return _cairo_error (CAIRO_STATUS_NO_MEMORY); -+ } -+ device_offset_left = floor (-(double) cbox.xMin / 64.0); -+ device_offset_top = floor (+(double) cbox.yMax / 64.0); -+ } -+ /* Note: -+ * _get_bitmap_surface will free bitmap.buffer if there is an error -+ */ - status = _get_bitmap_surface (&bitmap, TRUE, font_options, surface); - if (status) - return status; -- } -- -- /* -- * Note: the font's coordinate system is upside down from ours, so the -- * Y coordinate of the control box needs to be negated. Moreover, device -- * offsets are position of glyph origin relative to top left while xMin -- * and yMax are offsets of top left relative to origin. Another negation. -- */ -- cairo_surface_set_device_offset (&(*surface)->base, -- floor (-(double) cbox.xMin / 64.0), -- floor (+(double) cbox.yMax / 64.0)); -+ /* Note: the font's coordinate system is upside down from ours, so the -+ * Y coordinate of the control box needs to be negated. Moreover, device -+ * offsets are position of glyph origin relative to top left while xMin -+ * and yMax are offsets of top left relative to origin. Another negation. -+ */ -+ cairo_surface_set_device_offset (&(*surface)->base, -+ device_offset_left, -+ device_offset_top); -+ } - - return CAIRO_STATUS_SUCCESS; - } -@@ -1164,7 +1600,7 @@ _transform_glyph_bitmap (cairo_matrix_t - * the "shape" portion of the font transform - */ - original_to_transformed = *shape; -- -+ - cairo_surface_get_device_offset (&(*surface)->base, &origin_x, &origin_y); - orig_width = cairo_image_surface_get_width (&(*surface)->base); - orig_height = cairo_image_surface_get_height (&(*surface)->base); -@@ -1313,9 +1749,10 @@ _get_pattern_ft_options (FcPattern *patt - if (FcPatternGetBool (pattern, - FC_ANTIALIAS, 0, &antialias) != FcResultMatch) - antialias = FcTrue; -- -+ - if (antialias) { - cairo_subpixel_order_t subpixel_order; -+ int lcd_filter; - - /* disable hinting if requested */ - if (FcPatternGetBool (pattern, -@@ -1351,8 +1788,27 @@ _get_pattern_ft_options (FcPattern *patt - ft_options.base.antialias = CAIRO_ANTIALIAS_SUBPIXEL; - } - --#ifdef FC_HINT_STYLE -- if (FcPatternGetInteger (pattern, -+ if (FcPatternGetInteger (pattern, -+ FC_LCD_FILTER, 0, &lcd_filter) == FcResultMatch) -+ { -+ switch (lcd_filter) { -+ case FC_LCD_NONE: -+ ft_options.base.lcd_filter = CAIRO_LCD_FILTER_NONE; -+ break; -+ case FC_LCD_DEFAULT: -+ ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR5; -+ break; -+ case FC_LCD_LIGHT: -+ ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR3; -+ break; -+ case FC_LCD_LEGACY: -+ ft_options.base.lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL; -+ break; -+ } -+ } -+ -+#ifdef FC_HINT_STYLE -+ if (FcPatternGetInteger (pattern, - FC_HINT_STYLE, 0, &hintstyle) != FcResultMatch) - hintstyle = FC_HINT_FULL; - -@@ -1361,7 +1817,7 @@ _get_pattern_ft_options (FcPattern *patt - - switch (hintstyle) { - case FC_HINT_NONE: -- ft_options.base.hint_style = CAIRO_HINT_STYLE_NONE; -+ ft_options.base.hint_style = CAIRO_HINT_STYLE_NONE; - break; - case FC_HINT_SLIGHT: - ft_options.base.hint_style = CAIRO_HINT_STYLE_SLIGHT; -@@ -1405,14 +1861,14 @@ _get_pattern_ft_options (FcPattern *patt - - if (vertical_layout) - ft_options.load_flags |= FT_LOAD_VERTICAL_LAYOUT; -- -+ - #ifndef FC_EMBOLDEN - #define FC_EMBOLDEN "embolden" - #endif - if (FcPatternGetBool (pattern, - FC_EMBOLDEN, 0, &embolden) != FcResultMatch) - embolden = FcFalse; -- -+ - if (embolden) - ft_options.extra_flags |= CAIRO_FT_OPTIONS_EMBOLDEN; - -@@ -1428,7 +1884,7 @@ _cairo_ft_options_merge (cairo_ft_option - - /* clear load target mode */ - load_flags &= ~(FT_LOAD_TARGET_(FT_LOAD_TARGET_MODE(other->load_flags))); -- -+ - if (load_flags & FT_LOAD_NO_HINTING) - other->base.hint_style = CAIRO_HINT_STYLE_NONE; - -@@ -1439,7 +1895,7 @@ _cairo_ft_options_merge (cairo_ft_option - } - - if (other->base.antialias == CAIRO_ANTIALIAS_SUBPIXEL && -- (options->base.antialias == CAIRO_ANTIALIAS_DEFAULT || -+ (options->base.antialias == CAIRO_ANTIALIAS_DEFAULT || - options->base.antialias == CAIRO_ANTIALIAS_GRAY)) { - options->base.antialias = CAIRO_ANTIALIAS_SUBPIXEL; - options->base.subpixel_order = other->base.subpixel_order; -@@ -1451,6 +1907,12 @@ _cairo_ft_options_merge (cairo_ft_option - if (other->base.hint_style == CAIRO_HINT_STYLE_NONE) - options->base.hint_style = CAIRO_HINT_STYLE_NONE; - -+ if (options->base.lcd_filter == CAIRO_LCD_FILTER_DEFAULT) -+ options->base.lcd_filter = other->base.lcd_filter; -+ -+ if (other->base.lcd_filter == CAIRO_LCD_FILTER_NONE) -+ options->base.lcd_filter = CAIRO_LCD_FILTER_NONE; -+ - if (options->base.antialias == CAIRO_ANTIALIAS_NONE) { - if (options->base.hint_style == CAIRO_HINT_STYLE_NONE) - load_flags |= FT_LOAD_NO_HINTING; -@@ -1463,7 +1925,7 @@ _cairo_ft_options_merge (cairo_ft_option - load_flags |= FT_LOAD_NO_HINTING; - break; - case CAIRO_HINT_STYLE_SLIGHT: -- load_target = FT_LOAD_TARGET_LIGHT; -+ load_target |= FT_LOAD_TARGET_LIGHT; - break; - case CAIRO_HINT_STYLE_MEDIUM: - break; -@@ -1993,18 +2455,18 @@ _cairo_ft_scaled_glyph_init (void *abs - FT_Pos x1, x2; - FT_Pos y1, y2; - FT_Pos advance; -- -+ - if (!vertical_layout) { - x1 = (metrics->horiBearingX) & -64; - x2 = (metrics->horiBearingX + metrics->width + 63) & -64; - y1 = (-metrics->horiBearingY) & -64; - y2 = (-metrics->horiBearingY + metrics->height + 63) & -64; -- -+ - advance = ((metrics->horiAdvance + 32) & -64); -- -+ - fs_metrics.x_bearing = DOUBLE_FROM_26_6 (x1) * x_factor; - fs_metrics.y_bearing = DOUBLE_FROM_26_6 (y1) * y_factor; -- -+ - fs_metrics.width = DOUBLE_FROM_26_6 (x2 - x1) * x_factor; - fs_metrics.height = DOUBLE_FROM_26_6 (y2 - y1) * y_factor; - -@@ -2015,12 +2477,12 @@ _cairo_ft_scaled_glyph_init (void *abs - x2 = (metrics->vertBearingX + metrics->width + 63) & -64; - y1 = (metrics->vertBearingY) & -64; - y2 = (metrics->vertBearingY + metrics->height + 63) & -64; -- -+ - advance = ((metrics->vertAdvance + 32) & -64); -- -+ - fs_metrics.x_bearing = DOUBLE_FROM_26_6 (x1) * x_factor; - fs_metrics.y_bearing = DOUBLE_FROM_26_6 (y1) * y_factor; -- -+ - fs_metrics.width = DOUBLE_FROM_26_6 (x2 - x1) * x_factor; - fs_metrics.height = DOUBLE_FROM_26_6 (y2 - y1) * y_factor; - -@@ -2034,7 +2496,7 @@ _cairo_ft_scaled_glyph_init (void *abs - if (!vertical_layout) { - fs_metrics.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX) * x_factor; - fs_metrics.y_bearing = DOUBLE_FROM_26_6 (-metrics->horiBearingY) * y_factor; -- -+ - if (hint_metrics || glyph->format != FT_GLYPH_FORMAT_OUTLINE) - fs_metrics.x_advance = DOUBLE_FROM_26_6 (metrics->horiAdvance) * x_factor; - else -@@ -2043,7 +2505,7 @@ _cairo_ft_scaled_glyph_init (void *abs - } else { - fs_metrics.x_bearing = DOUBLE_FROM_26_6 (metrics->vertBearingX) * x_factor; - fs_metrics.y_bearing = DOUBLE_FROM_26_6 (metrics->vertBearingY) * y_factor; -- -+ - fs_metrics.x_advance = 0 * x_factor; - if (hint_metrics || glyph->format != FT_GLYPH_FORMAT_OUTLINE) - fs_metrics.y_advance = DOUBLE_FROM_26_6 (metrics->vertAdvance) * y_factor; -@@ -2423,6 +2885,34 @@ _cairo_ft_font_options_substitute (const - } - } - -+ if (options->lcd_filter != CAIRO_LCD_FILTER_DEFAULT) -+ { -+ if (FcPatternGet (pattern, FC_LCD_FILTER, 0, &v) == FcResultNoMatch) -+ { -+ int lcd_filter; -+ -+ switch (options->lcd_filter) { -+ case CAIRO_LCD_FILTER_NONE: -+ lcd_filter = FT_LCD_FILTER_NONE; -+ break; -+ case CAIRO_LCD_FILTER_DEFAULT: -+ case CAIRO_LCD_FILTER_INTRA_PIXEL: -+ lcd_filter = FT_LCD_FILTER_LEGACY; -+ break; -+ case CAIRO_LCD_FILTER_FIR3: -+ lcd_filter = FT_LCD_FILTER_LIGHT; -+ break; -+ default: -+ case CAIRO_LCD_FILTER_FIR5: -+ lcd_filter = FT_LCD_FILTER_DEFAULT; -+ break; -+ } -+ -+ if (! FcPatternAddInteger (pattern, FC_LCD_FILTER, lcd_filter)) -+ return _cairo_error (CAIRO_STATUS_NO_MEMORY); -+ } -+ } -+ - if (options->hint_style != CAIRO_HINT_STYLE_DEFAULT) - { - if (FcPatternGet (pattern, FC_HINTING, 0, &v) == FcResultNoMatch) -@@ -2729,10 +3219,10 @@ cairo_bool_t - _cairo_ft_scaled_font_is_vertical (cairo_scaled_font_t *scaled_font) - { - cairo_ft_scaled_font_t *ft_scaled_font; -- -+ - if (!_cairo_scaled_font_is_ft (scaled_font)) - return FALSE; -- -+ - ft_scaled_font = (cairo_ft_scaled_font_t *) scaled_font; - if (ft_scaled_font->ft_options.load_flags & FT_LOAD_VERTICAL_LAYOUT) - return TRUE; -Index: cairo-1.8.6/src/cairo-mutex.c -=================================================================== ---- cairo-1.8.6.orig/src/cairo-mutex.c -+++ cairo-1.8.6/src/cairo-mutex.c -@@ -35,7 +35,7 @@ - - #include "cairo-mutex-private.h" - --#define CAIRO_MUTEX_DECLARE(mutex) cairo_mutex_t mutex = CAIRO_MUTEX_NIL_INITIALIZER; -+#define CAIRO_MUTEX_DECLARE(mutex) cairo_private cairo_mutex_t mutex = CAIRO_MUTEX_NIL_INITIALIZER; - #include "cairo-mutex-list-private.h" - #undef CAIRO_MUTEX_DECLARE - -Index: cairo-1.8.6/src/cairo-surface.c -=================================================================== ---- cairo-1.8.6.orig/src/cairo-surface.c -+++ cairo-1.8.6/src/cairo-surface.c -@@ -73,6 +73,7 @@ const cairo_surface_t name = { \ - FALSE, /* has_font_options */ \ - { CAIRO_ANTIALIAS_DEFAULT, /* antialias */ \ - CAIRO_SUBPIXEL_ORDER_DEFAULT, /* subpixel_order */ \ -+ CAIRO_LCD_FILTER_DEFAULT, /* lcd_filter */ \ - CAIRO_HINT_STYLE_DEFAULT, /* hint_style */ \ - CAIRO_HINT_METRICS_DEFAULT /* hint_metrics */ \ - } /* font_options */ \ -Index: cairo-1.8.6/src/cairo-types-private.h -=================================================================== ---- cairo-1.8.6.orig/src/cairo-types-private.h -+++ cairo-1.8.6/src/cairo-types-private.h -@@ -113,9 +113,35 @@ struct _cairo_array { - cairo_bool_t is_snapshot; - }; - -+ -+/** -+ * cairo_lcd_filter_t: -+ * @CAIRO_LCD_FILTER_DEFAULT: Use the default LCD filter for -+ * font backend and target device -+ * @CAIRO_LCD_FILTER_NONE: Do not perform LCD filtering -+ * @CAIRO_LCD_FILTER_INTRA_PIXEL: Intra-pixel filter -+ * @CAIRO_LCD_FILTER_FIR3: FIR filter with a 3x3 kernel -+ * @CAIRO_LCD_FILTER_FIR5: FIR filter with a 5x5 kernel -+ * -+ * The LCD filter specifies the low-pass filter applied to LCD-optimized -+ * bitmaps generated with an antialiasing mode of %CAIRO_ANTIALIAS_SUBPIXEL. -+ * -+ * Note: This API was temporarily made available in the public -+ * interface during the 1.7.x development series, but was made private -+ * before 1.8. -+ **/ -+typedef enum _cairo_lcd_filter { -+ CAIRO_LCD_FILTER_DEFAULT, -+ CAIRO_LCD_FILTER_NONE, -+ CAIRO_LCD_FILTER_INTRA_PIXEL, -+ CAIRO_LCD_FILTER_FIR3, -+ CAIRO_LCD_FILTER_FIR5 -+} cairo_lcd_filter_t; -+ - struct _cairo_font_options { - cairo_antialias_t antialias; - cairo_subpixel_order_t subpixel_order; -+ cairo_lcd_filter_t lcd_filter; - cairo_hint_style_t hint_style; - cairo_hint_metrics_t hint_metrics; - }; -Index: cairo-1.8.6/src/cairo-xlib-screen.c -=================================================================== ---- cairo-1.8.6.orig/src/cairo-xlib-screen.c -+++ cairo-1.8.6/src/cairo-xlib-screen.c -@@ -150,13 +150,22 @@ _cairo_xlib_init_screen_font_options (Di - cairo_bool_t xft_antialias; - int xft_hintstyle; - int xft_rgba; -+ int xft_lcdfilter; - cairo_antialias_t antialias; - cairo_subpixel_order_t subpixel_order; -+ cairo_lcd_filter_t lcd_filter; - cairo_hint_style_t hint_style; - - if (!get_boolean_default (dpy, "antialias", &xft_antialias)) - xft_antialias = TRUE; - -+ if (!get_integer_default (dpy, "lcdfilter", &xft_lcdfilter)) { -+ /* -1 is an non-existant Fontconfig constant used to differentiate -+ * the case when no lcdfilter property is available. -+ */ -+ xft_lcdfilter = -1; -+ } -+ - if (!get_boolean_default (dpy, "hinting", &xft_hinting)) - xft_hinting = TRUE; - -@@ -239,6 +248,24 @@ _cairo_xlib_init_screen_font_options (Di - subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT; - } - -+ switch (xft_lcdfilter) { -+ case FC_LCD_NONE: -+ lcd_filter = CAIRO_LCD_FILTER_NONE; -+ break; -+ case FC_LCD_DEFAULT: -+ lcd_filter = CAIRO_LCD_FILTER_FIR5; -+ break; -+ case FC_LCD_LIGHT: -+ lcd_filter = CAIRO_LCD_FILTER_FIR3; -+ break; -+ case FC_LCD_LEGACY: -+ lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL; -+ break; -+ default: -+ lcd_filter = CAIRO_LCD_FILTER_DEFAULT; -+ break; -+ } -+ - if (xft_antialias) { - if (subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT) - antialias = CAIRO_ANTIALIAS_GRAY; -@@ -251,6 +278,7 @@ _cairo_xlib_init_screen_font_options (Di - cairo_font_options_set_hint_style (&info->font_options, hint_style); - cairo_font_options_set_antialias (&info->font_options, antialias); - cairo_font_options_set_subpixel_order (&info->font_options, subpixel_order); -+ _cairo_font_options_set_lcd_filter (&info->font_options, lcd_filter); - cairo_font_options_set_hint_metrics (&info->font_options, CAIRO_HINT_METRICS_ON); - } - -Index: cairo-1.8.6/src/cairoint.h -=================================================================== ---- cairo-1.8.6.orig/src/cairoint.h -+++ cairo-1.8.6/src/cairoint.h -@@ -1366,6 +1366,13 @@ cairo_private void - _cairo_font_options_init_copy (cairo_font_options_t *options, - const cairo_font_options_t *other); - -+cairo_private void -+_cairo_font_options_set_lcd_filter (cairo_font_options_t *options, -+ cairo_lcd_filter_t lcd_filter); -+ -+cairo_private cairo_lcd_filter_t -+_cairo_font_options_get_lcd_filter (const cairo_font_options_t *options); -+ - /* cairo-hull.c */ - cairo_private cairo_status_t - _cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices); diff --git a/cairo-missing-include-fdo22610.patch b/cairo-missing-include-fdo22610.patch new file mode 100644 index 0000000..c815bcc --- /dev/null +++ b/cairo-missing-include-fdo22610.patch @@ -0,0 +1,12 @@ +Index: cairo-1.9.2/util/cairo-script/csi-replay.c +=================================================================== +--- cairo-1.9.2.orig/util/cairo-script/csi-replay.c ++++ cairo-1.9.2/util/cairo-script/csi-replay.c +@@ -3,6 +3,7 @@ + + #include + #include ++#include + + static const cairo_user_data_key_t _key; + diff --git a/cairo.changes b/cairo.changes index 39ff2ff..8c375d9 100644 --- a/cairo.changes +++ b/cairo.changes @@ -1,3 +1,19 @@ +------------------------------------------------------------------- +Fri Jul 3 22:14:06 CEST 2009 - captain.magnus@opensuse.org + +- Update to version 1.9.2: + + Many API changes, fixes and other updates. See NEWS for full + details + + New experimental backend: CairoScript + + New utilities: cairo-trace and cairo-perf-trace +- Remove cairo-lcd-filter-fdo10301.patch. This patch was added to + cairo, but later removed in commit + 5d887ad5dca5af0f8216830d1b04d08a5aba9bee +- Don't use autoreconf -f -i +- Enable CairoScript and svg backends with configure +- Add cairo-missing-include-fdo22610.patch to fix a missing + include. Keeps OBS happy. + ------------------------------------------------------------------- Sun Feb 15 06:55:23 CET 2009 - mboman@suse.de diff --git a/cairo.spec b/cairo.spec index 0c311d8..f014e28 100644 --- a/cairo.spec +++ b/cairo.spec @@ -1,5 +1,5 @@ # -# spec file for package cairo (Version 1.8.6) +# spec file for package cairo (Version 1.9.2) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -28,15 +28,15 @@ BuildRequires: xorg-x11-libxcb-devel # These libraries are needed only for tests. # Do not enable tests in build systems, it causes build loop! #BuildRequires: librsvg-devel poppler-devel -License: LGPL v2.1 or later; MOZILLA PUBLIC LICENSE (MPL/NPL) +License: LGPL v2.1 or later ; MPL .. Group: Development/Libraries/X11 Summary: Vector Graphics Library with Cross-Device Output Support Url: http://cairographics.org/ -Version: 1.8.6 -Release: 2 +Version: 1.9.2 +Release: 1 Source: %{name}-%{version}.tar.bz2 -# PATCH-FIX-UPSTREAM cairo-lcd-filter-fdo10301.patch fdo#10301 mboman@suse.de - fix_lcd_filtering -Patch0: cairo-lcd-filter-fdo10301.patch +# PATCH-FIX-UPSTREAM cairo-missing-include.patch-fdo22610.patch captain.magnus@opensuse.org -- Add missing include to silence OBS +Patch0: cairo-missing-include-fdo22610.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build # Last present in SuSE Linux 10.0 (and NLD9): Obsoletes: libpixman <= 0.1.1 @@ -61,13 +61,15 @@ Authors: Carl D. Worth %package devel -License: LGPL v2.1 or later; MOZILLA PUBLIC LICENSE (MPL/NPL) +License: LGPL v2.1 or later ; MPL .. Summary: Development environment for cairo Group: Development/Libraries/X11 Requires: %{name} = %{version} freetype2-devel fontconfig-devel libpng-devel xorg-x11-devel xorg-x11-libXrender-devel xorg-x11-libX11-devel xorg-x11-libxcb-devel +Provides: cairo-doc = %{version} +Obsoletes: cairo-doc <= %{version} # Last present in SuSE Linux 10.0 (and NLD9): -Obsoletes: libpixman-devel <= 0.1.1 Provides: libpixman-devel <= 0.1.1 +Obsoletes: libpixman-devel <= 0.1.1 # bug437293 %ifarch ppc64 Obsoletes: cairo-devel-64bit @@ -80,21 +82,6 @@ cairo. -Authors: --------- - Carl D. Worth - -%package doc -License: LGPL v2.1 or later; MOZILLA PUBLIC LICENSE (MPL/NPL) -Summary: Documentation for cairo -Group: Development/Libraries/X11 -Requires: %{name} = %{version} - -%description doc -This package contains the documentation for cairo. - - - Authors: -------- Carl D. Worth @@ -104,12 +91,14 @@ Authors: %patch0 -p1 %build -autoreconf -f -i +#autoreconf -f -i # Only for tests: --enable-pdf --enable-svg %configure \ --with-pic \ --enable-ps \ --enable-xcb \ + --enable-svg \ + --enable-script \ --disable-gtk-doc \ --disable-static %{__make} %{?jobs:-j %jobs} @@ -117,7 +106,7 @@ autoreconf -f -i %install %makeinstall %if 0%{?suse_version} > 1110 -%{__rm} %{buildroot}/%{_libdir}/*.la +find %{buildroot} -type f -name "*.la" -delete -print %endif %post -p /sbin/ldconfig @@ -130,276 +119,21 @@ autoreconf -f -i %files %defattr(-, root, root) %doc AUTHORS COPYING COPYING-LGPL-2.1 COPYING-MPL-1.1 ChangeLog NEWS README -%{_libdir}/libcairo.so.* +%dir %{_libdir}/cairo +%dir %{_libdir}/cairo/*.so.* +%{_libdir}/*.so.* +%{_bindir}/cairo-trace %files devel %defattr(-, root, root) %doc PORTING_GUIDE %{_includedir}/cairo -%{_libdir}/libcairo.so +%{_libdir}/cairo/*.so +%{_libdir}/*.so %{_libdir}/pkgconfig/*.pc %if 0%{?suse_version} <= 1110 %{_libdir}/*.la %endif - -%files doc -%defattr(-, root, root) %{_datadir}/gtk-doc/html/* %changelog -* Sun Feb 15 2009 mboman@suse.de -- Remove bugzilla-104365.patch. Symptoms as described - in bnc#104365 are no longer an issue. -- Remove cairo-ac.patch. Not needed anymore -- Replace cairo-1.4.10-lcd-filter-1.patch with - cairo-lcd-filter-fdo10301.patch and updated so that it applied to - our version of cairo. -* Wed Jan 21 2009 msuman@suse.de -- Continue to provide the "la" files for SUSE releases <= 11.1 -* Tue Jan 13 2009 crrodriguez@suse.de -- remove static libraries and "la" files -* Sat Dec 20 2008 mboman@suse.de -- Update to version 1.8.6: - + Many API changes, fixes and other updates. See NEWS for full details -* Wed Dec 10 2008 olh@suse.de -- use Obsoletes: -XXbit only for ppc64 to help solver during distupgrade - (bnc#437293) -* Mon Dec 08 2008 mboman@suse.de -- Update to version 1.8.4: - + Many API changes, fixes and other updates. See NEWS for full details -* Tue Nov 11 2008 ro@suse.de -- SLE-11 uses PPC64 instead of PPC, adapt baselibs.conf -* Tue Nov 04 2008 maw@suse.de -- Disable the glitz backend (bnc#429280). -* Mon Nov 03 2008 vuntz@novell.com -- Remove cairo-1.0.2-depth-fix-1.patch: it's fixed upstream and I - trust upstream more than us about the right fix :-) -- Remove cairo-pixman-version.patch: not needed anymore. -* Thu Oct 30 2008 olh@suse.de -- obsolete old -XXbit packages (bnc#437293) -* Tue Sep 30 2008 mboman@suse.de -- Update to version 1.8.0: - + Many API changes. See NEWS for full details - + cairo-xlib: Improved performance with X server without Render - + cairo-ft: respecting FC_FT_FACE - + cairo-directfb: backend improvements - + Misc other fixes -* Tue Sep 23 2008 maw@suse.de -- Add cairo-pixman-version.patch. -* Mon Sep 22 2008 maw@suse.de -- Update to version 1.7.6: - + Build improvements - + API changes since 1.7.4: - * Remove cairo_font_options_set_lcd_filter and - cairo_font_options_get_lcd_filter - * Replace cairo_has_show_glyphs with - cairo_surface_has_show_glyphs - * Add cairo_text_cluster_flags_t to - cairo_show_text_glyphs, cairo_scaled_font_text_to_glyphs, - and cairo_user_scaled_font_text_to_glyphs_func_t - * Note that there have been no API changes with respect to - previous stable versions of cairo (1.0.x, 1.2.x, 1.4.x, or - 1.6.x). - + Bugs fixed: bmo453199#c5, bfo#16819 - + Misc other fixes. -* Wed Aug 27 2008 mboman@novell.com -- Update to version 1.7.4: - + Including the missing header file cairo-user-font-private.h - + Improvements around cairo text API. - + New API allowing the user of cairo API to provide drawings for glyphs - in a font. - + show_text_glyphs - new API - + LCD subpixel filtering using FreeType - + Toy font face constructor and getter - + FreeType: respecting FC_FT_FACE - + PS/PDF: More efficient output - + Xlib: Dithering - + Xlib: Avoid rendering glyphs out of surface bounds - + Xlib: Improved performance with Xrender-less X servers - + Directfb: backend improvements - + Countless bugs have been fixed and optimizations made -* Mon Jun 09 2008 maw@suse.de -- Update to version 1.6.4: - + Improved PDF and PostScript output - + Support for arbitrary X server visuals - + A new Quartz backend and a new "win32 printing" backend - + Many bug fixes - + For a fuller account of what's new, see the NEWS file - included in the distribution -- Tag patches; temporarily disable several pending rebasing. -* Mon Apr 14 2008 aj@suse.de -- Remove dependency on gtk-doc and own the directories instead. -- Properly provide libpixman. -- Change ldconfig usage in post scripts. -* Mon Apr 14 2008 schwab@suse.de -- Fix configure script with patch cairo-ac.patch. -* Thu Apr 10 2008 ro@suse.de -- added baselibs.conf file to build xxbit packages - for multilib support -* Mon Jan 28 2008 maw@suse.de -- Update to version 1.4.14: - + Fixes backported from the 1.5 development branch: - * Fix a regression (which first appeared in 1.4.12) where - stroking under a large scale would sometimes incorrectly - replace a miter join with a bevel join - + Fix handling of fonts that contain a mixture of outline and - bitmapped glyphs; there was a change in this handling in - 1.4.12 that improved some cases and also regressed other - cases; now, all cases should be handled quite well - + Fix xlib backend to not consider recent X server release as - having a buggy repeat implementation in the Render extension - + Fix several bugs in cairo's PostScript output; these include - making the PostScript output more compatible with recent - versions of ghostscript that are more strict about Type 3 - fonts, for example. -* Fri Dec 21 2007 maw@suse.de -- Update to version 1.4.12: - + Avoid overflow when allocating large buffers - + Fix crash with cairo_pattern_set_user_data - + Fix broken locking in cairo-ft error path - + Avoid crash when cleaning up after Render extension - + Avoid crash for zero-sized bitmap glyph - + Avoid crash with type-1 fonts and ft and atsui enabled - + Fix many error-handling cases in the Quartz/ATSUI code - + Eliminate cairo_stroke crash with scaling near zero - + Fix PDF linear gradients without stops at 0.0 and 1.0 - + Fix PDF CFF subsetting to work with Apple Preview - + Report proper errors on out-of-memory on win32 - + Fix EXTEND_NONE gradients for cairo-quartz - + Fix odd-number-of-dashes dashing for cairo-quartz - + Fix erroneous results from cairo_stroke_extents - + Force non-AA text when bitmap strikes are available - + Fix cairo-atsui font metrics - + Avoid drawing shutdown for glyph-not-found in font - + Don't raise an error for creating an empty path - + Free glyph surfaces after uploading to X server cache. -* Wed Jul 04 2007 sbrabec@suse.cz -- Updated to version 1.4.10: - * Eliminate X errors that were killing OO.o - * Use IncludeInferiors when using xlib surface as a source - * Optimize drawing of many rectangles - * Thread-safe surface-cache for solid patterns - * Surface cache for solid patterns - * Internal cleanup of error handling - * Repaired mutex initialization - * PDF Improvements - * Performance optimizations - * More malloc reduction - * Fix a crash due to a LOCK vs. UNLOCK typo - * Backend-specific fixes - * Miscellaneous fixes -* Mon Jun 18 2007 maw@suse.de -- Add %%run_ldconfig to %%post and %%postun sections. -* Mon Mar 26 2007 sbrabec@suse.cz -- Disabled DirectFB by default (#256775). -- Ported bugzilla-104365.patch. -* Tue Mar 13 2007 sbrabec@suse.cz -- Updated to version 1.4.0: - * Performance improvements. - * API additions. - * Many bug fixes. - * Documentation improvements. -- Enabled XCB and DirectFB backends. -* Fri Feb 02 2007 sbrabec@suse.cz -- Removed references to /opt/gnome. -- Fixed devel dependencies. -* Fri Jan 26 2007 jhargadon@suse.de -- removed patch cairo-remove-requires-private.patch (#237155) -* Tue Jan 23 2007 ro@suse.de -- drop requires for gnome-filesystem -* Tue Oct 24 2006 jhargadon@suse.de -- update to version 1.2.4 -- fixed several rendering bugs -- add cairo-1.2.4-lcd-filter-1.patch to resolve bug #213989 -* Thu Sep 14 2006 sbrabec@suse.cz -- Create correct dependencies in older products. -* Thu Aug 17 2006 jhargadon@suse.de -- update to version 1.2.2 -- Fix crashes with BGR X servers -- Fix the "disappearing text" bug -- Fix broken image fallback scaling -- Fix inadvertent semantic change of font matrix translation -- Fix create_similar to preserve fallback resolution and font options -* Wed Aug 16 2006 gekker@suse.de -- Disable gtk-doc, it comes prebuilt and this decreases build deps -* Fri Jul 28 2006 gekker@suse.de -- Update to version 1.2.0 -- Remove upstreamed patches -- API addition: cairo_xlib_surface_get_width,cairo_xlib_surface_get_height -- new features: - Dots can now be drawn by using CAIRO_LINE_CAP_ROUND with - degenerate sub-paths, (cairo_move_to() followed by either - cairo_close_path() or a cairo_line_to() to the same location). -- many bugfixes -* Fri May 12 2006 joeshaw@suse.de -- Add a patch to fix a crash in Nautilus, backported from 1.0.4. - bnc #174152 -* Fri Apr 28 2006 mfabian@suse.de -- Bugzilla #104365: delete fontconfig pattern elements before - trying to add them if the intention is to override default - settings. -* Thu Mar 23 2006 gekker@suse.de -- Fixes cairo crash in evolution with specific mails (#159675) -- CVE-2006-0528 -* Fri Jan 27 2006 ro@suse.de -- use -fstack-protector (merged from meissner) -* Fri Jan 27 2006 mls@suse.de -- converted neededforbuild to BuildRequires -* Wed Jan 25 2006 sbrabec@suse.cz -- Removed Xlib version fb repeating picture bug check (#100469). -* Mon Jan 23 2006 dreveman@suse.de -- Fix 16bpp issue. -* Wed Jan 11 2006 sbrabec@suse.cz -- Do not require libpixman, it's included now. -- Obsolete no longer needed libpixman. -* Wed Nov 23 2005 gekker@suse.de -- Fix broken build (Thanks to Richard Guenther for the patch). -* Tue Nov 01 2005 sbrabec@suse.cz -- Updated to version 1.0.2. -* Tue Oct 04 2005 sbrabec@suse.cz -- Enabled ps and pdf backends (#120049). -* Fri Sep 09 2005 sbrabec@suse.cz -- Re-enabled glitz backend (#116075). -* Fri Sep 02 2005 matz@suse.de -- Fix last change. -* Fri Sep 02 2005 gekker@suse.de -- Remove Requires.private from the cairo.pc file as it causes - build failures in gcc. -* Thu Sep 01 2005 gekker@suse.de -- Update to released version 1.0.0 -- Remove upsteamed patch -* Tue Aug 30 2005 mfabian@suse.de -- Bugzilla #113602: add patch from bugzilla.gnome.org to - fix crashes in pangocairo. See also: - http://bugzilla.gnome.org/show_bug.cgi?id=313685 - http://bugzilla.gnome.org/attachment.cgi?id=50878&action=view -* Mon Aug 29 2005 mfabian@suse.de -- Bugzilla #113545: add patch by Zhe Su to support embedded - bitmaps. -* Thu Aug 18 2005 kukuk@suse.de -- RPM can calculate dependencies much better than using a - hardcoded list -* Wed Aug 17 2005 gekker@suse.de -- Update to version 0.9.2 -* Wed Aug 03 2005 sbrabec@suse.cz -- Xlib version fb repeating picture bug check update (#100469). -* Tue Aug 02 2005 gekker@suse.de -- Fix requirements -* Mon Aug 01 2005 gekker@suse.de -- Updated to version 0.6.0. -* Wed Jun 01 2005 sbrabec@suse.cz -- Updated to version 0.5.0. -* Wed Jun 01 2005 sbrabec@suse.cz -- Fixed devel requirements. -* Mon May 09 2005 sbrabec@suse.cz -- Packaged license files. -* Mon May 09 2005 sbrabec@suse.cz -- Updated to version 0.4.0. -* Wed Jan 26 2005 sbrabec@suse.cz -- Updated to version 0.3.0. -* Wed Jan 26 2005 meissner@suse.de -- Added libpng-devel-packages to nfb #49052 -* Wed May 19 2004 clahey@suse.de -- Updated to 0.1.23. -* Tue Apr 20 2004 uli@suse.de -- initial package