Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 303421 | Differences between
and this patch

Collapse All | Expand All

(-)../cairo-1.8.8.orig/doc/public/cairo-sections.txt (+3 lines)
Lines 326-331 Link Here
326
cairo_subpixel_order_t
326
cairo_subpixel_order_t
327
cairo_font_options_set_subpixel_order
327
cairo_font_options_set_subpixel_order
328
cairo_font_options_get_subpixel_order
328
cairo_font_options_get_subpixel_order
329
cairo_lcd_filter_t
330
cairo_font_options_set_lcd_filter
331
cairo_font_options_get_lcd_filter
329
cairo_hint_style_t
332
cairo_hint_style_t
330
cairo_font_options_set_hint_style
333
cairo_font_options_set_hint_style
331
cairo_font_options_get_hint_style
334
cairo_font_options_get_hint_style
(-)../cairo-1.8.8.orig/src/cairo-font-options.c (-1 / +46 lines)
Lines 39-44 Link Here
39
static const cairo_font_options_t _cairo_font_options_nil = {
39
static const cairo_font_options_t _cairo_font_options_nil = {
40
    CAIRO_ANTIALIAS_DEFAULT,
40
    CAIRO_ANTIALIAS_DEFAULT,
41
    CAIRO_SUBPIXEL_ORDER_DEFAULT,
41
    CAIRO_SUBPIXEL_ORDER_DEFAULT,
42
    CAIRO_LCD_FILTER_DEFAULT,
42
    CAIRO_HINT_STYLE_DEFAULT,
43
    CAIRO_HINT_STYLE_DEFAULT,
43
    CAIRO_HINT_METRICS_DEFAULT
44
    CAIRO_HINT_METRICS_DEFAULT
44
};
45
};
Lines 54-59 Link Here
54
{
55
{
55
    options->antialias = CAIRO_ANTIALIAS_DEFAULT;
56
    options->antialias = CAIRO_ANTIALIAS_DEFAULT;
56
    options->subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
57
    options->subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
58
    options->lcd_filter = CAIRO_LCD_FILTER_DEFAULT;
57
    options->hint_style = CAIRO_HINT_STYLE_DEFAULT;
59
    options->hint_style = CAIRO_HINT_STYLE_DEFAULT;
58
    options->hint_metrics = CAIRO_HINT_METRICS_DEFAULT;
60
    options->hint_metrics = CAIRO_HINT_METRICS_DEFAULT;
59
}
61
}
Lines 64-69 Link Here
64
{
66
{
65
    options->antialias = other->antialias;
67
    options->antialias = other->antialias;
66
    options->subpixel_order = other->subpixel_order;
68
    options->subpixel_order = other->subpixel_order;
69
    options->lcd_filter = other->lcd_filter;
67
    options->hint_style = other->hint_style;
70
    options->hint_style = other->hint_style;
68
    options->hint_metrics = other->hint_metrics;
71
    options->hint_metrics = other->hint_metrics;
69
}
72
}
Lines 189-194 Link Here
189
	options->antialias = other->antialias;
192
	options->antialias = other->antialias;
190
    if (other->subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT)
193
    if (other->subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT)
191
	options->subpixel_order = other->subpixel_order;
194
	options->subpixel_order = other->subpixel_order;
195
    if (other->lcd_filter != CAIRO_LCD_FILTER_DEFAULT)
196
	options->lcd_filter = other->lcd_filter;
192
    if (other->hint_style != CAIRO_HINT_STYLE_DEFAULT)
197
    if (other->hint_style != CAIRO_HINT_STYLE_DEFAULT)
193
	options->hint_style = other->hint_style;
198
	options->hint_style = other->hint_style;
194
    if (other->hint_metrics != CAIRO_HINT_METRICS_DEFAULT)
199
    if (other->hint_metrics != CAIRO_HINT_METRICS_DEFAULT)
Lines 221-226 Link Here
221
226
222
    return (options->antialias == other->antialias &&
227
    return (options->antialias == other->antialias &&
223
	    options->subpixel_order == other->subpixel_order &&
228
	    options->subpixel_order == other->subpixel_order &&
229
	    options->lcd_filter == other->lcd_filter &&
224
	    options->hint_style == other->hint_style &&
230
	    options->hint_style == other->hint_style &&
225
	    options->hint_metrics == other->hint_metrics);
231
	    options->hint_metrics == other->hint_metrics);
226
}
232
}
Lines 246-252 Link Here
246
252
247
    return ((options->antialias) |
253
    return ((options->antialias) |
248
	    (options->subpixel_order << 4) |
254
	    (options->subpixel_order << 4) |
249
	    (options->hint_style << 8) |
255
	    (options->lcd_filter << 8) |
256
	    (options->hint_style << 12) |
250
	    (options->hint_metrics << 16));
257
	    (options->hint_metrics << 16));
251
}
258
}
252
slim_hidden_def (cairo_font_options_hash);
259
slim_hidden_def (cairo_font_options_hash);
Lines 328-333 Link Here
328
}
335
}
329
336
330
/**
337
/**
338
 * cairo_font_options_set_lcd_filter:
339
 * @options: a #cairo_font_options_t
340
 * @lcd_filter: the new LCD filter
341
 *
342
 * Sets the LCD filter for the font options object. The LCD filter
343
 * specifies how pixels are filtered when rendered with an antialiasing
344
 * mode of %CAIRO_ANTIALIAS_SUBPIXEL. See the documentation for
345
 * #cairo_lcd_filter_t for full details.
346
 **/
347
void
348
cairo_font_options_set_lcd_filter (cairo_font_options_t *options,
349
				   cairo_lcd_filter_t    lcd_filter)
350
{
351
    if (cairo_font_options_status (options))
352
	return;
353
354
    options->lcd_filter = lcd_filter;
355
}
356
357
/**
358
 * cairo_font_options_get_lcd_filter:
359
 * @options: a #cairo_font_options_t
360
 *
361
 * Gets the LCD filter for the font options object.
362
 * See the documentation for #cairo_lcd_filter_t for full details.
363
 *
364
 * Return value: the LCD filter for the font options object
365
 **/
