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

Collapse All | Expand All

(-)cairo-1.8.0~/src/cairo-font-options.c (-1 / +50 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
 * Since: 1.8
348
 **/
349
void
350
_cairo_font_options_set_lcd_filter (cairo_font_options_t *options,
351
				    cairo_lcd_filter_t    lcd_filter)
352
{
353
    if (cairo_font_options_status (options))
354
	return;
355
356
    options->lcd_filter = lcd_filter;
357
}
358
359
/**
360
 * _cairo_font_options_get_lcd_filter:
361
 * @options: a #cairo_font_options_t
362
 *
363
 * Gets the LCD filter for the font options object.
364
 * See the documentation for #cairo_lcd_filter_t for full details.
365
 *
366
 * Return value: the LCD filter for the font options object
367
 *
368
 * Since: 1.8
369
 **/
370
cairo_lcd_filter_t
371
_cairo_font_options_get_lcd_filter (const cairo_font_options_t *options)
372
{
373
    if (cairo_font_options_status ((cairo_font_options_t *) options))
374
	return CAIRO_LCD_FILTER_DEFAULT;
375
376
    return options->lcd_filter;
377
}
378
379
/**
331
 * cairo_font_options_set_hint_style:
380
 * cairo_font_options_set_hint_style:
332
 * @options: a #cairo_font_options_t
381
 * @options: a #cairo_font_options_t
333
 * @hint_style: the new hint style
382
 * @hint_style: the new hint style
(-)cairo-1.8.0~/src/cairo-ft-font.c (-188 / +482 lines)
Lines 57-62 Link Here
57
#include FT_SYNTHESIS_H
57
#include FT_SYNTHESIS_H
58
#endif
58
#endif
59
59
60
#if HAVE_FT_LIBRARY_SETLCDFILTER
61
#include FT_LCD_FILTER_H
62
#endif
63
64
/* Fontconfig version older than 2.6 didn't have these options */
65
#ifndef FC_LCD_FILTER
66
#define FC_LCD_FILTER	"lcdfilter"
67
#endif
68
/* Some Ubuntu versions defined FC_LCD_FILTER without defining the following */
69
#ifndef FC_LCD_NONE
70
#define FC_LCD_NONE	0
71
#define FC_LCD_DEFAULT	1
72
#define FC_LCD_LIGHT	2
73
#define FC_LCD_LEGACY	3
74
#endif
75
76
/* FreeType version older than 2.3.5(?) didn't have these options */
77
#ifndef FT_LCD_FILTER_NONE
78
#define FT_LCD_FILTER_NONE	0
79
#define FT_LCD_FILTER_DEFAULT	1
80
#define FT_LCD_FILTER_LIGHT	2
81
#define FT_LCD_FILTER_LEGACY	16
82
#endif
83
60
#define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0))
84
#define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0))
61
#define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0)
85
#define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0)
62
#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
86
#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
Lines 737-759 Link Here
737
    return CAIRO_STATUS_SUCCESS;
761
    return CAIRO_STATUS_SUCCESS;
738
}
762
}
739
763
740
/* Empirically-derived subpixel filtering values thanks to Keith
764
/* we sometimes need to convert the glyph bitmap in a FT_GlyphSlot
741
 * Packard and libXft. */
765
 * into a different format. For example, we want to convert a
