7 Replies Latest reply on Sep 22, 2008 9:52 PM by COKFlex

    Cannot use styleName and fontStyle property together in Label?

    COKFlex
      Hi All,

      I am using Label component with the following attributes set, see code 1)

      but in my CSS I defined the style myStyle as below see code 2)

      Here I am trying to use embed a font and use the style in the Label.
      I want the other styles to be given seperately like italic and bold using "fontStyle" and "fontWeight" properties of a Label.

      see code 3)

      The problem here is that,
      If I introduce any of these "myStyle" is not working. I mean that the font which I embeded is not implemented. Its taking its own default font. But If I remove fontStyle and fontWeight "myStyle" is working properly.

      I hope I had made my problem clear.

      Any help would be appreciated.

      Thanks.
        • 1. Re: Cannot use styleName and fontStyle property together in Label?
          Level 7
          "COKFlex" <webforumsuser@macromedia.com> wrote in message
          news:gasqad$3u$1@forums.macromedia.com...
          > Hi All,
          >
          > I am using Label component with the following attributes set, see code 1)
          >
          > but in my CSS I defined the style myStyle as below see code 2)
          >
          > Here I am trying to use embed a font and use the style in the Label.
          > I want the other styles to be given seperately like italic and bold using
          > "fontStyle" and "fontWeight" properties of a Label.
          >
          > see code 3)
          >
          > The problem here is that,
          > If I introduce any of these "myStyle" is not working. I mean that the font
          > which I embeded is not implemented. Its taking its own default font. But
          > If I
          > remove fontStyle and fontWeight "myStyle" is working properly.
          >
          > I hope I had made my problem clear.
          >
          > Any help would be appreciated.
          >
          > Thanks.
          >
          > 1)
          > <mx:Label id="english" text="test" styleName="myStyle" width="100%"
          > textAlign="center" opaqueBackground="Blue" color="Yellow" fontSize="26"/>
          >
          > 2)
          > @font-face
          > {
          > font-family: Courier New;
          > src: url("c:/windows/fonts/COUR.TTF");
          > }
          > .myStyle
          > {
          > font-family: Courier New;
          > }
          >
          > 3)
          > <mx:Label id="english" text="test" styleName="myStyle" width="100%"
          > textAlign="center" opaqueBackground="Blue" color="Yellow" fontSize="26"
          > fontStyle="italic" fontWeight="bold"/>

          Sometimes you also have to embed the bold and italic versions of the font.
          Why is it that you're embedding the font? Most systems will have this font.


          • 2. Re: Cannot use styleName and fontStyle property together in Label?
            Gregory Lafrance Level 6
            That's right. By default, some text uses the bold font, like the Label in a button. So try embedding the bold and italic fonts as well as Amy said.
            • 3. Re: Cannot use styleName and fontStyle property together in Label?
              COKFlex Level 1
              Hi Amy and Greg, Thanks for your replies.

              Yes I knew that I can use the fontstyle and fontwidth in my CSS. Before I proceed next, let me explain you about my requirements and why I am using embedded fonts.

              My requirement is to have all the font related styles as configurable from an Xml file like .

              <Text>
              <Forecolor>#FFFFFF</Forecolor>
              <Backcolor>#000000</Backcolor>
              <Fontname>TimesNewRoman</Fontname>
              <Fontsize>30</Fontsize>
              <Fontstyle>normal</Fontstyle>
              <Fontweight>normal</Fontweight>
              </Text>

              Which I can read at run time and apply the styles.

              Ok Now I am coming to the need to using embedded fonts. If I didnt embed the fonts the text displayed in my application are not smooth. But its smooth if I use embedded fonts. {It is possible if we install the fonts from the Windows CD [Control Panel->Regional Language and Setting->Language Tab->Supplementary Language support] options>} But I observed that few system doesnt have that installations. So the fonts which I am trying to use in the configuration xml, even though the system has that font, its not appearing smoothly in my application.

              ok, so next I decide how I make the embedded fonts as configurable. I gave the fontname as the stylename and give that stylename in the configuration xml as I mentioned in my previous post.

              And I implemented that using styleName="<value read from the config xml>"
              which inturn refers the stylename I used in the CSS for the embedded font.

              As I mentioned earlier, all the styles I want it to be configured, I cannot give italic or bold in the CSS style instead it has to be read from my config XML.

              So I decided to use the fontStyle and fontWeight properties of the Label. So then the problem comes, if I use stylename and fontstyle together, fontStyle is actually overriding the styleName's embedded font and applying style as italic but not with the embedded font which ultimately results in not giving me a smoother display.

              I hope I explained to your queries.
              Any sugesstions would be appreciated.

              Thanks again to Amy and Greg
              • 4. Re: Cannot use styleName and fontStyle property together in Label?
                Level 7

                "COKFlex" <webforumsuser@macromedia.com> wrote in message
                news:gavhg6$ctt$1@forums.macromedia.com...
                > Hi Amy and Greg, Thanks for your replies.
                >
                > Yes I knew that I can use the fontstyle and fontwidth in my CSS. Before I
                > proceed next, let me explain you about my requirements and why I am using
                > embedded fonts.
                >
                > My requirement is to have all the font related styles as configurable from
                > an
                > Xml file like .
                >
                > <Text>
                > <Forecolor>#FFFFFF</Forecolor>
                > <Backcolor>#000000</Backcolor>
                > <Fontname>TimesNewRoman</Fontname>
                > <Fontsize>30</Fontsize>
                > <Fontstyle>normal</Fontstyle>
                > <Fontweight>normal</Fontweight>
                > </Text>
                >
                > Which I can read at run time and apply the styles.
                >
                > Ok Now I am coming to the need to using embedded fonts. If I didnt embed
                > the
                > fonts the text displayed in my application are not smooth. But its smooth
                > if I
                > use embedded fonts. {It is possible if we install the fonts from the
                > Windows CD
                > [Control Panel->Regional Language and Setting->Language Tab->Supplementary
                > Language support] options>} But I observed that few system doesnt have
                > that
                > installations. So the fonts which I am trying to use in the configuration
                > xml,
                > even though the system has that font, its not appearing smoothly in my
                > application.
                >
                > ok, so next I decide how I make the embedded fonts as configurable. I gave
                > the
                > fontname as the stylename and give that stylename in the configuration xml
                > as I
                > mentioned in my previous post.
                >
                > And I implemented that using styleName="<value read from the config xml>"
                > which inturn refers the stylename I used in the CSS for the embedded font.
                >
                > As I mentioned earlier, all the styles I want it to be configured, I
                > cannot
                > give italic or bold in the CSS style instead it has to be read from my
                > config
                > XML.
                >
                > So I decided to use the fontStyle and fontWeight properties of the Label.
                > So
                > then the problem comes, if I use stylename and fontstyle together,
                > fontStyle is
                > actually overriding the styleName's embedded font and applying style as
                > italic
                > but not with the embedded font which ultimately results in not giving me a
                > smoother display.

                You can actually change the CSS declaration itself. But I think you will
                also need to embed the other forms of the font if you want to use them.

                HTH;

                Amy


                • 5. Re: Cannot use styleName and fontStyle property together in Label?
                  COKFlex Level 1
                  sorry, I am not getting what you mentioned. Could you please explain a bit more on what needs to be embedded and how I can change the declaration in CSS?

                  thanks.
                  • 6. Re: Cannot use styleName and fontStyle property together in Label?
                    Level 7

                    "COKFlex" <webforumsuser@macromedia.com> wrote in message
                    news:gb7ovm$fek$1@forums.macromedia.com...
                    > sorry, I am not getting what you mentioned. Could you please explain a bit
                    > more on what needs to be embedded and how I can change the declaration in
                    > CSS?

                    A CSS declaration is just an object. You can change its properties like you
                    would an object.

                    The specifics of what you are embedding depend on the font itself, the
                    version(s) of the font that you have, and what you're doing with it. I
                    can't dig around in your fonts folder for you and look and see what files
                    are coming together to show the picture that appears to be one font on the
                    surface.


                    • 7. Re: Cannot use styleName and fontStyle property together in Label?
                      COKFlex Level 1
                      ok, Thanks for the reply. I now understood that you asked to check CSSDeclaration object. Let me try out something on that. And will getback to you with the results.

                      Thanks.