366
cairo_lcd_filter_t
367
cairo_font_options_get_lcd_filter (const cairo_font_options_t *options)
368
{
369
    if (cairo_font_options_status ((cairo_font_options_t *) options))
370
	return CAIRO_LCD_FILTER_DEFAULT;
371
372
    return options->lcd_filter;
373
}
374
375
/**
331
 * cairo_font_options_set_hint_style:
376
 * cairo_font_options_set_hint_style:
332
 * @options: a #cairo_font_options_t
377
 * @options: a #cairo_font_options_t
333
 * @hint_style: the new hint style
378
 * @hint_style: the new hint style
(-)../cairo-1.8.8.orig/src/cairo-ft-font.c (-189 / +465 lines)
Lines 57-62 Link Here
57
#include FT_SYNTHESIS_H
57
#include FT_SYNTHESIS_H
58
#endif
58
#endif
59
59
60
#include FT_LCD_FILTER_H
61
60
#define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0))
62
#define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0))
61
#define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0)
63
#define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0)
62
#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
64
#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
Lines 740-762 Link Here
740
    return CAIRO_STATUS_SUCCESS;
742
    return CAIRO_STATUS_SUCCESS;
741
}
743
}
742
744
743
/* Empirically-derived subpixel filtering values thanks to Keith
745
/* we sometimes need to convert the glyph bitmap in a FT_GlyphSlot
744
 * Packard and libXft. */
746
 * into a different format. For example, we want to convert a
745
static const int    filters[3][3] = {
747
 * FT_PIXEL_MODE_LCD or FT_PIXEL_MODE_LCD_V bitmap into a 32-bit
746
    /* red */
748
 * ARGB or ABGR bitmap.
747
#if 0
749
 *
748
    {    65538*4/7,65538*2/7,65538*1/7 },
750
 * this function prepares a target descriptor for this operation.
749
    /* green */
751
 *
750
    {    65536*1/4, 65536*2/4, 65537*1/4 },
752
 * input :: target bitmap descriptor. The function will set its
751
    /* blue */
753
 *          'width', 'rows' and 'pitch' fields, and only these
752
    {    65538*1/7,65538*2/7,65538*4/7 },
754
 *
755
 * slot  :: the glyph slot containing the source bitmap. this
756
 *          function assumes that slot->format == FT_GLYPH_FORMAT_BITMAP
757
 *
758
 * mode  :: the requested final rendering mode. supported values are
759
 *          MONO, NORMAL (i.e. gray), LCD and LCD_V
760
 *
761
 * the function returns the size in bytes of the corresponding buffer,
762
 * it's up to the caller to allocate the corresponding memory block
763
 * before calling _fill_xrender_bitmap
764
 *
765
 * it also returns -1 in case of error (e.g. incompatible arguments,
766
 * like trying to convert a gray bitmap into a monochrome one)
767
 */
768
static int
769
_compute_xrender_bitmap_size(FT_Bitmap      *target,
770
			     FT_GlyphSlot    slot,
771
			     FT_Render_Mode  mode)
772
{
773
    FT_Bitmap *ftbit;
774
    int width, height, pitch;
775
776
    if (slot->format != FT_GLYPH_FORMAT_BITMAP)
777
	return -1;
778
779
    // compute the size of the final bitmap
780
    ftbit = &slot->bitmap;
781
782
    width = ftbit->width;
783
    height = ftbit->rows;
784
    pitch = (width + 3) & ~3;
785
786
    switch (ftbit->pixel_mode) {
787
    case FT_PIXEL_MODE_MONO:
788
	if (mode == FT_RENDER_MODE_MONO) {
789
	    pitch = (((width + 31) & ~31) >> 3);
790
	    break;
791
	}
792
	/* fall-through */
793
794
    case FT_PIXEL_MODE_GRAY:
795
	if (mode == FT_RENDER_MODE_LCD ||
796
	    mode == FT_RENDER_MODE_LCD_V)
797
	{
798
	    /* each pixel is replicated into a 32-bit ARGB value */
799
	    pitch = width * 4;
800
	}
801
	break;
802
803
    case FT_PIXEL_MODE_LCD:
804
	if (mode != FT_RENDER_MODE_LCD)
805
	    return -1;
806
807
	/* horz pixel triplets are packed into 32-bit ARGB values */
808
	width /= 3;
809
	pitch = width * 4;
810
	break;
811
812
    case FT_PIXEL_MODE_LCD_V:
813
	if (mode != FT_RENDER_MODE_LCD_V)
814
	    return -1;
815
816
	/* vert pixel triplets are packed into 32-bit ARGB values */
817
	height /= 3;
818
	pitch = width * 4;
819
	break;
820
821
    default:  /* unsupported source format */
822
	return -1;
823
    }
824
825
    target->width = width;
826
    target->rows = height;
827
    target->pitch = pitch;
828
    target->buffer = NULL;
829
830
    return pitch * height;
831
}
832
833
/* this functions converts the glyph bitmap found in a FT_GlyphSlot
834
 * into a different format (see _compute_xrender_bitmap_size)
835
 *
836
 * you should call this function after _compute_xrender_bitmap_size
837
 *
838
 * target :: target bitmap descriptor. Note that its 'buffer' pointer
839
 *           must point to memory allocated by the caller
840
 *
841
 * slot   :: the glyph slot containing the source bitmap
842
 *
843
 * mode   :: the requested final rendering mode
844
 *
845
 * bgr    :: boolean, set if BGR or VBGR pixel ordering is needed
846
 */
847
static void
848
_fill_xrender_bitmap(FT_Bitmap      *target,
849
		     FT_GlyphSlot    slot,
850
		     FT_Render_Mode  mode,
851
		     int             bgr)
852
{
853
    FT_Bitmap *ftbit = &slot->bitmap;
854
    unsigned char *srcLine = ftbit->buffer;
855
    unsigned char *dstLine = target->buffer;
856
    int src_pitch = ftbit->pitch;
857
    int width = target->width;
858
    int height = target->rows;
859
    int pitch = target->pitch;
860
    int subpixel;
861
    int h;
862
863
    subpixel = (mode == FT_RENDER_MODE_LCD ||
864
		mode == FT_RENDER_MODE_LCD_V);
865
866
    if (src_pitch < 0)
867
	srcLine -= src_pitch * (ftbit->rows - 1);
868
869
    target->pixel_mode = ftbit->pixel_mode;
870
871
    switch (ftbit->pixel_mode) {
872
    case FT_PIXEL_MODE_MONO:
873
	if (subpixel) {
874
	    /* convert mono to ARGB32 values */
875
876
	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
877
		int x;
878
879
		for (x = 0; x < width; x++) {
880
		    if (srcLine[(x >> 3)] & (0x80 >> (x & 7)))
881
			((unsigned int *) dstLine)[x] = 0xffffffffU;
882
		}
883
	    }
884
	    target->pixel_mode = FT_PIXEL_MODE_LCD;
885
886
	} else if (mode == FT_RENDER_MODE_NORMAL) {
887
	    /* convert mono to 8-bit gray */
888
889
	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
890
		int x;
891
892
		for (x = 0; x < width; x++) {
893
		    if (srcLine[(x >> 3)] & (0x80 >> (x & 7)))
894
			dstLine[x] = 0xff;
895
		}
896
	    }
897
	    target->pixel_mode = FT_PIXEL_MODE_GRAY;
898
899
	} else {
900
	    /* copy mono to mono */
901
902
	    int  bytes = (width + 7) >> 3;
903
904
	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch)
905
		memcpy (dstLine, srcLine, bytes);
906
	}
