Skip navigation
Currently Being Moderated

Spark DataGrid Embedded Font Quandary

Aug 22, 2011 1:01 PM

01.  In everything that follows, I am talking about the latest [21328] version of the SDK, not that I believe that my problems have anything to do with that release, just so anyone interested and willing to help will know the version.


02.  My application happens to be rooted in AIR's WindowedApplication, but again, I do not think that has any impact on my problems; I believe the same results would obtain for a Flex Application.


03.  I have a custom renderer for the Spark DataGrid which extends DefaultGridItemRenderer.  It works fine. Its primary job is to change the font characteristics of each row in the list as a visual clue to the user as to the specific nature of the content that is accessible.  Some entries are just in the Regular font, some in Bold, some in Italic, and some in Bold-Italic.


04.  I have, for most of the project, embedded the necessary fonts like this:

    [Embed (source="C:/Windows/Fonts/ArnoPro-Caption.otf", fontName="ArnoPro_BI_4",
        unicodeRange="U+0021-U+00ff, U+20ac-U+20ac")]
    private const ArnoPro_BI_4:Class;


As I said, that all works just as advertized.  But, that method of embedding carries the somewhat painful burden of slower compilations, so for the last 24 hours I have unseccessfully been trying to replace that with:


[Embed (source = "../resources/assets/ArnoPro_BI_4.swf", symbol="ArnoPro_BI_4")]
private const ArnoPro_BI_4:Class;


where the swf file was produced via fontswf, using this incantation:


fontswf -4 -u U+0021-U+00ff,U+20ac-U+20ac -b -i -a ArnoPro_BI_4 -o ArnoPro_BI_4.swf C:/Windows/Fonts/ArnoPro-Caption.otf


06.  By all that is holy, the two different means of embedding the font ought to yield the same result, but they do not.  I have debugging code inserted to print out the list of fonts upon initiation of the application, and they are identical.  Both means of embedding do succeed in getting the embedded fonts into the .swf, but the attempt to use the fonts fails using the second approach.


There is, of course, no change being made to the code in the item renderer which merely uses setStyle() to effect the row-by-row result.  The result in the second case is that the only style of the embedded font that renders is 'regular'.


07.  I have used the 'keep-generated' facility to look at the code being generated by the mxmlc compiler and can see that different code is emitted, but it does not help me find a fix to the problem.  Both forms of the meta-tag do something; both methods of embedding seem to correctly register themselves with the FontManager, but only the method of embedding which actually performs the transcoding during compilation seems to result in a set of registered fronts which can be found and correctly used to render output based on the runtime setting of the font style.

  • Currently Being Moderated
    Aug 22, 2011 2:17 PM   in reply to tcorbet

    Not sure how you build the ArnoPro_BI_4 swf, but if it doesn't have the same

    attributes, especially the CFF attribute, then it may not work properly.

    Mark as:
  • Currently Being Moderated
    Aug 22, 2011 5:15 PM   in reply to tcorbet

    I'm not sure what you mean by "inline transcoding is 'tagged'".  Font is an

    internal Flash class, there is no AS source for it.


    You can try using SWFDump to compare the DefineFont tags in the final SWF.


    Are you getting any warnings at runtime?

    Mark as:
  • Currently Being Moderated
    Aug 22, 2011 9:41 PM   in reply to tcorbet

    You can try debugging into the EmbeddedFontRegistry and see what the

    difference is there.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points