742
static const int    filters[3][3] = {
766
 * FT_PIXEL_MODE_LCD or FT_PIXEL_MODE_LCD_V bitmap into a 32-bit
743
    /* red */
767
 * ARGB or ABGR bitmap.
744
#if 0
768
 *
745
    {    65538*4/7,65538*2/7,65538*1/7 },
769
 * this function prepares a target descriptor for this operation.
746
    /* green */
770
 *
747
    {    65536*1/4, 65536*2/4, 65537*1/4 },
771
 * input :: target bitmap descriptor. The function will set its
748
    /* blue */
772
 *          'width', 'rows' and 'pitch' fields, and only these
749
    {    65538*1/7,65538*2/7,65538*4/7 },
773
 *
774
 * slot  :: the glyph slot containing the source bitmap. this
775
 *          function assumes that slot->format == FT_GLYPH_FORMAT_BITMAP
776
 *
777
 * mode  :: the requested final rendering mode. supported values are
778
 *          MONO, NORMAL (i.e. gray), LCD and LCD_V
779
 *
780
 * the function returns the size in bytes of the corresponding buffer,
781
 * it's up to the caller to allocate the corresponding memory block
782
 * before calling _fill_xrender_bitmap
783
 *
784
 * it also returns -1 in case of error (e.g. incompatible arguments,
785
 * like trying to convert a gray bitmap into a monochrome one)
786
 */
787
static int
788
_compute_xrender_bitmap_size(FT_Bitmap      *target,
789
			     FT_GlyphSlot    slot,
790
			     FT_Render_Mode  mode)
791
{
792
    FT_Bitmap *ftbit;
793
    int width, height, pitch;
794
795
    if (slot->format != FT_GLYPH_FORMAT_BITMAP)
796
	return -1;
797
798
    /* compute the size of the final bitmap */
799
    ftbit = &slot->bitmap;
800
801
    width = ftbit->width;
802
    height = ftbit->rows;
803
    pitch = (width + 3) & ~3;
804
805
    switch (ftbit->pixel_mode) {
806
    case FT_PIXEL_MODE_MONO:
807
	if (mode == FT_RENDER_MODE_MONO) {
808
	    pitch = (((width + 31) & ~31) >> 3);
809
	    break;
810
	}
811
	/* fall-through */
812
813
    case FT_PIXEL_MODE_GRAY:
814
	if (mode == FT_RENDER_MODE_LCD ||
815
	    mode == FT_RENDER_MODE_LCD_V)
816
	{
817
	    /* each pixel is replicated into a 32-bit ARGB value */
818
	    pitch = width * 4;
819
	}
820
	break;
821
822
    case FT_PIXEL_MODE_LCD:
823
	if (mode != FT_RENDER_MODE_LCD)
824
	    return -1;
825
826
	/* horz pixel triplets are packed into 32-bit ARGB values */
827
	width /= 3;
828
	pitch = width * 4;
829
	break;
830
831
    case FT_PIXEL_MODE_LCD_V:
832
	if (mode != FT_RENDER_MODE_LCD_V)
833
	    return -1;
834
835
	/* vert pixel triplets are packed into 32-bit ARGB values */
836
	height /= 3;
837
	pitch = width * 4;
838
	break;
839
840
    default:  /* unsupported source format */
841
	return -1;
842
    }
843
844
    target->width = width;
845
    target->rows = height;
846
    target->pitch = pitch;
847
    target->buffer = NULL;
848
849
    return pitch * height;
850
}
851
852
/* this functions converts the glyph bitmap found in a FT_GlyphSlot
853
 * into a different format (see _compute_xrender_bitmap_size)
854
 *
855
 * you should call this function after _compute_xrender_bitmap_size
856
 *
857
 * target :: target bitmap descriptor. Note that its 'buffer' pointer
858
 *           must point to memory allocated by the caller
859
 *
860
 * slot   :: the glyph slot containing the source bitmap
861
 *
862
 * mode   :: the requested final rendering mode
863
 *
864
 * bgr    :: boolean, set if BGR or VBGR pixel ordering is needed
865
 */
866
static void
867
_fill_xrender_bitmap(FT_Bitmap      *target,
868
		     FT_GlyphSlot    slot,
869
		     FT_Render_Mode  mode,
870
		     int             bgr)
871
{
872
    FT_Bitmap *ftbit = &slot->bitmap;
873
    unsigned char *srcLine = ftbit->buffer;
874
    unsigned char *dstLine = target->buffer;
875
    int src_pitch = ftbit->pitch;
876
    int width = target->width;
877
    int height = target->rows;
878
    int pitch = target->pitch;
879
    int subpixel;
880
    int h;
881
882
    subpixel = (mode == FT_RENDER_MODE_LCD ||
883
		mode == FT_RENDER_MODE_LCD_V);
884
885
    if (src_pitch < 0)
886
	srcLine -= src_pitch * (ftbit->rows - 1);
887
888
    target->pixel_mode = ftbit->pixel_mode;
889
890
    switch (ftbit->pixel_mode) {
891
    case FT_PIXEL_MODE_MONO:
892
	if (subpixel) {
893
	    /* convert mono to ARGB32 values */
894
895
	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
896
		int x;
897
898
		for (x = 0; x < width; x++) {
899
		    if (srcLine[(x >> 3)] & (0x80 >> (x & 7)))
900
			((unsigned int *) dstLine)[x] = 0xffffffffU;
901
		}
902
	    }
903
	    target->pixel_mode = FT_PIXEL_MODE_LCD;
904
905
	} else if (mode == FT_RENDER_MODE_NORMAL) {
906
	    /* convert mono to 8-bit gray */
907
908
	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
909
		int x;
910
911
		for (x = 0; x < width; x++) {
912
		    if (srcLine[(x >> 3)] & (0x80 >> (x & 7)))
913
			dstLine[x] = 0xff;
914
		}
915
	    }
916
	    target->pixel_mode = FT_PIXEL_MODE_GRAY;
917
918
	} else {
919
	    /* copy mono to mono */
920
921
	    int  bytes = (width + 7) >> 3;
922
923
	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch)
924
		memcpy (dstLine, srcLine, bytes);
925
	}
926
	break;
927
928
    case FT_PIXEL_MODE_GRAY:
929
	if (subpixel) {
930
	    /* convert gray to ARGB32 values */
931
932
	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
933
		int x;
934
		unsigned int *dst = (unsigned int *) dstLine;
935
936
		for (x = 0; x < width; x++) {
937
		    unsigned int pix = srcLine[x];
938
939
		    pix |= (pix << 8);
940
		    pix |= (pix << 16);
941
942
		    dst[x] = pix;
943
		}
944
	    }
945
	    target->pixel_mode = FT_PIXEL_MODE_LCD;
946
        } else {
947
            /* copy gray into gray */
948
949
            for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch)
950
                memcpy (dstLine, srcLine, width);
951
        }
952
        break;
953
954
    case FT_PIXEL_MODE_LCD:
955
	if (!bgr) {
956
	    /* convert horizontal RGB into ARGB32 */
957
958
	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
959
		int x;
960
		unsigned char *src = srcLine;
961
		unsigned int *dst = (unsigned int *) dstLine;
962
963
		for (x = 0; x < width; x++, src += 3) {
964
		    unsigned int  pix;
965
966
		    pix = ((unsigned int)src[0] << 16) |
967
			  ((unsigned int)src[1] <<  8) |
968
			  ((unsigned int)src[2]      ) |
969
			  ((unsigned int)src[1] << 24) ;
970
971
		    dst[x] = pix;
972
		}
973
	    }
974
	} else {
975
	    /* convert horizontal BGR into ARGB32 */
976
977
	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
978
979
		int x;
980
		unsigned char *src = srcLine;
981
		unsigned int *dst = (unsigned int *) dstLine;
982
983
		for (x = 0; x < width; x++, src += 3) {
984
		    unsigned int  pix;
985
986
		    pix = ((unsigned int)src[2] << 16) |
987
			  ((unsigned int)src[1] <<  8) |
988
			  ((unsigned int)src[0]      ) |
989
			  ((unsigned int)src[1] << 24) ;
990
991
		    dst[x] = pix;
992
		}
993
	    }