907
	break;
908
909
    case FT_PIXEL_MODE_GRAY:
910
	if (subpixel) {
911
	    /* convert gray to ARGB32 values */
912
913
	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
914
		int x;
915
		unsigned int *dst = (unsigned int *) dstLine;
916
917
		for (x = 0; x < width; x++) {
918
		    unsigned int pix = srcLine[x];
919
920
		    pix |= (pix << 8);
921
		    pix |= (pix << 16);
922
923
		    dst[x] = pix;
924
		}
925
	    }
926
	    target->pixel_mode = FT_PIXEL_MODE_LCD;
927
        } else {
928
            /* copy gray into gray */
929
930
            for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch)
931
                memcpy (dstLine, srcLine, width);
932
        }
933
        break;
934
935
    case FT_PIXEL_MODE_LCD:
936
	if (!bgr) {
937
	    /* convert horizontal RGB into ARGB32 */
938
939
	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
940
		int x;
941
		unsigned char *src = srcLine;
942
		unsigned int *dst = (unsigned int *) dstLine;
943
944
		for (x = 0; x < width; x++, src += 3) {
945
		    unsigned int  pix;
946
947
		    pix = ((unsigned int)src[0] << 16) |
948
			  ((unsigned int)src[1] <<  8) |
949
			  ((unsigned int)src[2]      ) |
950
			  ((unsigned int)src[1] << 24) ;
951
952
		    dst[x] = pix;
953
		}
954
	    }
955
	} else {
956
	    /* convert horizontal BGR into ARGB32 */
957
958
	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
959
960
		int x;
961
		unsigned char *src = srcLine;
962
		unsigned int *dst = (unsigned int *) dstLine;
963
964
		for (x = 0; x < width; x++, src += 3) {
965
		    unsigned int  pix;
966
967
		    pix = ((unsigned int)src[2] << 16) |
968
			  ((unsigned int)src[1] <<  8) |
969
			  ((unsigned int)src[0]      ) |
970
			  ((unsigned int)src[1] << 24) ;
971
972
		    dst[x] = pix;
973
		}
974
	    }
975
	}
976
	break;
977
978
    default:  /* FT_PIXEL_MODE_LCD_V */
979
	/* convert vertical RGB into ARGB32 */
980
	if (!bgr) {
981
982
	    for (h = height; h > 0; h--, srcLine += 3 * src_pitch, dstLine += pitch) {
983
		int x;
984
		unsigned char* src = srcLine;
985
		unsigned int*  dst = (unsigned int *) dstLine;
986
987
		for (x = 0; x < width; x++, src += 1) {
988
		    unsigned int pix;
989
#if 1
990
		    pix = ((unsigned int)src[0]           << 16) |
991
			  ((unsigned int)src[src_pitch]   <<  8) |
992
			  ((unsigned int)src[src_pitch*2]      ) |
993
			  0xFF000000 ;
994
#else
995
		    pix = ((unsigned int)src[0]           << 16) |
996
			  ((unsigned int)src[src_pitch]   <<  8) |
997
			  ((unsigned int)src[src_pitch*2]      ) |
998
			  ((unsigned int)src[src_pitch]   << 24) ;
753
#endif
999
#endif
754
    {    65538*9/13,65538*3/13,65538*1/13 },
1000
		    dst[x] = pix;
755
    /* green */
1001
		}
756
    {    65538*1/6, 65538*4/6, 65538*1/6 },
1002
	    }
757
    /* blue */
1003
	} else {
758
    {    65538*1/13,65538*3/13,65538*9/13 },
1004
759
};
1005
	    for (h = height; h > 0; h--, srcLine += 3*src_pitch, dstLine += pitch) {
1006
		int x;
1007
		unsigned char *src = srcLine;
1008
		unsigned int *dst = (unsigned int *) dstLine;
1009
1010
		for (x = 0; x < width; x++, src += 1) {
1011
		    unsigned int  pix;
1012
1013
		    pix = ((unsigned int)src[src_pitch * 2] << 16) |
1014
			  ((unsigned int)src[src_pitch]     <<  8) |
1015
			  ((unsigned int)src[0]                  ) |
1016
			  ((unsigned int)src[src_pitch]     << 24) ;
1017
1018
		    dst[x] = pix;
1019
		}
1020
	    }
1021
	}
1022
    }
1023
}
1024
760
1025
761
/* Fills in val->image with an image surface created from @bitmap
1026
/* Fills in val->image with an image surface created from @bitmap
762
 */
1027
 */
Lines 769-775 Link Here
769
    int width, height, stride;
1034
    int width, height, stride;
770
    unsigned char *data;
1035
    unsigned char *data;
771
    int format = CAIRO_FORMAT_A8;
1036
    int format = CAIRO_FORMAT_A8;
772
    cairo_bool_t subpixel = FALSE;
1037
    cairo_image_surface_t *image;
773
1038
774
    width = bitmap->width;
1039
    width = bitmap->width;
775
    height = bitmap->rows;
1040
    height = bitmap->rows;
Lines 826-836 Link Here
826
    case FT_PIXEL_MODE_LCD:
1091
    case FT_PIXEL_MODE_LCD:
827
    case FT_PIXEL_MODE_LCD_V:
1092
    case FT_PIXEL_MODE_LCD_V:
828
    case FT_PIXEL_MODE_GRAY:
1093
    case FT_PIXEL_MODE_GRAY:
