Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Text Color in TextField class — Gideros Forum

Text Color in TextField class

bysregbysreg Member
edited August 2013 in General questions
Hello,

I noticed in the Gideros Documentation, that textfield class has setTextColor function but it lacks the ability to change some word in the text to a certain color. Is there some way that i can achieve this elegantly ? (or has anybody built a gideros library for that ?). Must be nice if we can put some html code there to format the text.

Thanks

Comments

  • @bysreg

    You could use my old bmfont lib here http://github.com/nascode/BMFont

    It predate official bmfont support of Gideros. So it will be less performant. But in exchange you could change color of certain words in a sentence. And you have access to each letter bitmap for animation purpose.

    look at the example here https://github.com/nascode/BMFont/blob/master/examples/basic/main.lua
    have fun with our games~
    http://www.nightspade.com
  • talistalis Guru
    edited August 2013
    Hi @bysreg,

    On this topic i previously done some improvement in textwrap class. (Using ttf fonts)
    For details see the topic please. It is not %100 complete but hope it will help you.
    http://www.giderosmobile.com/forum/discussion/1580/textwrap-addition#Item_9
    ----------------------------------------------------------------------
    Ok here is my work so far.
    1-I switched to @atilim 's version of Textwrap2 class and added alignment,linespacing,letterspacing,defaultcolor change and special coloring of rows properties.
    Here is the example of the init function
    TextWrap2:new(text, areaWidth, areaHeight,lineSpacing,letterSpacing,align,font,mainColor,color1)
    Parameter Descriptions
    text = text to show on screen
    areaWidth = textarea width on screen
    areaHeight = textarea height on screen
    lineSpacing = text's line spacing
    letterSpacing = text's letter spacing
    align = Supporting "left","right" or "center" by default it is "left" alligned.
    font =ttf font to be used
    mainColor = text's main color by default black
    color1@" signs will be omitted from the text.
    -----------------------------------------------------------------

    Likes: hgvyas123

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.