994
	}
995
	break;
996
997
    default:  /* FT_PIXEL_MODE_LCD_V */
998
	/* convert vertical RGB into ARGB32 */
999
	if (!bgr) {
1000
1001
	    for (h = height; h > 0; h--, srcLine += 3 * src_pitch, dstLine += pitch) {
1002
		int x;
1003
		unsigned char* src = srcLine;
1004
		unsigned int*  dst = (unsigned int *) dstLine;
1005
1006
		for (x = 0; x < width; x++, src += 1) {
1007
		    unsigned int pix;
1008
#if 1
1009
		    pix = ((unsigned int)src[0]           << 16) |
1010
			  ((unsigned int)src[src_pitch]   <<  8) |
1011
			  ((unsigned int)src[src_pitch*2]      ) |
1012
			  0xFF000000 ;
1013
#else
1014
		    pix = ((unsigned int)src[0]           << 16) |
1015
			  ((unsigned int)src[src_pitch]   <<  8) |
1016
			  ((unsigned int)src[src_pitch*2]      ) |
1017
			  ((unsigned int)src[src_pitch]   << 24) ;
750
#endif
1018
#endif
751
    {    65538*9/13,65538*3/13,65538*1/13 },
1019
		    dst[x] = pix;
752
    /* green */
1020
		}
753
    {    65538*1/6, 65538*4/6, 65538*1/6 },
1021
	    }
754
    /* blue */
1022
	} else {
755
    {    65538*1/13,65538*3/13,65538*9/13 },
1023
756
};
1024
	    for (h = height; h > 0; h--, srcLine += 3*src_pitch, dstLine += pitch) {
1025
		int x;
1026
		unsigned char *src = srcLine;
1027
		unsigned int *dst = (unsigned int *) dstLine;
1028
1029
		for (x = 0; x < width; x++, src += 1) {
1030
		    unsigned int  pix;
1031
1032
		    pix = ((unsigned int)src[src_pitch * 2] << 16) |
1033
			  ((unsigned int)src[src_pitch]     <<  8) |
1034
			  ((unsigned int)src[0]                  ) |
1035
			  ((unsigned int)src[src_pitch]     << 24) ;
1036
1037
		    dst[x] = pix;
1038
		}
1039
	    }
1040
	}
1041
    }
1042
}
1043
757
1044
758
/* Fills in val->image with an image surface created from @bitmap
1045
/* Fills in val->image with an image surface created from @bitmap
759
 */
1046
 */
Lines 766-772 Link Here
766
    int width, height, stride;
1053
    int width, height, stride;
767
    unsigned char *data;
1054
    unsigned char *data;
768
    int format = CAIRO_FORMAT_A8;
1055
    int format = CAIRO_FORMAT_A8;
769
    cairo_bool_t subpixel = FALSE;
1056
    cairo_image_surface_t *image;
770
1057
771
    width = bitmap->width;
1058
    width = bitmap->width;
772
    height = bitmap->rows;
1059
    height = bitmap->rows;
Lines 823-833 Link Here
823
    case FT_PIXEL_MODE_LCD:
1110
    case FT_PIXEL_MODE_LCD:
824
    case FT_PIXEL_MODE_LCD_V:
1111
    case FT_PIXEL_MODE_LCD_V:
825
    case FT_PIXEL_MODE_GRAY:
1112
    case FT_PIXEL_MODE_GRAY:
