Eigene Fonts ...

  • Hi Klaus!
    Häufig habe ich das Bedürfnis spezielle Fonts in Pano-Touren zu verwenden. In solchen Fällen mache ich Grafiken und binde sie ein.
    Währe es kompliziert ein Plugin zu machen der dem ganzen Player, einschlieslich Textfeld-Plugin, Fonts meiner Wahl zur Verfügung stellt. zb. in Form eines SWFs. ähnlich wie bei SIFR oder anderen "fonts-replacement" Techniken???
    Kannst Du den Quellcode von Textfeld-Plugin veröffentlichen. Ich bin ein eher bescheidener Flasher, doch bei FPP habe ich es hinbekommen den Combobox-Plugin mit eigenen Fonts auszustatten.
    Grüsse in die Runde
    Mil
    p.s. : je mehr ich mit deinen Player abeite desto besser gefällte es mir ... Kompliment!!

  • Hi,

    der Quellcode des Textfield Plugins ist im 1.0.7 Downloadpaket enthalten
    (plugins-sources/flex-sdk-mxmlc/textfield/textfield.as),

    mit mxmlc lassen im .as Quellcode Fonts auf diese Art einbetten:

    Code
    [Embed(source="fonts/arial.ttf", fontFamily="arialfont", unicodeRange='U+0020-U+00FF')] private var MyArialFont:Class;

    Schöne Grüße,
    Klaus

  • Hi Klaus!

    ...mit mxmlc lassen im .as Quellcode Fonts auf diese Art einbetten:

    Code
    [Embed(source="fonts/arial.ttf", fontFamily="arialfont", unicodeRange='U+0020-U+00FF')] private var MyArialFont:Class;


    Wie ich schon sagte meine Flashkentnisse sind eher bescheiden ... mit Flex bin ich noch nicht in Berührung gekommen.
    Hättest du einen ähnlich schnellen Tipp wie ich es am einfachsten in Flash machen kann??
    Grüße
    Mil

  • Tja ...
    den ganzen Tag gegrübelt nix erreicht ...
    mit setTextFormat () währe es einfach doch

    Hinweis: Diese Methode funktioniert nicht, wenn ein Stylesheet auf das Textfeld angewendet wird.

    bedeutet das wenn ich im Textfeld auf HTML und CSS zurückgreife verliere ich die Möglichkeit mit embedded fonts zu dealen???
    was sagen die flashexperten??
    ich habe ins textfield.swf ein Font auf die übliche Weise eingebetet.
    wie kann ich Flash dazu bringen per CSS den eingebeteten Font zu zeigen anstatt den gleichnamigen System-Font??

    3 Mal editiert, zuletzt von milemann (19. Juli 2009 um 00:45)

  • Hi,

    es ist noch wichtig das "embedFonts" des TextField Objekts eingeschaltet ist,

    siehe:
    http://livedocs.adobe.com/flash/9.0_de/A…html#embedFonts

    dann sollte sich der eingebettete Font, über den beim Einbetten angegebenen Namen, ansprechen lassen,
    z.B. bei:

    Code
    [Embed(source="fonts/arial.ttf", fontFamily="arialfont", unicodeRange='U+0020-U+00FF')] private var MyArialFont:Class;

    ist der Fontname - "arialfont",

    Schöne Grüße,
    Klaus

  • Hi Klaus!

    This is what I'm doing but I can't get the embeded font to show in texfield

    I opened compile.bat from this folder: examples/as3-interface/plugin-sources/textfield/
    with a text editor

    then:

    1. download the Flex SDK from here: (use the latest production release) http://opensource.adobe.com/flexsdk/ DONE!
    2. extract the zip package anywhere DONE!
    3. edit the line below and set there the path where you have extracted the Flex SDK package: DONE!
    in my case it is:
    set FLEXSDKPATH=E:\krpano\flexSDK

    save .bat file


    ok no I open textfield.as and add this line:

    [Embed(source="fonts/Aladin-Regular.ttf", fontFamily="Aladin", mimeType='application/x-font' )] private var AladinFont:Class;

    I of course have the font saved in the folder fonts/Aladin-Regular.ttf, relative to textfield.as location.

    this is where I add the line:

    [SWF(width="400", height="300", backgroundColor="#000000")]
    public class textfield extends Sprite
    {
    [Embed(source="fonts/Aladin-Regular.ttf", fontFamily="Aladin", mimeType='application/x-font' )] private var AladinFont:Class;


    // krpano as3 interface

    private var krpano:krpano_as3_interface = null;
    ...


    Ok, now I save textfield.as and double click compile.bat
    I get a textielf.swf file in the same directory. no errors in cmd window.

    now I take my krpano xml.
    in CSS properties of my textfield, I change font-family to "Aladin" wich is the name of my font.

    now open the tour, and I get the default font, not the one I want to embed.


    Can someone help me with this and let me know where am I failing?

    thanks a lot! =)

  • ok! I Found the solution! *smile*

    we have to enable the embedded font of the textfield

    I did it this way... please, if someone knows better than me, let me know if there's a better place to set this up:

    in textfield.as

    this is the correct Embed code:

    [Embed(source="MyFont.ttf", fontFamily="MyFontFamilyName", fontWeight="normal", mimeType='application/x-font', embedAsCFF="false" )] private var MyFontClass:Class;

    Now scroll down the file. Like around line 360, you will see this function: private function updateHTML():void
    a few lines more and you'll see these two settings:

    css.parseCSS( cssdata );
    txt.styleSheet = css;
    right after these, copy and paste the following:

    txt.embedFonts = true;
    txt.antiAliasType = AntiAliasType.ADVANCED;


    txt.embedFonts = true; will enable the embeded fonts so it's able to set the font by CSS data.
    txt.antiAliasType = AntiAliasType.ADVANCED; will set the antialiased type to Advanced, so the characters look smooth.


    =) that's it... I hope this helps someone save the hours I just lost figuring this out.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!