Display Object Text Weird Issue

  • #1, by dionousMonday, 29. January 2018, 09:45 6 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

    246 Posts


  • #2, by afrlmeMonday, 29. January 2018, 12:42 6 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

    7278 Posts

  • #3, by dionousMonday, 29. January 2018, 14:39 6 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

    246 Posts

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

    Imperator

    7278 Posts

  • #5, by dionousMonday, 29. January 2018, 15:37 6 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

    246 Posts

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

    Imperator

    7278 Posts

  • #7, by SimonSMonday, 29. January 2018, 23:04 6 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

    1580 Posts

  • #8, by dionousTuesday, 30. January 2018, 19:57 6 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

    246 Posts

  • #9, by sebastianTuesday, 30. January 2018, 22:22 6 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 

    x,y of course is the new position

    Thread Captain

    2346 Posts

  • #10, by sebastianWednesday, 31. January 2018, 07:50 6 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

    2346 Posts

  • #11, by dionousWednesday, 31. January 2018, 09:26 6 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

    246 Posts