826
	switch (font_options->antialias) {
1113
        if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) {
827
	case CAIRO_ANTIALIAS_DEFAULT:
828
	case CAIRO_ANTIALIAS_GRAY:
829
	case CAIRO_ANTIALIAS_NONE:
830
	default:
831
	    stride = bitmap->pitch;
1114
	    stride = bitmap->pitch;
832
	    if (own_buffer) {
1115
	    if (own_buffer) {
833
		data = bitmap->buffer;
1116
		data = bitmap->buffer;
Lines 839-942 Link Here
839
		memcpy (data, bitmap->buffer, stride * height);
1122
		memcpy (data, bitmap->buffer, stride * height);
840
	    }
1123
	    }
841
	    format = CAIRO_FORMAT_A8;
1124
	    format = CAIRO_FORMAT_A8;
842
	    break;
1125
	} else {
843
	case CAIRO_ANTIALIAS_SUBPIXEL: {
1126
	    /* if we get there, the  data from the source bitmap
844
	    int		    x, y;
1127
	     * really comes from _fill_xrender_bitmap, and is
845
	    unsigned char   *in_line, *out_line, *in;
1128
	     * made of 32-bit ARGB or ABGR values */
846
	    unsigned int    *out;
1129
	    assert (own_buffer != 0);
847
	    unsigned int    red, green, blue;
1130
	    assert (bitmap->pixel_mode != FT_PIXEL_MODE_GRAY);
848
	    int		    rf, gf, bf;
849
	    int		    s;
850
	    int		    o, os;
851
	    unsigned char   *data_rgba;
852
	    unsigned int    width_rgba, stride_rgba;
853
	    int		    vmul = 1;
854
	    int		    hmul = 1;
855
1131
856
	    switch (font_options->subpixel_order) {
1132
	    data = bitmap->buffer;
857
	    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
858
	    case CAIRO_SUBPIXEL_ORDER_RGB:
859
	    case CAIRO_SUBPIXEL_ORDER_BGR:
860
	    default:
861
		width /= 3;
862
		hmul = 3;
863
		break;
864
	    case CAIRO_SUBPIXEL_ORDER_VRGB:
865
	    case CAIRO_SUBPIXEL_ORDER_VBGR:
866
		vmul = 3;
867
		height /= 3;
868
		break;
869
	    }
870
	    /*
871
	     * Filter the glyph to soften the color fringes
872
	     */
873
	    width_rgba = width;
874
	    stride = bitmap->pitch;
1133
	    stride = bitmap->pitch;
875
	    stride_rgba = (width_rgba * 4 + 3) & ~3;
876
	    data_rgba = calloc (stride_rgba, height);
877
	    if (data_rgba == NULL) {
878
		if (own_buffer)
879
		    free (bitmap->buffer);
880
		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
881
	    }
882
883
	    os = 1;
884
	    switch (font_options->subpixel_order) {
885
	    case CAIRO_SUBPIXEL_ORDER_VRGB:
886
		os = stride;
887
	    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
888
	    case CAIRO_SUBPIXEL_ORDER_RGB:
889
	    default:
890
		rf = 0;
891
		gf = 1;
892
		bf = 2;
893
		break;
894
	    case CAIRO_SUBPIXEL_ORDER_VBGR:
895
		os = stride;
896
	    case CAIRO_SUBPIXEL_ORDER_BGR:
897
		bf = 0;
898
		gf = 1;
899
		rf = 2;
900
		break;
901
	    }
902
	    in_line = bitmap->buffer;
903
	    out_line = data_rgba;
904
	    for (y = 0; y < height; y++)
905
	    {
906
		in = in_line;
907
		out = (unsigned int *) out_line;
908
		in_line += stride * vmul;
909
		out_line += stride_rgba;
910
		for (x = 0; x < width * hmul; x += hmul)
911
		{
912
		    red = green = blue = 0;
913
		    o = 0;
914
		    for (s = 0; s < 3; s++)
915
		    {
916
			red += filters[rf][s]*in[x+o];
917
			green += filters[gf][s]*in[x+o];
918
			blue += filters[bf][s]*in[x+o];
919
			o += os;
920
		    }
921
		    red = red / 65536;
922
		    green = green / 65536;
923
		    blue = blue / 65536;
924
		    *out++ = (green << 24) | (red << 16) | (green << 8) | blue;
925
		}
926
	    }
927
928
	    /* Images here are stored in native format. The
929
	     * backend must convert to its own format as needed
930
	     */
931
932
	    if (own_buffer)
933
		free (bitmap->buffer);
934
	    data = data_rgba;
935
	    stride = stride_rgba;
936
	    format = CAIRO_FORMAT_ARGB32;
1134
	    format = CAIRO_FORMAT_ARGB32;
937
	    subpixel = TRUE;
938
	    break;
939
	}
940
	}
1135
	}
941
	break;
1136
	break;
942
    case FT_PIXEL_MODE_GRAY2:
1137
    case FT_PIXEL_MODE_GRAY2:
Lines 948-966 Link Here
948
	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
1143
	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
949
    }
1144
    }
950
1145
951
    *surface = (cairo_image_surface_t *)
1146
    /* XXX */
1147
    *surface = image = (cairo_image_surface_t *)
952
	cairo_image_surface_create_for_data (data,
1148
	cairo_image_surface_create_for_data (data,
953
					     format,
1149
					     format,
954
					     width, height, stride);
1150
					     width, height, stride);
955
    if ((*surface)->base.status) {
1151
    if (image->base.status) {
956
	free (data);
1152
	free (data);
957
	return (*surface)->base.status;
1153
	return (*surface)->base.status;
958
    }
1154
    }
959
1155
960
    if (subpixel)
1156
    if (font_options->antialias == CAIRO_ANTIALIAS_SUBPIXEL)
961
	pixman_image_set_component_alpha ((*surface)->pixman_image, TRUE);
1157
	pixman_image_set_component_alpha (image->pixman_image, TRUE);
962
1158
963
    _cairo_image_surface_assume_ownership_of_data ((*surface));
1159
    _cairo_image_surface_assume_ownership_of_data (image);
964
1160
965
    return CAIRO_STATUS_SUCCESS;
1161
    return CAIRO_STATUS_SUCCESS;
966
}
1162
}
Lines 985-1000 Link Here
985
		       cairo_font_options_t	 *font_options,
1181
		       cairo_font_options_t	 *font_options,
986
		       cairo_image_surface_t	**surface)
1182
		       cairo_image_surface_t	**surface)
