2

I m using DirectFB For GUI of Device. I have problem to get string width using "GetStringWidth" function of DirecFB. When I have pass the "a" then it returns "9" width of string and if i will pass "ä" special charector then it will return "16", because of "16" width i have problem to draw the string in specific location.

pstDFB->font_city->GetStringWidth(pstDFB->font_city,"a",-1,&atwidth);

Result in atwidth equals to 9

pstDFB->font_city->GetStringWidth(pstDFB->font_city,"ä",-1,&atwidth);

Result in atwidth equals to 16

Please help

sam_13
  • 532
  • 2
  • 9
  • I wonder if it is because 'a' is ascii which uses 8 bits, and then + 1 for '\0'. Do you think it is possible that when you use that special character, that it is using Unicode (which uses something like 16 bits)? – Kiith Nabaal Oct 31 '12 at 07:09
  • DirectFB support all special character in 0.9.2 version. then why it gives me "16" widh for special character. i know special charecter asci value is grater then 132 that's why it takes 16 for special character. but I want the solution for that. – sam_13 Oct 31 '12 at 07:17
  • ascii only has a byte to store for characters. The character 'a' is able to be stored in ascii, along with all of the other letters in the alphabet (capital or lower case). Here is a link that gives all characters ascii supports: http://www.asciitable.com/index/asciifull.gif Unicode on the other hand, recognizes that there are many different characters beyond the English language. 'ä' is not an English letter. Unicode uses something like 16 bits to store the extra characters. I think that might be why you see the difference but I am not sure. – Kiith Nabaal Oct 31 '12 at 07:21
  • Here is a link to the documentation for that function if it helps at all http://directfb.org/docs/DirectFB_Reference_1_1/IDirectFBFont_GetStringWidth.html – Kiith Nabaal Oct 31 '12 at 07:23
  • I want the solution for GetStringWidth function return the 16 width of special character. Or give me alternate for that – sam_13 Oct 31 '12 at 07:31
  • Nobody have any solution for it? – sam_13 Oct 31 '12 at 08:44

0 Answers0