829
	switch (font_options->antialias) {
1094
        if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) {
830
	case CAIRO_ANTIALIAS_DEFAULT:
831
	case CAIRO_ANTIALIAS_GRAY:
832
	case CAIRO_ANTIALIAS_NONE:
833
	default:
834
	    stride = bitmap->pitch;
1095
	    stride = bitmap->pitch;
835
	    if (own_buffer) {
1096
	    if (own_buffer) {
836
		data = bitmap->buffer;
1097
		data = bitmap->buffer;
Lines 842-945 Link Here
842
		memcpy (data, bitmap->buffer, stride * height);
1103
		memcpy (data, bitmap->buffer, stride * height);
843
	    }
1104
	    }
844
	    format = CAIRO_FORMAT_A8;
1105
	    format = CAIRO_FORMAT_A8;
845
	    break;
1106
	} else {
846
	case CAIRO_ANTIALIAS_SUBPIXEL: {
1107
	    // if we get there, the  data from the source bitmap
847
	    int		    x, y;
1108
	    // really comes from _fill_xrender_bitmap, and is
848
	    unsigned char   *in_line, *out_line, *in;
1109
	    // made of 32-bit ARGB or ABGR values
849
	    unsigned int    *out;
1110
	    assert (own_buffer != 0);
850
	    unsigned int    red, green, blue;
1111
	    assert (bitmap->pixel_mode != FT_PIXEL_MODE_GRAY);
851
	    int		    rf, gf, bf;
1112
  
852
	    int		    s;
1113
	    data = bitmap->buffer;
853
	    int		    o, os;
854
	    unsigned char   *data_rgba;
855
	    unsigned int    width_rgba, stride_rgba;
856
	    int		    vmul = 1;
857
	    int		    hmul = 1;
858
859
	    switch (font_options->subpixel_order) {
860
	    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
861
	    case CAIRO_SUBPIXEL_ORDER_RGB:
862
	    case CAIRO_SUBPIXEL_ORDER_BGR:
863
	    default:
864
		width /= 3;
865
		hmul = 3;
866
		break;
867
	    case CAIRO_SUBPIXEL_ORDER_VRGB:
868
	    case CAIRO_SUBPIXEL_ORDER_VBGR:
869
		vmul = 3;
870
		height /= 3;
871
		break;
872
	    }
873
	    /*
874
	     * Filter the glyph to soften the color fringes
875
	     */
876
	    width_rgba = width;
877
	    stride = bitmap->pitch;
1114
	    stride = bitmap->pitch;
878
	    stride_rgba = (width_rgba * 4 + 3) & ~3;
879
	    data_rgba = calloc (stride_rgba, height);
880
	    if (data_rgba == NULL) {
881
		if (own_buffer)
882
		    free (bitmap->buffer);
883
		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
884
	    }
885
886
	    os = 1;
887
	    switch (font_options->subpixel_order) {
888
	    case CAIRO_SUBPIXEL_ORDER_VRGB:
889
		os = stride;
890
	    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
891
	    case CAIRO_SUBPIXEL_ORDER_RGB:
892
	    default:
893
		rf = 0;
894
		gf = 1;
895
		bf = 2;
896
		break;
897
	    case CAIRO_SUBPIXEL_ORDER_VBGR:
898
		os = stride;
899
	    case CAIRO_SUBPIXEL_ORDER_BGR:
900
		bf = 0;
901
		gf = 1;
902
		rf = 2;
903
		break;
904
	    }
905
	    in_line = bitmap->buffer;
906
	    out_line = data_rgba;
907
	    for (y = 0; y < height; y++)
908
	    {
909
		in = in_line;
910
		out = (unsigned int *) out_line;
911
		in_line += stride * vmul;
912
		out_line += stride_rgba;
913
		for (x = 0; x < width * hmul; x += hmul)
914
		{
915
		    red = green = blue = 0;
916
		    o = 0;
917
		    for (s = 0; s < 3; s++)
918
		    {
919
			red += filters[rf][s]*in[x+o];
920
			green += filters[gf][s]*in[x+o];
921
			blue += filters[bf][s]*in[x+o];
922
			o += os;
923
		    }
924
		    red = red / 65536;
925
		    green = green / 65536;
926
		    blue = blue / 65536;
927
		    *out++ = (green << 24) | (red << 16) | (green << 8) | blue;
928
		}
929
	    }
930
931
	    /* Images here are stored in native format. The
932
	     * backend must convert to its own format as needed
933
	     */
934
935
	    if (own_buffer)
936
		free (bitmap->buffer);
937
	    data = data_rgba;
938
	    stride = stride_rgba;
939
	    format = CAIRO_FORMAT_ARGB32;
1115
	    format = CAIRO_FORMAT_ARGB32;
940
	    subpixel = TRUE;
941
	    break;
942
	}
943
	}
1116
	}
944
	break;
1117
	break;
945
    case FT_PIXEL_MODE_GRAY2:
1118
    case FT_PIXEL_MODE_GRAY2:
Lines 951-969 Link Here
951
	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
1124
	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
952
    }
1125
    }
953
1126
954
    *surface = (cairo_image_surface_t *)
1127
    /* XXX */
1128
    *surface = image = (cairo_image_surface_t *)
955
	cairo_image_surface_create_for_data (data,
1129
	cairo_image_surface_create_for_data (data,
956
					     format,
1130
					     format,
957
					     width, height, stride);
1131
					     width, height, stride);
958
    if ((*surface)->base.status) {
1132
    if (image->base.status) {
959
	free (data);
1133
	free (data);
960
	return (*surface)->base.status;
1134
	return (*surface)->base.status;
961
    }
1135
    }
962
1136
963
    if (subpixel)
1137
    if (font_options->antialias == CAIRO_ANTIALIAS_SUBPIXEL)
964
	pixman_image_set_component_alpha ((*surface)->pixman_image, TRUE);
1138
	pixman_image_set_component_alpha (image->pixman_image, TRUE);
965
1139
966
    _cairo_image_surface_assume_ownership_of_data ((*surface));
1140
    _cairo_image_surface_assume_ownership_of_data (image);
967
1141
968
    return CAIRO_STATUS_SUCCESS;
1142
    return CAIRO_STATUS_SUCCESS;
969
}
1143
}
Lines 988-1003 Link Here
988
		       cairo_font_options_t	 *font_options,
1162
		       cairo_font_options_t	 *font_options,
989
		       cairo_image_surface_t	**surface)