987
{
1183
{
1184
    int rgba = FC_RGBA_UNKNOWN;
1185
    int lcd_filter = FT_LCD_FILTER_LEGACY;
988
    FT_GlyphSlot glyphslot = face->glyph;
1186
    FT_GlyphSlot glyphslot = face->glyph;
989
    FT_Outline *outline = &glyphslot->outline;
1187
    FT_Outline *outline = &glyphslot->outline;
990
    FT_Bitmap bitmap;
1188
    FT_Bitmap bitmap;
991
    FT_BBox cbox;
1189
    FT_BBox cbox;
992
    FT_Matrix matrix;
1190
    unsigned int width, height;
993
    int hmul = 1;
994
    int vmul = 1;
995
    unsigned int width, height, stride;
996
    cairo_bool_t subpixel = FALSE;
997
    cairo_status_t status;
1191
    cairo_status_t status;
1192
    FT_Error fterror;
1193
    FT_Library library = glyphslot->library;
1194
    FT_Render_Mode render_mode = FT_RENDER_MODE_NORMAL;
1195
1196
    switch (font_options->antialias) {
1197
    case CAIRO_ANTIALIAS_NONE:
1198
	render_mode = FT_RENDER_MODE_MONO;
1199
	break;
1200
1201
    case CAIRO_ANTIALIAS_SUBPIXEL:
1202
	switch (font_options->subpixel_order) {
1203
	    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
1204
	    case CAIRO_SUBPIXEL_ORDER_RGB:
1205
	    case CAIRO_SUBPIXEL_ORDER_BGR:
1206
		render_mode = FT_RENDER_MODE_LCD;
1207
		break;
1208
1209
	    case CAIRO_SUBPIXEL_ORDER_VRGB:
1210
	    case CAIRO_SUBPIXEL_ORDER_VBGR:
1211
		render_mode = FT_RENDER_MODE_LCD_V;
1212
		break;
1213
	}
1214
1215
	switch (font_options->lcd_filter) {
1216
	case CAIRO_LCD_FILTER_NONE:
1217
	    lcd_filter = FT_LCD_FILTER_NONE;
1218
	    break;
1219
	case CAIRO_LCD_FILTER_DEFAULT:
1220
	case CAIRO_LCD_FILTER_INTRA_PIXEL:
1221
	    lcd_filter = FT_LCD_FILTER_LEGACY;
1222
	    break;
1223
	case CAIRO_LCD_FILTER_FIR3:
1224
	    lcd_filter = FT_LCD_FILTER_LIGHT;
1225
	    break;
1226
	case CAIRO_LCD_FILTER_FIR5:
1227
	    lcd_filter = FT_LCD_FILTER_DEFAULT;
1228
	    break;
1229
	}
1230
1231
	break;
1232
1233
    case CAIRO_ANTIALIAS_DEFAULT:
1234
    case CAIRO_ANTIALIAS_GRAY:
1235
	render_mode = FT_RENDER_MODE_NORMAL;
1236
    }
998
1237
999
    FT_Outline_Get_CBox (outline, &cbox);
1238
    FT_Outline_Get_CBox (outline, &cbox);
1000
1239
Lines 1005-1024 Link Here
1005
1244
1006
    width = (unsigned int) ((cbox.xMax - cbox.xMin) >> 6);
1245
    width = (unsigned int) ((cbox.xMax - cbox.xMin) >> 6);
1007
    height = (unsigned int) ((cbox.yMax - cbox.yMin) >> 6);
1246
    height = (unsigned int) ((cbox.yMax - cbox.yMin) >> 6);
1008
    stride = (width * hmul + 3) & ~3;
1009
1247
1010
    if (width * height == 0) {
1248
    if (width * height == 0) {
1011
	cairo_format_t format;
1249
	cairo_format_t format;
1012
	/* Looks like fb handles zero-sized images just fine */
1250
	/* Looks like fb handles zero-sized images just fine */
1013
	switch (font_options->antialias) {
1251
	switch (render_mode) {
1014
	case CAIRO_ANTIALIAS_NONE:
1252
	case FT_RENDER_MODE_MONO:
1015
	    format = CAIRO_FORMAT_A1;
1253
	    format = CAIRO_FORMAT_A1;
1016
	    break;
1254
	    break;
1017
	case CAIRO_ANTIALIAS_SUBPIXEL:
1255
	case FT_RENDER_MODE_LCD:
1256
	case FT_RENDER_MODE_LCD_V:
1018
	    format= CAIRO_FORMAT_ARGB32;
1257
	    format= CAIRO_FORMAT_ARGB32;
1019
	    break;
1258
	    break;
1020
	case CAIRO_ANTIALIAS_DEFAULT:
1259
	case FT_RENDER_MODE_LIGHT:
1021
	case CAIRO_ANTIALIAS_GRAY:
1260
	case FT_RENDER_MODE_NORMAL:
1261
	case FT_RENDER_MODE_MAX:
1022
	default:
1262
	default:
1023
	    format = CAIRO_FORMAT_A8;
1263
	    format = CAIRO_FORMAT_A8;
1024
	    break;
1264
	    break;
Lines 1030-1102 Link Here
1030
	    return (*surface)->base.status;
1270
	    return (*surface)->base.status;
1031
    } else  {
1271
    } else  {
1032
1272
1033
	matrix.xx = matrix.yy = 0x10000L;
1273
	int bitmap_size;
1034
	matrix.xy = matrix.yx = 0;
1035
1274
1036
	switch (font_options->antialias) {
1275
	switch (render_mode) {
1037
	case CAIRO_ANTIALIAS_NONE:
1276
	case FT_RENDER_MODE_LCD:
1038
	    bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
1277
	    if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_BGR) {
1039
	    bitmap.num_grays  = 1;
1278
		rgba = FC_RGBA_BGR;
1040
	    stride = ((width + 31) & -32) >> 3;
1279
	    } else {
1041
	    break;
1280
		rgba = FC_RGBA_RGB;
1042
	case CAIRO_ANTIALIAS_DEFAULT:
1281
	    }
1043
	case CAIRO_ANTIALIAS_GRAY:
1044
	    bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
1045
	    bitmap.num_grays  = 256;
1046
	    stride = (width + 3) & -4;
1047
	    break;
1282
	    break;
1048
	case CAIRO_ANTIALIAS_SUBPIXEL:
1283
	case FT_RENDER_MODE_LCD_V:
1049
	    switch (font_options->subpixel_order) {
1284
	    if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_VBGR) {
1050
	    case CAIRO_SUBPIXEL_ORDER_RGB:
1285
		rgba = FC_RGBA_VBGR;
1051
	    case CAIRO_SUBPIXEL_ORDER_BGR:
1286
	    } else {
1052
	    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
1287
		rgba = FC_RGBA_VRGB;
1053
	    default:
1054
		matrix.xx *= 3;
1055
		hmul = 3;
1056
		subpixel = TRUE;
1057
		break;
1058
	    case CAIRO_SUBPIXEL_ORDER_VRGB:
1059
	    case CAIRO_SUBPIXEL_ORDER_VBGR:
1060
		matrix.yy *= 3;
1061
		vmul = 3;
1062
		subpixel = TRUE;
1063
		break;
1064
	    }
1288
	    }
1065
	    FT_Outline_Transform (outline, &matrix);
1289
	    break;
1066
1290
	case FT_RENDER_MODE_MONO:
1067
	    bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
1291
	case FT_RENDER_MODE_LIGHT:
1068
	    bitmap.num_grays  = 256;
1292
	case FT_RENDER_MODE_NORMAL:
1069
	    stride = (width * hmul + 3) & -4;
1293
	case FT_RENDER_MODE_MAX:
1294
	default:
1295
	    break;
1070
	}
1296
	}
1071
1297
1072
	bitmap.pitch = stride;
1298
#if HAVE_FT_LIBRARY_SETLCDFILTER
1073
	bitmap.width = width * hmul;
1299
	FT_Library_SetLcdFilter (library, lcd_filter);
1074
	bitmap.rows = height * vmul;
1300
#endif
1075
	bitmap.buffer = calloc (stride, bitmap.rows);
1301
1076
	if (bitmap.buffer == NULL)
1302
	fterror = FT_Render_Glyph (face->glyph, render_mode);
1303
1304
#if HAVE_FT_LIBRARY_SETLCDFILTER
1305
	FT_Library_SetLcdFilter (library, FT_LCD_FILTER_NONE);
1306
#endif
1307
1308
	if (fterror != 0)
1077
	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
1309
	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
1078
1310
1079
	FT_Outline_Translate (outline, -cbox.xMin*hmul, -cbox.yMin*vmul);
1311
	bitmap_size = _compute_xrender_bitmap_size (&bitmap,
1312
						    face->glyph,
1313
						    render_mode);
1314
	if (bitmap_size < 0)
1315
	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
1080
1316
1081
	if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) {
1317
	bitmap.buffer = calloc (1, bitmap_size);
1082
	    free (bitmap.buffer);
1318
	if (bitmap.buffer == NULL)
1083
	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
1319
	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
1084
	}
1085
1320
1321
	_fill_xrender_bitmap (&bitmap, face->glyph, render_mode,
1322
			      (rgba == FC_RGBA_BGR || rgba == FC_RGBA_VBGR));
1323
1324
	/* Note:
1325
	 * _get_bitmap_surface will free bitmap.buffer if there is an error
1326
	 */
1086
	status = _get_bitmap_surface (&bitmap, TRUE, font_options, surface);
1327
	status = _get_bitmap_surface (&bitmap, TRUE, font_options, surface);
1087
	if (status)
1328
	if (status)
1088
	    return status;
1329
	    return status;
1089
    }
1090
1330
1091
    /*
1331
	/* Note: the font's coordinate system is upside down from ours, so the
1092
     * Note: the font's coordinate system is upside down from ours, so the
1332
	 * Y coordinate of the control box needs to be negated.  Moreover, device
1093
     * Y coordinate of the control box needs to be negated.  Moreover, device
1333
	 * offsets are position of glyph origin relative to top left while xMin
1094
     * offsets are position of glyph origin relative to top left while xMin
1334
	 * and yMax are offsets of top left relative to origin.  Another negation.
1095
     * and yMax are offsets of top left relative to origin.  Another negation.
1335
	 */
1096
     */
1336
	cairo_surface_set_device_offset (&(*surface)->base,
1097
    cairo_surface_set_device_offset (&(*surface)->base,
1337
					 (double)-glyphslot->bitmap_left,
1098
				     floor (-(double) cbox.xMin / 64.0),
1338
					 (double)+glyphslot->bitmap_top);
1099
				     floor (+(double) cbox.yMax / 64.0));
1339
    }
1100
1340
1101
    return CAIRO_STATUS_SUCCESS;
1341
    return CAIRO_STATUS_SUCCESS;
1102
}
1342
}
Lines 1316-1321 Link Here
1316
    
