Hello!
I am implementing my own TextAreaModel to use a mark up language I designed in the past. This allows me to use a single font and then add color and formatting based on this markup language.
I have managed to do this in TWL! The only issue is that the text formatting does not seem to be working at all. I implemented my own TextAreaModel and then made my own Style.
For example, I have done the following in my custom Style:
Code:
put(StyleAttribute.FONT_WEIGHT, 700);
which, from my understanding is equivalent to the HTML model of "bold". But this has no affect on my text for my TextArea. I can color the text just fine - just the formatting doesn't seem to be working. I have also tried FONT_SIZE and FONT_ITALICS and both do not seem to work.
I've looked at the HTMLTextAreaModel code and they do not seem to do anything special for these StyleAttributes - put(attribute, value) is essentially used.
Here is the code in the custom style (simplified):
Code:
private void parseText ( String text )
{
//This works just fine:
put(StyleAttribute.COLOR, Color.RED);
//This does not work:
put(StyleAttribute.FONT_WEIGHT, 700);
}
And here is the code in my custom TextAreaModel:
Code:
public void setText(String text)
{
ColorFormatStyle textStyle = new ColorFormatStyle(text);
Element element = new TextElement(textStyle, text);
elements.add(element);
doCallback();
}
@Override
public Iterator<Element> iterator ()
{
return elements.iterator();
}
Thanks for any help you can give!