1163
		       cairo_image_surface_t	**surface)
990
{
1164
{
1165
    int rgba = FC_RGBA_UNKNOWN;
1166
    int lcd_filter = FT_LCD_FILTER_LEGACY;
991
    FT_GlyphSlot glyphslot = face->glyph;
1167
    FT_GlyphSlot glyphslot = face->glyph;
992
    FT_Outline *outline = &glyphslot->outline;
1168
    FT_Outline *outline = &glyphslot->outline;
993
    FT_Bitmap bitmap;
1169
    FT_Bitmap bitmap;
994
    FT_BBox cbox;
1170
    FT_BBox cbox;
995
    FT_Matrix matrix;
996
    int hmul = 1;
997
    int vmul = 1;
998
    unsigned int width, height, stride;
1171
    unsigned int width, height, stride;
999
    cairo_bool_t subpixel = FALSE;
1000
    cairo_status_t status;
1172
    cairo_status_t status;
1173
    FT_Error fterror;
1174
    FT_Library library = glyphslot->library;
1175
    FT_Render_Mode render_mode = FT_RENDER_MODE_NORMAL;
1176
1177
    switch (font_options->antialias) {
1178
    case CAIRO_ANTIALIAS_NONE:
1179
	render_mode = FT_RENDER_MODE_MONO;
1180
	break;
1181
1182
    case CAIRO_ANTIALIAS_SUBPIXEL:
1183
	switch (font_options->subpixel_order) {
1184
	    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
1185
	    case CAIRO_SUBPIXEL_ORDER_RGB:
1186
	    case CAIRO_SUBPIXEL_ORDER_BGR:
1187
		render_mode = FT_RENDER_MODE_LCD;
1188
		break;
1189
1190
	    case CAIRO_SUBPIXEL_ORDER_VRGB:
1191
	    case CAIRO_SUBPIXEL_ORDER_VBGR:
1192
		render_mode = FT_RENDER_MODE_LCD_V;
1193
		break;
1194
	}
1195
1196
	switch (font_options->lcd_filter) {
1197
	case CAIRO_LCD_FILTER_NONE:
1198
	    lcd_filter = FT_LCD_FILTER_NONE;
1199
	    break;
1200
	case CAIRO_LCD_FILTER_DEFAULT:
1201
	case CAIRO_LCD_FILTER_INTRA_PIXEL:
1202
	    lcd_filter = FT_LCD_FILTER_LEGACY;
1203
	    break;
1204
	case CAIRO_LCD_FILTER_FIR3:
1205
	    lcd_filter = FT_LCD_FILTER_LIGHT;
1206
	    break;
1207
	case CAIRO_LCD_FILTER_FIR5:
1208
	    lcd_filter = FT_LCD_FILTER_DEFAULT;
1209
	    break;
1210
	}
1211
1212
	break;
1213
1214
    case CAIRO_ANTIALIAS_DEFAULT:
1215
    case CAIRO_ANTIALIAS_GRAY:
1216
	render_mode = FT_RENDER_MODE_NORMAL;
1217
    }
1001
1218
1002
    FT_Outline_Get_CBox (outline, &cbox);
1219
    FT_Outline_Get_CBox (outline, &cbox);
1003
1220
Lines 1008-1027 Link Here
1008
1225
1009
    width = (unsigned int) ((cbox.xMax - cbox.xMin) >> 6);
1226
    width = (unsigned int) ((cbox.xMax - cbox.xMin) >> 6);
1010
    height = (unsigned int) ((cbox.yMax - cbox.yMin) >> 6);
1227
    height = (unsigned int) ((cbox.yMax - cbox.yMin) >> 6);
1011
    stride = (width * hmul + 3) & ~3;
1228
    stride = (width + 3) & ~3;
1012
1229
1013
    if (width * height == 0) {
1230
    if (width * height == 0) {
1014
	cairo_format_t format;
1231
	cairo_format_t format;
1015
	/* Looks like fb handles zero-sized images just fine */
1232
	/* Looks like fb handles zero-sized images just fine */
1016
	switch (font_options->antialias) {
1233
	switch (render_mode) {
1017
	case CAIRO_ANTIALIAS_NONE:
1234
	case FT_RENDER_MODE_MONO:
1018
	    format = CAIRO_FORMAT_A1;
1235
	    format = CAIRO_FORMAT_A1;
1019
	    break;
1236
	    break;
1020
	case CAIRO_ANTIALIAS_SUBPIXEL:
1237
	case FT_RENDER_MODE_LCD:
1238
	case FT_RENDER_MODE_LCD_V:
1021
	    format= CAIRO_FORMAT_ARGB32;
1239
	    format= CAIRO_FORMAT_ARGB32;
1022
	    break;
1240
	    break;
1023
	case CAIRO_ANTIALIAS_DEFAULT:
1241
	case FT_RENDER_MODE_LIGHT:
1024
	case CAIRO_ANTIALIAS_GRAY:
1242
	case FT_RENDER_MODE_NORMAL:
1243
	case FT_RENDER_MODE_MAX:
1025
	default:
1244
	default:
1026
	    format = CAIRO_FORMAT_A8;
1245
	    format = CAIRO_FORMAT_A8;
1027
	    break;
1246
	    break;
Lines 1033-1106 Link Here
1033
	    return (*surface)->base.status;
1252
	    return (*surface)->base.status;
1034
    } else  {
1253
    } else  {
1035
1254
1036
	matrix.xx = matrix.yy = 0x10000L;
1255
	int bitmap_size;
1037
	matrix.xy = matrix.yx = 0;
1038
1256
1039
	switch (font_options->antialias) {
1257
	switch (render_mode) {
1040
	case CAIRO_ANTIALIAS_NONE:
1258
	case FT_RENDER_MODE_LCD:
1041
	    bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
1259
	    if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_BGR) {
1042
	    bitmap.num_grays  = 1;
1260
		rgba = FC_RGBA_BGR;
1043
	    stride = ((width + 31) & -32) >> 3;
1261
	    } else {
1044
	    break;
1262
		rgba = FC_RGBA_RGB;
1045
	case CAIRO_ANTIALIAS_DEFAULT:
1263
	    }
1046
	case CAIRO_ANTIALIAS_GRAY:
1047
	    bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
1048
	    bitmap.num_grays  = 256;
1049
	    stride = (width + 3) & -4;
1050
	    break;
1264
	    break;
1051
	case CAIRO_ANTIALIAS_SUBPIXEL:
1265
	case FT_RENDER_MODE_LCD_V:
1052
	    switch (font_options->subpixel_order) {
1266
	    if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_VBGR) {
1053
	    case CAIRO_SUBPIXEL_ORDER_RGB:
1267
		rgba = FC_RGBA_VBGR;
1054
	    case CAIRO_SUBPIXEL_ORDER_BGR:
1268
	    } else {
1055
	    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
1269
		rgba = FC_RGBA_VRGB;
1056
	    default:
1057
		matrix.xx *= 3;
1058
		hmul = 3;
1059
		subpixel = TRUE;
1060
		break;
1061
	    case CAIRO_SUBPIXEL_ORDER_VRGB:
1062
	    case CAIRO_SUBPIXEL_ORDER_VBGR:
1063
		matrix.yy *= 3;
1064
		vmul = 3;
1065
		subpixel = TRUE;
1066
		break;
1067
	    }
1270
	    }
1068
	    FT_Outline_Transform (outline, &matrix);
1271
	    break;
1069
1272
	case FT_RENDER_MODE_MONO:
1070
	    bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
1273
	case FT_RENDER_MODE_LIGHT:
1071
	    bitmap.num_grays  = 256;
1274
	case FT_RENDER_MODE_NORMAL:
1072
	    stride = (width * hmul + 3) & -4;
1275
	case FT_RENDER_MODE_MAX:
1276
	default:
1277
	    break;
1073
	}
1278
	}
1074
1279
1075
	bitmap.pitch = stride;
1280
	FT_Library_SetLcdFilter (library, lcd_filter);
1076
	bitmap.width = width * hmul;
1281
1077
	bitmap.rows = height * vmul;
1282
	fterror = FT_Render_Glyph (face->glyph, render_mode);
1078
	bitmap.buffer = calloc (stride, bitmap.rows);
1283
1079
	if (bitmap.buffer == NULL)
1284
	FT_Library_SetLcdFilter (library, FT_LCD_FILTER_NONE);
1285
1286
	if (fterror != 0)
1080
	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
1287
	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
1081
1288
1082
	FT_Outline_Translate (outline, -cbox.xMin*hmul, -cbox.yMin*vmul);
1289
	bitmap_size = _compute_xrender_bitmap_size (&bitmap,
1290
						    face->glyph,
1291
						    render_mode);
1292
	if (bitmap_size < 0)
1293
	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
1083
1294
1084
	if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) {
1295
	bitmap.buffer = calloc (1, bitmap_size);
1085
	    free (bitmap.buffer);
1296
	if (bitmap.buffer == NULL)
1086
	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
1297
	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
1087
	}
1088
1298
1299
	_fill_xrender_bitmap (&bitmap, face->glyph, render_mode,
1300
			      (rgba == FC_RGBA_BGR || rgba == FC_RGBA_VBGR));
1301
1302
	// NOTE: _get_bitmap_surface will free bitmap.buffer if there is an error
1089
	status = _get_bitmap_surface (&bitmap, TRUE, font_options, surface);
1303
	status = _get_bitmap_surface (&bitmap, TRUE, font_options, surface);
1090
	if (status)
1304
	if (status)
1091
	    return status;
1305
	    return status;
1092
    }
1093
1094
    /*
1095
     * Note: the font's coordinate system is upside down from ours, so the
1096
     * Y coordinate of the control box needs to be negated.  Moreover, device
1097
     * offsets are position of glyph origin relative to top left while xMin
1098
     * and yMax are offsets of top left relative to origin.  Another negation.
1099
     */
1100
    cairo_surface_set_device_offset (&(*surface)->base,
1101
				     floor (-(double) cbox.xMin / 64.0),
1102
				     floor (+(double) cbox.yMax / 64.0));
1103
1306
1307
	/*
1308
	 * Note: the font's coordinate system is upside down from ours, so the
1309
	 * Y coordinate of the control box needs to be negated.  Moreover, device
1310
	 * offsets are position of glyph origin relative to top left while xMin
1311
	 * and yMax are offsets of top left relative to origin.  Another negation.
1312
	 */
1313
	cairo_surface_set_device_offset (&(*surface)->base,
1314
					 (double)-glyphslot->bitmap_left,
1315
					 (double)+glyphslot->bitmap_top);
1316
    }
1317
    
1104
    return CAIRO_STATUS_SUCCESS;
1318
    return CAIRO_STATUS_SUCCESS;
1105
}
1319
}
1106
1320
Lines 1286-1291 Link Here
1286
1500
1287
const cairo_scaled_font_backend_t _cairo_ft_scaled_font_backend;
1501
const cairo_scaled_font_backend_t _cairo_ft_scaled_font_backend;
1288
1502
1503
/* Fontconfig version older than 2.6 didn't have these options */
1504
#ifndef FC_LCD_FILTER
1505
#define FC_LCD_FILTER	"lcdfilter"
1506
#define FC_LCD_NONE	0
1507
#define FC_LCD_DEFAULT	1
1508
#define FC_LCD_LIGHT	2
1509
#define FC_LCD_LEGACY	3
1510
#endif
1511
1289
/* The load flags passed to FT_Load_Glyph control aspects like hinting and
1512
/* The load flags passed to FT_Load_Glyph control aspects like hinting and
1290
 * antialiasing. Here we compute them from the fields of a FcPattern.
1513
 * antialiasing. Here we compute them from the fields of a FcPattern.
1291
 */