1556
    
1317
    if (antialias) {
1557
    if (antialias) {
1318
	cairo_subpixel_order_t subpixel_order;
1558
	cairo_subpixel_order_t subpixel_order;
1559
	int lcd_filter;
1319
1560
1320
	/* disable hinting if requested */
1561
	/* disable hinting if requested */
1321
	if (FcPatternGetBool (pattern,
1562
	if (FcPatternGetBool (pattern,
Lines 1351-1356 Link Here
1351
	    ft_options.base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
1592
	    ft_options.base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
1352
	}
1593
	}
1353
1594
1595
	if (FcPatternGetInteger (pattern,
1596
				 FC_LCD_FILTER, 0, &lcd_filter) == FcResultMatch)
1597
	{
1598
	    switch (lcd_filter) {
1599
	    case FC_LCD_NONE:
1600
		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_NONE;
1601
		break;
1602
	    case FC_LCD_DEFAULT:
1603
		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR5;
1604
		break;
1605
	    case FC_LCD_LIGHT:
1606
		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR3;
1607
		break;
1608
	    case FC_LCD_LEGACY:
1609
		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL;
1610
		break;
1611
	    }
1612
	}
1613
1354
#ifdef FC_HINT_STYLE    
1614
#ifdef FC_HINT_STYLE    
1355
	if (FcPatternGetInteger (pattern, 
1615
	if (FcPatternGetInteger (pattern, 
1356
				 FC_HINT_STYLE, 0, &hintstyle) != FcResultMatch)
1616
				 FC_HINT_STYLE, 0, &hintstyle) != FcResultMatch)
Lines 1451-1456 Link Here
1451
    if (other->base.hint_style == CAIRO_HINT_STYLE_NONE)
1711
    if (other->base.hint_style == CAIRO_HINT_STYLE_NONE)
1452
	options->base.hint_style = CAIRO_HINT_STYLE_NONE;
1712
	options->base.hint_style = CAIRO_HINT_STYLE_NONE;
1453
1713
1714
    if (options->base.lcd_filter == CAIRO_LCD_FILTER_DEFAULT)
1715
	options->base.lcd_filter = other->base.lcd_filter;
1716
1717
    if (other->base.lcd_filter == CAIRO_LCD_FILTER_NONE)
1718
	options->base.lcd_filter = CAIRO_LCD_FILTER_NONE;
1719
1454
    if (options->base.antialias == CAIRO_ANTIALIAS_NONE) {
1720
    if (options->base.antialias == CAIRO_ANTIALIAS_NONE) {
1455
	if (options->base.hint_style == CAIRO_HINT_STYLE_NONE)
1721
	if (options->base.hint_style == CAIRO_HINT_STYLE_NONE)
1456
	    load_flags |= FT_LOAD_NO_HINTING;
1722
	    load_flags |= FT_LOAD_NO_HINTING;
Lines 1474-1484 Link Here
1474
		case CAIRO_SUBPIXEL_ORDER_DEFAULT:
1740
		case CAIRO_SUBPIXEL_ORDER_DEFAULT:
1475
		case CAIRO_SUBPIXEL_ORDER_RGB:
1741
		case CAIRO_SUBPIXEL_ORDER_RGB:
1476
		case CAIRO_SUBPIXEL_ORDER_BGR:
1742
		case CAIRO_SUBPIXEL_ORDER_BGR:
1477
		    load_target |= FT_LOAD_TARGET_LCD;
1743
		    load_target = FT_LOAD_TARGET_LCD;
1478
		    break;
1744
		    break;
1479
		case CAIRO_SUBPIXEL_ORDER_VRGB:
1745
		case CAIRO_SUBPIXEL_ORDER_VRGB:
1480
		case CAIRO_SUBPIXEL_ORDER_VBGR:
1746
		case CAIRO_SUBPIXEL_ORDER_VBGR:
1481
		    load_target |= FT_LOAD_TARGET_LCD_V;
1747
		    load_target = FT_LOAD_TARGET_LCD_V;
1482
		break;
1748
		break;
1483
		}
1749
		}
1484
	    }
1750
	    }
Lines 2421-2426 Link Here
2421
	}
2687
	}
