Oops, forgot to send to directfb-users list. ---------- Forwarded message ---------- From: Ezequiel García <elezegar...@gmail.com> Date: Fri, 10 Feb 2012 11:53:50 -0300 Subject: Re: [directfb-users] Measure text size To: Sagaert Johan <sagaert.jo...@skynet.be>
Hi, > Is there a function i could use to measure the size of a string given the > used font and fontsize ? Yes. The function is IDirectFBFont::GetStringExtents(): http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBFont_GetStringExtents.html Here goes a small "pseudo-code" example (won't compile): IDirectFB* dfb; IDirectFBFont* font; DFBFontDescription font_desc; DFBRectangle rect; // Create main interface DirectFBCreate(&dfb); // Create font dfb->CreateFont(dfb, "Tiresias.ttf", &font_desc, &font); // Measure a text font->GetStringExtents(font, "measure this", -1/*measure whole string*/, &rect, NULL); That's all. Hope it helps, Ezequiel. _______________________________________________ directfb-users mailing list directfb-users@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users