1514
 */
Lines 1319-1324 Link Here
1319
    
1542
    
1320
    if (antialias) {
1543
    if (antialias) {
1321
	cairo_subpixel_order_t subpixel_order;
1544
	cairo_subpixel_order_t subpixel_order;
1545
	int lcd_filter;
1322
1546
1323
	/* disable hinting if requested */
1547
	/* disable hinting if requested */
1324
	if (FcPatternGetBool (pattern,
1548
	if (FcPatternGetBool (pattern,
Lines 1354-1359 Link Here
1354
	    ft_options.base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
1578
	    ft_options.base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
1355
	}
1579
	}
1356
1580
1581
	if (FcPatternGetInteger (pattern,
1582
				 FC_LCD_FILTER, 0, &lcd_filter) == FcResultMatch)
1583
	{
1584
	    switch (lcd_filter) {
1585
	    case FC_LCD_NONE:
1586
		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_NONE;
1587
		break;
1588
	    case FC_LCD_DEFAULT:
1589
		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR5;
1590
		break;
1591
	    case FC_LCD_LIGHT:
1592
		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR3;
1593
		break;
1594
	    case FC_LCD_LEGACY:
1595
		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL;
1596
		break;
1597
	    }
1598
	}
1599
1357
#ifdef FC_HINT_STYLE    
1600
#ifdef FC_HINT_STYLE    
1358
	if (FcPatternGetInteger (pattern, 
1601
	if (FcPatternGetInteger (pattern, 
1359
				 FC_HINT_STYLE, 0, &hintstyle) != FcResultMatch)
1602
				 FC_HINT_STYLE, 0, &hintstyle) != FcResultMatch)
Lines 1454-1459 Link Here
1454
    if (other->base.hint_style == CAIRO_HINT_STYLE_NONE)
1697
    if (other->base.hint_style == CAIRO_HINT_STYLE_NONE)
1455
	options->base.hint_style = CAIRO_HINT_STYLE_NONE;
1698
	options->base.hint_style = CAIRO_HINT_STYLE_NONE;
1456
1699
1700
    if (options->base.lcd_filter == CAIRO_LCD_FILTER_DEFAULT)
1701
	options->base.lcd_filter = other->base.lcd_filter;
1702
1703
    if (other->base.lcd_filter == CAIRO_LCD_FILTER_NONE)
1704
	options->base.lcd_filter = CAIRO_LCD_FILTER_NONE;
1705
1457
    if (options->base.antialias == CAIRO_ANTIALIAS_NONE) {
1706
    if (options->base.antialias == CAIRO_ANTIALIAS_NONE) {
1458
	if (options->base.hint_style == CAIRO_HINT_STYLE_NONE)
1707
	if (options->base.hint_style == CAIRO_HINT_STYLE_NONE)
1459
	    load_flags |= FT_LOAD_NO_HINTING;
1708
	    load_flags |= FT_LOAD_NO_HINTING;
Lines 1477-1487 Link Here
1477
		case CAIRO_SUBPIXEL_ORDER_DEFAULT:
1726
		case CAIRO_SUBPIXEL_ORDER_DEFAULT:
1478
		case CAIRO_SUBPIXEL_ORDER_RGB:
1727
		case CAIRO_SUBPIXEL_ORDER_RGB:
1479
		case CAIRO_SUBPIXEL_ORDER_BGR:
1728
		case CAIRO_SUBPIXEL_ORDER_BGR:
1480
		    load_target |= FT_LOAD_TARGET_LCD;
1729
		    load_target = FT_LOAD_TARGET_LCD;
1481
		    break;
1730
		    break;
1482
		case CAIRO_SUBPIXEL_ORDER_VRGB:
1731
		case CAIRO_SUBPIXEL_ORDER_VRGB:
1483
		case CAIRO_SUBPIXEL_ORDER_VBGR:
1732
		case CAIRO_SUBPIXEL_ORDER_VBGR:
1484
		    load_target |= FT_LOAD_TARGET_LCD_V;
1733
		    load_target = FT_LOAD_TARGET_LCD_V;
1485
		break;
1734
		break;
1486
		}
1735
		}
1487
	    }
1736
	    }
Lines 2446-2451 Link Here
2446
	}
2695
	}