2422
    }
2688
    }
2423
2689
2690
    if (options->lcd_filter != CAIRO_LCD_FILTER_DEFAULT)
2691
    {
2692
	if (FcPatternGet (pattern, FC_LCD_FILTER, 0, &v) == FcResultNoMatch)
2693
	{
2694
	    int lcd_filter;
2695
2696
	    switch (options->lcd_filter) {
2697
	    case CAIRO_LCD_FILTER_NONE:
2698
		lcd_filter = FT_LCD_FILTER_NONE;
2699
		break;
2700
	    case CAIRO_LCD_FILTER_DEFAULT:
2701
	    case CAIRO_LCD_FILTER_INTRA_PIXEL:
2702
		lcd_filter = FT_LCD_FILTER_LEGACY;
2703
		break;
2704
	    case CAIRO_LCD_FILTER_FIR3:
2705
		lcd_filter = FT_LCD_FILTER_LIGHT;
2706
		break;
2707
	    default:
2708
	    case CAIRO_LCD_FILTER_FIR5:
2709
		lcd_filter = FT_LCD_FILTER_DEFAULT;
2710
		break;
2711
	    }
2712
2713
	    if (! FcPatternAddInteger (pattern, FC_LCD_FILTER, lcd_filter))
2714
		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
2715
	}
2716
    }
2717
2424
    if (options->hint_style != CAIRO_HINT_STYLE_DEFAULT)
2718
    if (options->hint_style != CAIRO_HINT_STYLE_DEFAULT)
2425
    {
2719
    {
2426
	if (FcPatternGet (pattern, FC_HINTING, 0, &v) == FcResultNoMatch)
2720
	if (FcPatternGet (pattern, FC_HINTING, 0, &v) == FcResultNoMatch)
(-)cairo-1.8.0~/src/cairo-surface.c (+1 lines)
Lines 73-78 Link Here
73
    FALSE,				/* has_font_options */	\
73
    FALSE,				/* has_font_options */	\
74
    { CAIRO_ANTIALIAS_DEFAULT,		/* antialias */		\
74
    { CAIRO_ANTIALIAS_DEFAULT,		/* antialias */		\
75
      CAIRO_SUBPIXEL_ORDER_DEFAULT,	/* subpixel_order */	\
75
      CAIRO_SUBPIXEL_ORDER_DEFAULT,	/* subpixel_order */	\
76
      CAIRO_LCD_FILTER_DEFAULT,		/* lcd_filter */	\
76
      CAIRO_HINT_STYLE_DEFAULT,		/* hint_style */	\
77
      CAIRO_HINT_STYLE_DEFAULT,		/* hint_style */	\
77
      CAIRO_HINT_METRICS_DEFAULT	/* hint_metrics */	\
78
      CAIRO_HINT_METRICS_DEFAULT	/* hint_metrics */	\
78
    }					/* font_options */	\
79
    }					/* font_options */	\
(-)cairo-1.8.0~/src/cairo-types-private.h (+26 lines)
Lines 113-121 Link Here
113
    cairo_bool_t is_snapshot;
113
    cairo_bool_t is_snapshot;
114
};
114
};
115
115
116
117
/**
118
 * cairo_lcd_filter_t:
119
 * @CAIRO_LCD_FILTER_DEFAULT: Use the default LCD filter for
120
 *   font backend and target device
121
 * @CAIRO_LCD_FILTER_NONE: Do not perform LCD filtering
122
 * @CAIRO_LCD_FILTER_INTRA_PIXEL: Intra-pixel filter
123
 * @CAIRO_LCD_FILTER_FIR3: FIR filter with a 3x3 kernel
124
 * @CAIRO_LCD_FILTER_FIR5: FIR filter with a 5x5 kernel
125
 *
126
 * The LCD filter specifies the low-pass filter applied to LCD-optimized
127
 * bitmaps generated with an antialiasing mode of %CAIRO_ANTIALIAS_SUBPIXEL.
128
 *
129
 * Note: This API was temporarily made available in the public
130
 * interface during the 1.7.x development series, but was made private
131
 * before 1.8.
132
 **/
