[cairo] toy text api, fonts and scales

Kozhevnikov Mikhail mikhailkozhevnikov at yandex.ru
Wed Nov 5 16:44:42 PST 2008


Well, the thing I want to show is a kind of graph with labels, and the whole picture should fit into given size.
So the labels may be initially too small to read (if the graph itself is large), but the user may want to zoom and have a closer look at them.
Of course, one possible solution is to render a large PDF and show it zoomed out.

Thanks for your reply.
Could you tell me one more thing, please?
I found out that Arial font, e.g., looks a bit different on Windows XP and Debian.
Is it possible to use some kind of font totally independent of the system used?


06.11.08, 03:04, "Behdad Esfahbod" <behdad at behdad.org>:

> Kozhevnikov Mikhail wrote:
> > My one look like attached (zoomed 6400%).
> > I use Acrobat Reader 9. And you?
> Ah, ok, that's what you mean!  So yeah, we don't support that small sizes.  I
> have plans to fix this.  But the main question I guess is, why do you need
> such a thing?  Cairo's PDF units are in points.  Who can read a 1pt font?
> behdad
> > 06.11.08, 02:26, "Behdad Esfahbod" <behdad at behdad.org>:
> > 
> >> My PDF viewer shows your PDF correctly, with some barely-visible text.  It's
> >> 1pt after all.  Maybe you can show me how it looks for you?
> >> Kozhevnikov Mikhail wrote:
> >>> Ok. But if I set font size 10 and scale the whole picture down, the trouble is the same
> >>>
> >>>    cairo_surface_t *surface;
> >>>    cairo_t *cr;
> >>>    cairo_pattern_t *linpat;
> >>>    surface = cairo_pdf_surface_create("tstfns.pdf", 50, 50);
> >>>    cr = cairo_create (surface);
> >>>    cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
> >>>    cairo_move_to(cr, 25, 25);
> >>>    cairo_scale(cr, 0.1, 0.1);
> >>>    cairo_set_font_size(cr, 10);
> >>>    cairo_show_text(cr, "hello world");
> >>>    cairo_destroy (cr);
> >>>    cairo_surface_destroy (surface);
> >>>
> >>> Does it mean I can't draw letters smaller then some threshold?
> >>>
> >>> Best regards, Mikhail.
> >>>
> >>> 06.11.08, 00:42, "Behdad Esfahbod" <behdad at behdad.org>:
> >>>
> >>>> Thanks.  I assume you meant to CC the list but forgot?  Helps if you resend to
> >>>> list as our PDF expert and see and track the bug down.
> >>>> Thanks,
> >>>> behdad
> >>>> Mikhail Kozhevnikov wrote:
> >>>>> Hi Behdad,
> >>>>>
> >>>>> The code is:
> >>>>>   cairo_surface_t *surface;
> >>>>>   cairo_t *cr;
> >>>>>   cairo_pattern_t *linpat;
> >>>>>   surface = cairo_pdf_surface_create("tstfns.pdf", 50, 50);
> >>>>>   cr = cairo_create (surface);
> >>>>>   cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
> >>>>> CAIRO_FONT_WEIGHT_NORMAL);
> >>>>>   cairo_set_font_size(cr, 1);
> >>>>>   cairo_move_to(cr, 25, 25);
> >>>>>   cairo_show_text(cr, "hello world");
> >>>>>   cairo_destroy (cr);
> >>>>>   cairo_surface_destroy (surface);
> >>>>>
> >>>>> Simple, isn't it? :)
> >>>>>
> >>>>> And if I run it, I get the result as attached.
> >>>>>
> >>>>> Best regards, Mikhail.
> >>>>>> Mikhail Kozhevnikov wrote:
> >>>>>>  
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> I'm experiencing troubles with rendering text to PDF at different
> >>>>>>> scales with cairo_show_text().
> >>>>>>>
> >>>>>>> The labels are displayed with always the same font family and size
> >>>>>>> ("Sans Serif", 0.3), but as the scale value changes, intervals
> >>>>>>> between symbols stretch enormously - up to 10 times the width of a
> >>>>>>> letter.
> >>>>>>>
> >>>>>>> Anyone met the same? What could be the reason?
> >>>>>>>
> >>>>>>> Thanks, Mikhail.
> >>>>>>>     
> >>>>>> Hi Mikhail,
> >>>>>>
> >>>>>> Can you show us code and the unexpected PDF output?
> >>>>>>
> >>>>>> Have fun with cairo!
> >>>>>>
> >>>>>> behdad
> >>>>>>
> >>>>>>   
> > 
> > 
> > ------------------------------------------------------------------------
> > 

-- 
Много спама? Пользуйтесь Яндекс.Почтой http://mail.yandex.ru/nospam 


More information about the cairo mailing list