1 Reply Latest reply on Oct 12, 2009 8:36 AM by PhilPanzini

    How can I Embed a special font face like Myriad-Semibold.otf ?

    PhilPanzini

       

      I've been trying like mad to embed special fonts like MyriadPro-Semibold.otf, MyriadPro-Light.otf, MyriadPro-Cond.otf, etc.. to no avail.

       

      I get a whole range of compiler errors such as "Unable to transcode" when using the standard compilation setup, or "exception during transcoding:" if I change the order of the flash.fonts.AFEFontManager inside the flex-confif.xml file of the 3.4 sdk.

       

      I've looked for info on this everywhere and can't find a solution. All everyone talks about is your basic Regular/Bold fontWeight, and Plain/Italic fontStyle scenarios, selecting unicode ranges, compiling fonts into a swf, but nothing about using advanced font outlines.

       

      Do you have any idea ? Is it possible at all ?

       

      I typically use this type of MXML construct with CSS:

      ----------------------------------------------------------------------------------------- --------------

      <mx:Style>

       

         @font-face

         {

            src: url("assets/fonts/MyriadPro/MyriadPro-Regular.otf");

            fontFamily: myFont;

            unicode-range: "English Range";

         }

       

         .myStyle

         {

            fontFamily: myFont;

            fontSize: 24;

            color: #FFFFFF;

         }

       

      </mx:Style>

      ----------------------------------------------------------------------------------------- --------------
      when the "src" rule points to a file like "MyriadPro-Semibold.otf", no matter if I declare it as a normal or bold fontWeight, Flex won't take it.

        • 1. Re: How can I Embed a special font face like Myriad-Semibold.otf ?
          PhilPanzini Level 1

          As it turns out there's nothing wrong with the font managers listed in the flex-config.xml file, and changing their order is not necessary.

           

          Most errors occurring at compile time are due to a discrepancy between the "fontWeight" and/or "fontStyle" arguments and what the font managers find inside the Open Type Font files.

           

          As it turns out, there's a single area within these font files where this information is matched, and it is the arguments of the "Styles (SubFormat)" string ID found in the "TTF Names" category.

           

          In the MyriadPro family of OTF files, every single file uses either "Regular", "Bold", "Italic", or "Bold Italic" as the argument(s) of the Styles definition. Often, the arguments written in the font definition aren't obvious (eg. "Italic" only, for Myriad-BlackSemiCnIt.otf).

           

          Now, this is totally undocumented, and how Adobe expect Flex/Flash developers to know what the proper arguments to use are for their fonts is anybody's guess. I used FontForge, an open source application running on X11 to look into the font files and find what the font managers are looking at.

           

          I suggest that Adobe do either of two things: Get the font managers used by Flex to report precisely what they found as a discrepancy, instead of merely reporting an undefined error, or let users force whatever fontWeight and/or fontStyle attributes suits them when embedding.

           

          Case closed.

           

           

           

          P.S. - check out the discrepancy, for the same typeface, between the Weight definition and the Styles definition. Only the Styles definition is used by the font managers when embedding the file.