Fw: [cairo] Problem with fonts

Behdad Esfahbod behdad at behdad.org
Tue Jul 25 08:37:44 PDT 2006


On Tue, 2006-07-25 at 04:23 -0400, Baptiste Gaillard wrote:
> I'm using Cairo with The Glade/GTK+ for Windows Toolkit. It includes Cairo, 
> do you know if Cairo is compiled with the freetype engine in this package ?

I have no idea.  Do you see a freetype dll?

> > ----- Original Message ----- 
> > From: "Behdad Esfahbod" <behdad at behdad.org>
> > To: "Baptiste Gaillard" <b_gaillard at hotmail.com>
> > Cc: <cairo at cairographics.org>
> > Sent: Monday, July 24, 2006 9:11 PM
> > Subject: Re: Fw: [cairo] Problem with fonts
> >
> >
> >>I assume your cairo is compiled without FreeType.  Then it's a problem
> >> in the Win32 font backend.  I have no idea about that backend.
> >>
> >> behdad
> >>
> >> On Mon, 2006-07-24 at 09:47 +0200, Baptiste Gaillard wrote:
> >>> Ok, the result is the same with the Vera font take from
> >>> C:\Windows\fonts\Vera.ttf. I attach 2 files to this message, the first 
> >>> show
> >>> the result using AGG, the second using Cairo, the font size is the same. 
> >>> But
> >>> there is no anti-aliasing with Cairo !!
> >>>
> >>> Here is the code I used:
> >>>
> >>> int main(int argc, char** argv) {
> >>>  cairo_surface_t *surface;
> >>>   cairo_t *cr;
> >>>
> >>>  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, WIDTH, 
> >>> HEIGHT);
> >>>  cr = cairo_create (surface);
> >>>
> >>>
> >>>  cairo_set_source_rgb(cr, 1,1,1);
> >>>  cairo_set_line_width(cr, 1);
> >>>  cairo_set_antialias (cr,CAIRO_ANTIALIAS_GRAY);
> >>>
> >>>  cairo_font_options_t* font_options =  cairo_font_options_create();
> >>>  cairo_font_options_set_antialias(font_options, CAIRO_ANTIALIAS_GRAY);
> >>>  cairo_set_font_options (cr, font_options);
> >>>
> >>>  cairo_select_font_face (cr, "Vera.ttf", CAIRO_FONT_SLANT_NORMAL,
> >>> CAIRO_FONT_WEIGHT_NORMAL);
> >>>  cairo_set_font_size (cr, 16);
> >>>
> >>>  cairo_glyph_t glyph;
> >>>  glyph.index = 0x24;
> >>>
> >>>  for(unsigned j = 0; j < 10000; j += 50)
> >>>   for(unsigned i = 0; i < 10000; i += 50) {
> >>>    cairo_move_to (cr, i, j);
> >>>    glyph.x = i;
> >>>    glyph.y = j;
> >>>    cairo_show_glyphs(cr, &glyph, 1);
> >>>   }
> >>>
> >>> cairo_surface_write_to_png  (surface, "test.png");
> >>> cairo_font_options_destroy(font_options);
> >>> cairo_destroy (cr);
> >>> cairo_surface_destroy (surface);
> >>>
> >>> return 0;
> >>> }
> >>>
> >>> Thanks.
> >>>
> >>> Baptiste
> >>>
> >>> ----- Original Message ----- 
> >>> From: "Behdad Esfahbod" <behdad at behdad.org>
> >>> To: "Baptiste Gaillard" <b_gaillard at hotmail.com>
> >>> Cc: <cairo at cairographics.org>
> >>> Sent: Friday, July 21, 2006 9:36 PM
> >>> Subject: Re: Fw: [cairo] Problem with fonts
> >>>
> >>>
> >>> > On Thu, 2006-07-20 at 06:47 -0400, Baptiste Gaillard wrote:
> >>> >> ----- Original Message ----- 
> >>> >> From: "Baptiste Gaillard" <b_gaillard at hotmail.com>
> >>> >> To: "Behdad Esfahbod" <behdad at behdad.org>
> >>> >> Sent: Thursday, July 20, 2006 9:52 AM
> >>> >> Subject: Re: [cairo] Problem with fonts
> >>> >>
> >>> >>
> >>> >> > Ok, I've seen an exemple here that use a 0.35 font size
> >>> >> > (http://cairographics.org/samples/text.html), so I think it is an
> >>> >> > error.
> >>> >> > With size like 12-14-16 it works.
> >>> >
> >>> > Ah, not good.  Carl?
> >>> >
> >>> >> > But I've also anti-aliasing problem with the other options, I've 
> >>> >> > tested
> >>> >> > with
> >>> >> > CAIRO_ANTIALIAS_GRAY and CAIRO_ANTIALIAS_SUBPIXEL but anti-aliased
> >>> >> > seems
> >>> >> > again to be off. See the 2 files attached to this message, the 
> >>> >> > first is
> >>> >> > a
> >>> >> > symbol rendere with CAIRO_ANTIALIAS_GRAY, the second is rendered 
> >>> >> > with
> >>> >> > CAIRO_ANTIALIAS_SUBPIXEL (is it normal that the contours are green 
> >>> >> > ?).
> >>> >
> >>> > The green is kinda expected.  If it doesn't look good on your LCD, you
> >>> > may have a different RGB order, or a poor FreeType version.
> >>> >
> >>> > As for GRAY not working, is it the case that you are using a bitmap
> >>> > font?  Can you please try with a widely known font like Bitstream Vera
> >>> > and report the results of that?
> >>> >
> >>> > behdad
> >>> >
> >>> >> >
> >>> >> > Thanks.
> >>> >> >
> >>> >> > Baptiste.
> >>> >> >
> >>> >> _______________________________________________
> >>> >> cairo mailing list
> >>> >> cairo at cairographics.org
> >>> >> http://cairographics.org/cgi-bin/mailman/listinfo/cairo
> >>> > -- 
> >>> > behdad
> >>> > http://behdad.org/
> >>> >
> >>> > "Commandment Three says Do Not Kill, Amendment Two says Blood Will 
> >>> > Spill"
> >>> >        -- Dan Bern, "New American Language"
> >>> >
> >>> >
> >> -- 
> >> behdad
> >> http://behdad.org/
> >>
> >> "Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
> >>        -- Dan Bern, "New American Language"
> >>
> >>
> > 
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://cairographics.org/cgi-bin/mailman/listinfo/cairo
-- 
behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
        -- Dan Bern, "New American Language"



More information about the cairo mailing list