133
typedef enum _cairo_lcd_filter {
134
    CAIRO_LCD_FILTER_DEFAULT,
135
    CAIRO_LCD_FILTER_NONE,
136
    CAIRO_LCD_FILTER_INTRA_PIXEL,
137
    CAIRO_LCD_FILTER_FIR3,
138
    CAIRO_LCD_FILTER_FIR5
139
} cairo_lcd_filter_t;
140
116
struct _cairo_font_options {
141
struct _cairo_font_options {
117
    cairo_antialias_t antialias;
142
    cairo_antialias_t antialias;
118
    cairo_subpixel_order_t subpixel_order;
143
    cairo_subpixel_order_t subpixel_order;
144
    cairo_lcd_filter_t lcd_filter;
119
    cairo_hint_style_t hint_style;
145
    cairo_hint_style_t hint_style;
120
    cairo_hint_metrics_t hint_metrics;
146
    cairo_hint_metrics_t hint_metrics;
121
};
147
};
(-)cairo-1.8.0~/src/cairo-xlib-screen.c (+28 lines)
Lines 150-162 Link Here
150
    cairo_bool_t xft_antialias;
150
    cairo_bool_t xft_antialias;
151
    int xft_hintstyle;
151
    int xft_hintstyle;
152
    int xft_rgba;
152
    int xft_rgba;
153
    int xft_lcdfilter;
153
    cairo_antialias_t antialias;
154
    cairo_antialias_t antialias;
154
    cairo_subpixel_order_t subpixel_order;
155
    cairo_subpixel_order_t subpixel_order;
156
    cairo_lcd_filter_t lcd_filter;
155
    cairo_hint_style_t hint_style;
157
    cairo_hint_style_t hint_style;
156
158
157
    if (!get_boolean_default (dpy, "antialias", &xft_antialias))
159
    if (!get_boolean_default (dpy, "antialias", &xft_antialias))
158
	xft_antialias = TRUE;
160
	xft_antialias = TRUE;
159
161
162
    if (!get_integer_default (dpy, "lcdfilter", &xft_lcdfilter)) {
163
	/* -1 is an non-existant Fontconfig constant used to differentiate
164
	 * the case when no lcdfilter property is available.
165
	 */
166
	xft_lcdfilter = -1;
167
    }
168
160
    if (!get_boolean_default (dpy, "hinting", &xft_hinting))
169
    if (!get_boolean_default (dpy, "hinting", &xft_hinting))
161
	xft_hinting = TRUE;
170
	xft_hinting = TRUE;
162
171
Lines 239-244 Link Here
239
	subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
248
	subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
240
    }
249
    }
241
250
251
    switch (xft_lcdfilter) {
252
    case FC_LCD_NONE:
253
	lcd_filter = CAIRO_LCD_FILTER_NONE;
254
	break;
255
    case FC_LCD_DEFAULT:
256
	lcd_filter = CAIRO_LCD_FILTER_FIR5;
257
	break;
258
    case FC_LCD_LIGHT:
259
	lcd_filter = CAIRO_LCD_FILTER_FIR3;
260
	break;
261
    case FC_LCD_LEGACY:
262
	lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL;
263
	break;
264
    default:
265
	lcd_filter = CAIRO_LCD_FILTER_DEFAULT;
266
	break;
267
    }
268
242
    if (xft_antialias) {
269
    if (xft_antialias) {
243
	if (subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT)
270
	if (subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT)
244
	    antialias = CAIRO_ANTIALIAS_GRAY;
271
	    antialias = CAIRO_ANTIALIAS_GRAY;
Lines 251-256 Link Here
251
    cairo_font_options_set_hint_style (&info->font_options, hint_style);
278
    cairo_font_options_set_hint_style (&info->font_options, hint_style);
252
    cairo_font_options_set_antialias (&info->font_options, antialias);
279
    cairo_font_options_set_antialias (&info->font_options, antialias);
253
    cairo_font_options_set_subpixel_order (&info->font_options, subpixel_order);
280
    cairo_font_options_set_subpixel_order (&info->font_options, subpixel_order);
281
    _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);
282
    cairo_font_options_set_hint_metrics (&info->font_options, CAIRO_HINT_METRICS_ON);
255
}
283
}
256
284
(-)cairo-1.8.0~/src/cairoint.h (+7 lines)
Lines 1336-1341 Link Here
1336
_cairo_font_options_init_copy (cairo_font_options_t		*options,
1336
_cairo_font_options_init_copy (cairo_font_options_t		*options,
1337
			       const cairo_font_options_t	*other);
1337
			       const cairo_font_options_t	*other);
1338
1338
1339
cairo_private void
1340
_cairo_font_options_set_lcd_filter (cairo_font_options_t   *options,
1341
				   cairo_lcd_filter_t  lcd_filter);
1342
1343
cairo_private cairo_lcd_filter_t
1344
_cairo_font_options_get_lcd_filter (const cairo_font_options_t *options);
1345
1339
/* cairo-hull.c */
1346
/* cairo-hull.c */
1340
cairo_private cairo_status_t
1347
cairo_private cairo_status_t
1341
_cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices);
1348
_cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices);

Return to bug 306053