2447
    }
2696
    }
2448
2697
2698
    if (options->lcd_filter != CAIRO_LCD_FILTER_DEFAULT)
2699
    {
2700
	if (FcPatternGet (pattern, FC_LCD_FILTER, 0, &v) == FcResultNoMatch)
2701
	{
2702
	    int lcd_filter;
2703
2704
	    switch (options->lcd_filter) {
2705
	    case CAIRO_LCD_FILTER_NONE:
2706
		lcd_filter = FT_LCD_FILTER_NONE;
2707
		break;
2708
	    case CAIRO_LCD_FILTER_DEFAULT:
2709
	    case CAIRO_LCD_FILTER_INTRA_PIXEL:
2710
		lcd_filter = FT_LCD_FILTER_LEGACY;
2711
		break;
2712
	    case CAIRO_LCD_FILTER_FIR3:
2713
		lcd_filter = FT_LCD_FILTER_LIGHT;
2714
		break;
2715
	    case CAIRO_LCD_FILTER_FIR5:
2716
		lcd_filter = FT_LCD_FILTER_DEFAULT;
2717
		break;
2718
	    }
2719
2720
	    if (! FcPatternAddInteger (pattern, FC_LCD_FILTER, lcd_filter))
2721
		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
2722
	}
2723
    }
2724
2449
    if (options->hint_style != CAIRO_HINT_STYLE_DEFAULT)
2725
    if (options->hint_style != CAIRO_HINT_STYLE_DEFAULT)
