Display Object Text Weird Issue

  • #1, by atrusMonday, 29. January 2018, 09:45 2 years ago
    Hello all,

    Have the following issue:

    I use display object texts for my main menu buttons.

    However when i switch language to e.g. French, the object texts are positioned abit lower for an unknown reason which i still cannot get!

    See images below, any ideas are welcome!


    Forum Fan

    237 Posts


  • #2, by afrlmeMonday, 29. January 2018, 12:42 2 years ago
    Might be to do with the max height of the texts being different in French over English because of the special characters? That's the only thing I can think of. I believe it positions y on the top most pixel. x-axis position depends on the alignment you set in the game settings section.

    Anyway, just use some if queries to determine which language is set then update the object texts & position accordingly.

    Imperator

    6842 Posts

  • #3, by atrusMonday, 29. January 2018, 14:39 2 years ago
    Thanks, I also thought that it might be an issue with the height of the french characters, but the weird thing is that after you switch back to english, the english text now is wrongly positioned also, so there is a smell of bug in the air, see below...

    I believe it positions y on the top most pixel. 
    Yes this is true, and i think that it's not the best way, it would be nice to be able to choose between top/middle/bottom position same way as we can adjust the x position (left/center/right)

    Forum Fan

    237 Posts

  • #4, by afrlmeMonday, 29. January 2018, 15:30 2 years ago
    Did you update the object texts after changing language?

    Imperator

    6842 Posts

  • #5, by atrusMonday, 29. January 2018, 15:37 2 years ago
    Yes, the object texts are displayed with a 'At beginning of scene' action, so they are refreshed in every load of the menu scene. After i change language in a separate menu scene, i go back to the object text menu scene with a 'Show menu scene' action part.

    Forum Fan

    237 Posts

  • #6, by afrlmeMonday, 29. January 2018, 15:39 2 years ago
    Hmm... sorry. No idea then.

    Imperator

    6842 Posts

  • #7, by SimonSMonday, 29. January 2018, 23:04 2 years ago
    The font changes its lineheight with the highest glyph. Â is higher than A. So you should display the highest text once then hide it again and then position your text.

    Thread Captain

    1368 Posts

  • #8, by atrusTuesday, 30. January 2018, 19:57 2 years ago
    The font changes its lineheight with the highest glyph. Â is higher than A. So you should display the highest text once then hide it again and then position your text.
    Thanks for the info; would it be possible to use the y-center instead of the y-top of the font for positioning? That would solve any issues i guess. Due to these line-height issues, seems that the y-top positioning is not ideal for the fonts.

    Forum Fan

    237 Posts

  • #9, by sebastianTuesday, 30. January 2018, 22:22 2 years ago
    Thanks for the info; would it be possible to use the y-center instead of the y-top of the font for positioning? That would solve any issues i guess. Due to these line-height issues, seems that the y-top positioning is not ideal for the fonts.

    wouldn't that mess with all the other definitions / concepts of positioning set in the engine? Everything regarding images and positions is positioned at the top-left corner as the default anchor. top-left /top-center/top-right for text alignment only makes sense here... You have the tools (lua) to reposition texts for specific purposes though:


    for i=1 , ActiveTexts.__len do
      if ActiveTexts[i].Owner == Buttons["my-displayed-object-text-object"] then
        ActiveTexts[i]:to(0,{Position= {x=50,y=150} })
      end
    end 
    1
    2
    3
    4
    5

    x,y of course is the new position

    Thread Captain

    2337 Posts

  • #10, by sebastianWednesday, 31. January 2018, 07:50 2 years ago
    by the way.. bitmap fonts get an overall height from the engine for all characters based on the highest character found in the bitmap "line" ... maybe thats why i never had this problem in the first place... 

    Thread Captain

    2337 Posts

  • #11, by atrusWednesday, 31. January 2018, 09:26 2 years ago
    Thanks Sebastian, yes i guess everything is ok with the bitmaps, it's only an issue with truetype fonts.

    Your code looks interesting also, will take a look.

    Forum Fan

    237 Posts

Write post