2 Replies Latest reply on Sep 24, 2009 8:00 PM by rawdzilla

    ComboBox text field does not respect fontFamily

    rawdzilla

      I've long struggled with this issue and have an imperfect workaround. Basically the issue is that when I specify a fontFamily to use with the comboBox, I get the drop down to populate with the wingding symbols as desired, but the combobox.text ignores the fontFamily indicator and displays a default font's interpretation of the symbol which is not what should be expected.

      I believe this is defect in the Flex implementation of the ComboBox control.

      Does anyone have an explanation or a similar experience?

      How do I get Adobe Support to look at this?

      Thank you,

        • 1. Re: ComboBox text field does not respect fontFamily
          ShardulSingh Level 3

          Hi,

           

          For acheiving this I tried the same by using the embeding the fonts and using the style sheet,It works fine.

          Pls find the code for the same, and let me know if u have any issue.

           

           

           

          MainApplication.mxml

          <?xml version="1.0"?>

          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

          creationComplete="onCreationComplete()">

          <mx:Script>

          <![CDATA[

          private function onCreationComplete():void

          {

          //For applying the Times Normal Style.

          //comboBox.setStyle("styleName","timesOriginalStyle");

           

           

           

           

          //For applying the Times Bold Style use this line.

          //comboBox.setStyle("styleName","timesBoldStyle");

           

           

           

           

          //For applying the Times Itelic Style use this line.

          comboBox.setStyle("styleName","timesItalicStyle");

          }

          ]]>

          </mx:Script>

          <mx:Style source="assets/style/style.css"/>

           

          <mx:ComboBox id="comboBox" width="150"

          text="Apply Styles on this"/>

           

          </mx:Application>

           

           

           

           

           

           

          style.css

          @font-face

          {

          src: url('assets/style/fonts/times.ttf');

          fontWeight: normal;

          fontStyle: normal;

          fontFamily: timesOriginalStyle;

          }

          @font-face

          {

          src: url('assets/style/fonts/timesbd.ttf');

          fontWeight: bold;

          fontStyle: normal;

          fontFamily: timesBoldStyle;

          }

          @font-face

          {

          src: url('assets/style/fonts/timesi.ttf');

          fontWeight: normal;

          fontStyle: italic;

          fontFamily: timesItalicStyle;

          }

          .timesOriginalStyle {

          fontWeight: normal;

          fontStyle: normal;

          fontFamily: timesOriginalStyle;

          }

          .timesBoldStyle {

          fontWeight: bold;

          fontStyle: normal;

          fontFamily: timesBoldStyle;

          }

          .timesItalicStyle{

          fontWeight: normal;

          fontStyle: italic;

          fontFamily: timesItalicStyle;

          }

           

           

           

           

          with Regards,

           

          Shardul Singh Bartwal

          • 2. Re: ComboBox text field does not respect fontFamily
            rawdzilla Level 1

            Shardul,

             

            To begin with, the combo box you illustrate with has no entries. You are treating the combo box as if it were just a text field, side stepping the issue.  I will use your format to illustrate the problem and you can try it out. What you will se is that the combo box is populated correctly with the zodiac symbols of the wingding.ttf font family. But if you select any of them, the combo box just shows garbage in its selected text field component:

             

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"  creationComplete="onCreationComplete()">
            <mx:Script>

            <![CDATA[
            import mx.collections.ArrayCollection;
            [Bindable]
            public var selectOptions:ArrayCollection;

            private function onCreationComplete():void

            {

            comboBox.setStyle("styleName","wingdingStyle");
            var selOptions1:Array = new Array();
            var symbol:String;
            var charOffset:uint = 93;

            selOptions1.push({label:" ",data:" "});
            for (var j:uint=1;j<=9;j++) {
            symbol= String.fromCharCode(j+charOffset)
            selOptions1.push({label:symbol,data:j});
            }
            selectOptions =new ArrayCollection(selOptions1);
             
            }

            ]]>

            </mx:Script>

            <mx:Style source="assets/style/style.css"/>


            <mx:ComboBox id="comboBox" width="150"

            dataProvider="{selectOptions}" fontFamily="wingdingStyle" />


            </mx:Application>

            style.css:

            @font-face

            {

            src: url('assets/style/wingding.ttf');

            fontWeight: normal;

            fontStyle: normal;

            fontFamily: wingdingStyle;

            }

            Cheers,

            Robert Wendel

             

             

             

             

             

             

             

             

            TheLostSymbol.png