Thread: cairo text extent weirdness

  1. #1
    Registered User javaeyes's Avatar
    Join Date
    Feb 2012
    Posts
    153

    cairo text extent weirdness

    This one has me really puzzled...
    I have created a cairo text extents variable, like this
    Code:
    cairo_text_extents_t te3;
    I have used it set the font, fontsize etc... and the text renders perfectly.
    I need to use the width of the bounding box in another placement of graphics. but te.width appears to keep changing. when I run the following code the compiler spits out 24.0 on one run, 34 on another, 54 on another. I feel like maybe its looking at the memory address. Any ideas?
    [CODE}
    printf("cairo text extent is %f",te3.width);
    [/CODE]

  2. #2
    Registered User javaeyes's Avatar
    Join Date
    Feb 2012
    Posts
    153
    Ooops, never mind. figured it out. Sorry to bother everyone.

  3. #3
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    So what was your fix? share and share alike amigo, others could benefit :->
    Last edited by rogster001; 02-24-2012 at 04:55 PM.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  4. #4
    Registered User javaeyes's Avatar
    Join Date
    Feb 2012
    Posts
    153
    when I set my fontsize, using the cairo text extents, I was multiplying the fontsize by a random scale factor. This means that every time i compile, the bounding box for the text is different, thus the te.width is different. I'm a retard.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem loading font face using freetype and cairo
    By javaeyes in forum C Programming
    Replies: 2
    Last Post: 02-18-2012, 01:42 AM
  2. Cairo and GTK, still need a pixmap?
    By TriKri in forum Linux Programming
    Replies: 0
    Last Post: 03-18-2008, 04:18 PM
  3. extent of the right to bear arms in US
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 11-12-2002, 02:54 PM
  4. Viewport extent
    By Garfield in forum Windows Programming
    Replies: 0
    Last Post: 11-17-2001, 08:28 PM