8 Replies Latest reply on Aug 12, 2010 11:45 AM by rtalton

    non-breaking space character

    Ben Danis Level 1

      I am loading an XML with all of my tags.  Within that XML, there are nbsp; characters.  I parse those and make them into &#xA0;.  I do read the string properly when accessing, although when i try to set a htmlText of a label or text object, the &#xA0 is always replaced with an empty space (i.e. 40 mg displays as 40mg).  I am using an embedded font for my text fields (Helvetica Neue) which embeds all the character sets.  I have also tried changing &#xA0; to <font face='Arial'>&#xA0;</font> still with no success

       

      Is there an issue with Helvetica or any font?  I have read somewhere to add the range to FontEmbedding file in your local settings folder, but that didn't seem to work either

       

      any ideas?

        • 1. Re: non-breaking space character
          rtalton Level 4

          Try using &#xa; instead of &#xA0;

          • 2. Re: non-breaking space character
            Ben Danis Level 1

            that adds a new line (character with ascii code of 10)

            • 3. Re: non-breaking space character
              rtalton Level 4

              Sorry, I mis-read.

              Try the HTML entity &#160;

               

              List of these codes is here.

              • 4. Re: non-breaking space character
                Ben Danis Level 1

                still shows up as a non character

                • 5. Re: non-breaking space character
                  rtalton Level 4

                  Not sure what you mean by "non-character".

                  It should insert a non-breaking space. Have you checked the html property to see what's actually in there?

                  Can you post some code to reproduce what you are getting?

                  • 6. Re: non-breaking space character
                    Ben Danis Level 1

                    so my main

                    <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                    xmlns:mx="library://ns.adobe.com/flex/mx"
                                    layout="absolute"
                                    width="1400" height="768"
                                    frameRate="99"
                                    backgroundColor="#000000"
                                    backgroundGradientColors="#000000,#000000"
                                    creationComplete="_init()"
                                    xmlns:AbbIntl2472="com.icaxon.AbbIntl2472.*" xmlns:utils="com.as3lib.utils.*" xmlns:common="com.icaxon.MVC.view.lo.components.common.*">
                        <fx:Script>
                            <![CDATA[
                                private function _init():void {
                                    addEventListener("TEST", _setHTMLText, false, 0, true);
                                }
                                private function _setHTMLText(e:Event):void {
                                    txt.htmlText = "90&#xA0;mg"
                                }
                                   
                            ]]>
                        </fx:Script>
                        <fx:Style source="../libs/MXMLStyles.css"/>
                        <AbbIntl2472:Main2472 id="main" />
                        <mx:Canvas>
                            <mx:Text id="txt" selectable="false"/>
                        </mx:Canvas>
                    </mx:Application>

                     

                    When main has loaded its fonts, i set the text on txt. It's in a canvas so it will have my basic style, which uses a loaded font called _HELVETICA NEUE LT (see below)

                    [Embed(    fontName="_HELVETICA NEUE LT",
                                fontStyle="LT 55 Roman",
                                source="/../libs/fonts/helvetica/HN55Roman.PFB",
                                advancedAntiAliasing="true",
                                mimeType="application/x-font-truetype",
                                embedAsCFF="false")]
                        public class HelveticaNeue55Roman extends FontAsset

                     

                    which is registered to my fonts library


                    The font displays properly

                    • 7. Re: non-breaking space character
                      Ben Danis Level 1

                      i've also tried setting the font to 90<font face='Arial'>&#xA0;</font>mg and 90<font face='arial'>&#xA0;</font>mg both with no results

                       

                      although if i set the text using basic flex fonts, it works, but is not embedded, nor antialiased

                      • 8. Re: non-breaking space character
                        rtalton Level 4

                        I'm guessing the problem is related to how you are embedding the font or the font itself, since it works otherwise. I don't use Flex 4 so I won't be able to help you with that.

                         

                        You should try a different font and embed method to test.