2450
    {
2726
    {
2451
	if (FcPatternGet (pattern, FC_HINTING, 0, &v) == FcResultNoMatch)
2727
	if (FcPatternGet (pattern, FC_HINTING, 0, &v) == FcResultNoMatch)
(-)../cairo-1.8.8.orig/src/cairo-types-private.h (+1 lines)
Lines 116-121 Link Here
116
struct _cairo_font_options {
116
struct _cairo_font_options {
117
    cairo_antialias_t antialias;
117
    cairo_antialias_t antialias;
118
    cairo_subpixel_order_t subpixel_order;
118
    cairo_subpixel_order_t subpixel_order;
119
    cairo_lcd_filter_t lcd_filter;
119
    cairo_hint_style_t hint_style;
120
    cairo_hint_style_t hint_style;
120
    cairo_hint_metrics_t hint_metrics;
121
    cairo_hint_metrics_t hint_metrics;
121
};
122
};
(-)../cairo-1.8.8.orig/src/cairo-xlib-screen.c (+37 lines)
Lines 143-148 Link Here
143
#define FC_LCD_LEGACY	3
143
#define FC_LCD_LEGACY	3
144
#endif
144
#endif
145
145
146
/* Fontconfig version older than 2.6 didn't have these options */
147
#ifndef FC_LCD_FILTER
148
#define FC_LCD_FILTER	"lcdfilter"
149
#define FC_LCD_NONE	0
150
#define FC_LCD_DEFAULT	1
151
#define FC_LCD_LIGHT	2
152
#define FC_LCD_LEGACY	3
153
#endif
154
146
static void
155
static void
147
_cairo_xlib_init_screen_font_options (Display *dpy, cairo_xlib_screen_info_t *info)
156
_cairo_xlib_init_screen_font_options (Display *dpy, cairo_xlib_screen_info_t *info)
148
{
157
{
Lines 150-161 Link Here
150
    cairo_bool_t xft_antialias;
159
    cairo_bool_t xft_antialias;
151
    int xft_hintstyle;
160
    int xft_hintstyle;
152
    int xft_rgba;
161
    int xft_rgba;
162
    int xft_lcdfilter;
153
    cairo_antialias_t antialias;
163
    cairo_antialias_t antialias;
154
    cairo_subpixel_order_t subpixel_order;
164
    cairo_subpixel_order_t subpixel_order;
165
    cairo_lcd_filter_t lcd_filter;
155
    cairo_hint_style_t hint_style;
166
    cairo_hint_style_t hint_style;
156
167
157
    if (!get_boolean_default (dpy, "antialias", &xft_antialias))
168
    if (!get_boolean_default (dpy, "antialias", &xft_antialias))
158
	xft_antialias = TRUE;
169
	xft_antialias = TRUE;
170
 
171
    if (!get_integer_default (dpy, "lcdfilter", &xft_lcdfilter)) {
172
	/* -1 is an non-existant Fontconfig constant used to differentiate
173
	 * the case when no lcdfilter property is available.
174
	 */
175
	xft_lcdfilter = -1;
176
    }
159
177
160
    if (!get_boolean_default (dpy, "hinting", &xft_hinting))
178
    if (!get_boolean_default (dpy, "hinting", &xft_hinting))
161
	xft_hinting = TRUE;
179
	xft_hinting = TRUE;
Lines 239-244 Link Here
239
	subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
257
	subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
240
    }
258
    }
241
259
260
    switch (xft_lcdfilter) {
261
    case FC_LCD_NONE:
262
	lcd_filter = CAIRO_LCD_FILTER_NONE;
263
	break;
264
    case FC_LCD_DEFAULT:
265
	lcd_filter = CAIRO_LCD_FILTER_FIR5;
266
	break;
267
    case FC_LCD_LIGHT:
268
	lcd_filter = CAIRO_LCD_FILTER_FIR3;
269
	break;
270
    case FC_LCD_LEGACY:
271
	lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL;
272
	break;
273
    default:
274
	lcd_filter = CAIRO_LCD_FILTER_DEFAULT;
275
	break;
276
    }
277
242
    if (xft_antialias) {
278
    if (xft_antialias) {
243
	if (subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT)
279
	if (subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT)
244
	    antialias = CAIRO_ANTIALIAS_GRAY;
280
	    antialias = CAIRO_ANTIALIAS_GRAY;
Lines 251-256 Link Here
251
    cairo_font_options_set_hint_style (&info->font_options, hint_style);
287
    cairo_font_options_set_hint_style (&info->font_options, hint_style);
252
    cairo_font_options_set_antialias (&info->font_options, antialias);
288
    cairo_font_options_set_antialias (&info->font_options, antialias);
253
    cairo_font_options_set_subpixel_order (&info->font_options, subpixel_order);
289
    cairo_font_options_set_subpixel_order (&info->font_options, subpixel_order);
290
    cairo_font_options_set_lcd_filter (&info->font_options, lcd_filter);
254
    cairo_font_options_set_hint_metrics (&info->font_options, CAIRO_HINT_METRICS_ON);
291
    cairo_font_options_set_hint_metrics (&info->font_options, CAIRO_HINT_METRICS_ON);
255
}
292
}
256
293
(-)../cairo-1.8.8.orig/src/cairo.h (+26 lines)
Lines 1046-1051 Link Here
1046
} cairo_subpixel_order_t;
1046
} cairo_subpixel_order_t;
1047
1047
1048
/**
1048
/**
1049
 * cairo_lcd_filter_t:
1050
 * @CAIRO_LCD_FILTER_DEFAULT: Use the default LCD filter for
1051
 *   font backend and target device
1052
 * @CAIRO_LCD_FILTER_NONE: Do not perform LCD filtering
1053
 * @CAIRO_LCD_FILTER_INTRA_PIXEL: Intra-pixel filter
1054
 * @CAIRO_LCD_FILTER_FIR3: FIR filter with a 3x3 kernel
1055
 * @CAIRO_LCD_FILTER_FIR5: FIR filter with a 5x5 kernel
1056
 *
1057
 * The LCD filter specifies the low-pass filter applied to LCD-optimized
1058
 * bitmaps generated with an antialiasing mode of %CAIRO_ANTIALIAS_SUBPIXEL.
1059
 **/
1060
typedef enum _cairo_lcd_filter {
1061
    CAIRO_LCD_FILTER_DEFAULT,
1062
    CAIRO_LCD_FILTER_NONE,
1063
    CAIRO_LCD_FILTER_INTRA_PIXEL,
1064
    CAIRO_LCD_FILTER_FIR3,
1065
    CAIRO_LCD_FILTER_FIR5
1066
} cairo_lcd_filter_t;
1067
1068
/**
1049
 * cairo_hint_style_t:
1069
 * cairo_hint_style_t:
1050
 * @CAIRO_HINT_STYLE_DEFAULT: Use the default hint style for
1070
 * @CAIRO_HINT_STYLE_DEFAULT: Use the default hint style for
1051
 *   font backend and target device
1071
 *   font backend and target device
Lines 1151-1156 Link Here
1151
cairo_font_options_get_subpixel_order (const cairo_font_options_t *options);
1171
cairo_font_options_get_subpixel_order (const cairo_font_options_t *options);
1152
1172
1153
cairo_public void
1173
cairo_public void
1174
cairo_font_options_set_lcd_filter (cairo_font_options_t   *options,
1175
				   cairo_lcd_filter_t  lcd_filter);
1176
cairo_public cairo_lcd_filter_t
1177
cairo_font_options_get_lcd_filter (const cairo_font_options_t *options);
1178
1179
cairo_public void
1154
cairo_font_options_set_hint_style (cairo_font_options_t *options,
1180
cairo_font_options_set_hint_style (cairo_font_options_t *options,
1155
				   cairo_hint_style_t     hint_style);
1181
				   cairo_hint_style_t     hint_style);
1156
cairo_public cairo_hint_style_t
1182
cairo_public cairo_hint_style_t

Return to bug 303421