haXe Forum > Textfield display issue/EmbedFonts

  • Hi,

    I'm trying to embed a font to work arround a system font issue on Mac. I embedded my own font with a swf-lib created with swfmill as explained in the doc.
    I now have to add myTextField.embedFonts = true; to each textfield in my application. But when this is done, some textfields aren't displayed correctly. The text is written 10 px above the textfield position but not everytime I run the application.

    What could cause this bad behaviour ?
    Please help, I've been working on it for 3 days without any success... :/

    Thanks in advance,

    ----
    MP

  • What type of font is it? Have you tried to convert it from a PC version, is it something standard like TTF, are you compiling to AVM1 since '_height' in as2 sometimes with autosize does not resolve till the next frame so you had to trace it to force flash to evaluate it. Is it a special client font, or something standard, if I have it I can send you a swf which you can load at runtime, rather than embed I just create a linkage Sprite and grab the textfield inside that is ready set up, saves a tone of messy setup code and messing with swfmill, I would send an example use... but I don't know if I have the font or what it might be. Maybe post some code, you have not given us much to work on. If you rotate a textfield and it dissappears normally means text is not embedded... easier than uninstalling the font to check.

  • Thanks for your quick answer.
    The font is really embedded, I can rotate it without any problem.
    The font is a classical FreeSans.ttf you can find on every Ubuntu system. I made a swf with swfmill out of this xml :

        <?xml version="1.0" encoding="UTF-8" ?>
            <movie version="9">
                <background color="#000000"/>
                <frame>
                <library>
                    <font name="Symbols" import="FreeSans.ttf" glyphs="([)]@ç={}/-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?,.;:!%*é#èàôûùöüä &#x2605;&
    #x2606;&#x2613;&#x2620;&#x2713;&#x2714;&#x2715;&#x2716;&#x2717;&#x2718;&#x2764;"/>
                    <font name="Symbols" import="FreeSansBold.ttf" glyphs="([)]@ç={}/-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?,.;:!%*é#èàôûùöüä &#x26
    05;&#x2606;&#x2613;&#x2620;&#x2713;&#x2714;&#x2715;&#x2716;&#x2717;&#x2718;&#x2764;"/>
                </library>
            </frame>
        </movie>

    I made a new class file with this code:
    package components;
    
    class Symbols extends flash.text.Font {}

    And everytime I need this font, I use its name in my TextFormat or StyleSheet objects.
    The text is displayed with the right font but not in the right place.
    If I put a border on the TextField, I see the text about 10 px above the top-border.

    What I noticed is that if I dynamically change the text content of the textfield after the application is fully loaded, it displays at the right place. It seems to be linked to your "not resolving till next frame" point. By the way, I didn't really understand what you're advising about that point.

    If you need any more information, please let me know

    Thanks for your help, really,

    ----
    MP

  • Hello,
    I tried to call the font earlier in the code, at the very beginning of the application code, but with no more success. I only get good display more frequently but always get bad one.
    Please help,

    Thanks for your help,

    ----
    MP

< Prev | Page 1 / 1 | Next >