PDA

View Full Version : Problems Using bold and italic in an embedded-font dynamic input field


phloam
05-18-2006, 01:19 AM
I'm using text format to provide the user with a toolset for changing the format an input text field.

Most things work - underline, links, indent changes, size changes, etc...but changing the bold or italic property on part of the text is producing no visible change at all. If you select a huge chunk of text and set it all to bold, you can see a -SLIGHT- change in the space it takes up, but it still doesn't look bold, and otherwise doesn't look any different whatsoever. Not sure why there should be problems with those two properties while all of the others work fine.

I'm using a library font (verdana) with linkage set. If I set the library font to bold and italic in the properties, the whole input field goes bold and italic, and setting the bold/italic properties on the text format object still has no effect one way or another.

What am I doing wrong?

Thanks,
pH

goliatone
05-18-2006, 01:39 AM
Hi,
i think that you have to embed the bold and italic fonts as well, its like three fonts, regular, bold and italic...

phloam
05-18-2006, 01:49 AM
do you mean three "verdana" objects in the library? one plain, one itelic, and one bold?

If so - how should the linkage be set up?

Flash Gordon
05-18-2006, 02:08 AM
It is hard to tell what YOU are doing wrong without seeing your code or fla.

Want me to post an example?

phloam
05-18-2006, 02:26 AM
I didn't post the code because all the formatting changes work fine, I think possibly even including the bold/italic --when it writes the html text fields in the database--, but it doesn't display right in Flash.

It's also hard to know what to post, because I have a number of classes that are involved in the process.

Mainly - there is a 'CFormattableText' class, and a whole heap of format button classes - eg. 'CToolBarButton_Bold'. the onRelease method of the bold button calls this (using a reference to itself as argument):


public function addFormatting(inFormatButton:MovieClip)
{
m_scrollBeforeFormat = m_mainField.scroll;

var tf:TextFormat = new TextFormat();
tf = m_mainField.getTextFormat(m_contentSelectionStart, m_contentSelectionEnd);
tf = inFormatButton.modifyFormatObject(tf);
m_mainField.setTextFormat(m_contentSelectionStart, m_contentSelectionEnd, tf);
reselectText();

m_mainField.scroll = m_scrollBeforeFormat;
}


so if you look in the middle of that code, it calls a method back on the button that was clicked:


public function modifyFormatObject(inTextFormat:TextFormat):TextFo rmat
{
inTextFormat.bold = !inTextFormat.bold;
return inTextFormat;
}


Which is exactly the same was what happens for all other formatting - such as underline - which works not a problem. But is this code even relevent to the issue of the text field (which is not dynamically created, it is a solid placed textfield inside the movieclip which 'CFormattableText' extends) not correctly displaying bold or italic characters?

Flash Gordon
05-18-2006, 02:28 AM
It's also hard to know what to post, because I have a number of classes that are involved in the process.It is best to just make a stripped down version of what you are asking about. Just something simple that illistrates your problem.

Can you just do that?

phloam
05-18-2006, 02:38 AM
But the thing is I have no idea what peice of code would effect this display issue. The text field is manually placed, so there's no code involved in setting it up, just manually set properties.

Then there's this code:


var tf:TextFormat = new TextFormat();
tf = m_mainField.getTextFormat(m_contentSelectionStart, m_contentSelectionEnd);
tf = inFormatButton.modifyFormatObject(tf);
m_mainField.setTextFormat(m_contentSelectionStart, m_contentSelectionEnd, tf);


which in the case of the bold button pressed translates into this simpler version:


var tf:TextFormat = new TextFormat();
tf = m_mainField.getTextFormat(0, 25); //just example selection values
tf.bold = true
m_mainField.setTextFormat(0, 25, tf);


so that's it...just setting it to bold. And the thing is - when the font isn't imbedded (when I didn't need to mask it), it works fine, including bold and italic - not a problem whatsoever. It's just when I needed to set the font to embed so that I could mask it, it just doesn't display bold or italic characters, or if I set the library font to bold or italic, it -ONLY- displays bold-italic, and can't be set to normal.

timcole
05-24-2006, 02:55 PM
Try this (it's a bit messy but worked for me):

1. Put some blank spaces in your text.
2. Select some of the space and then click the bold button.
3. Select a different bit of space and click Italics
4. Select a different bit of space and click B and I

Now render your movie and see what happens...