Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
TextField:getWidth() return straight value with Burmese font — Gideros Forum

TextField:getWidth() return straight value with Burmese font

AnhTuanAnhTuan Member
edited November 2013 in Bugs and issues
I'm developing a game for Myanmar user, So I have to use zawgyi_one font for text related stuffs. The problem is when I use getWidth, the return value is wrong
here is my code:
local part = text:sub(last, index)
local lineTemp = TextField.new(self.font, part)
lineTemp:setLetterSpacing(self.letterSpacing)
if(lineTemp:getWidth()>self.width) then
	-- every thing go wrongs from here		
end
For example, this text
 ဧျပီ ၁ ရက္ေန႔တြင္ၾကားျဖတ္ ေရြးေကာက္ပြဲကိုက်င္းပခဲ့သည္။
return width = 380. This is wrong because this text go off screen(screen width is 720)

Comments

  • @AnhTuan
    first case, while your screen might be 720px. You might have set different values in your Logical dimensions in project properties, and based on applied scaling mode the values are true.

    Other thing might be some transformations applied to this element or parent elements.

    And even if all above is correct and it really reports incorrect size, can you also check:
    local x, y, width, height = text:getBounds(stage)

    Likes: chipster123

    +1 -1 (+1 / -0 )Share on Facebook
  • Thanks @ar2rsawseen.

    text:getBounds works for me. :D
Sign In or Register to comment.