Sign UpSign Up   Sign InSign In Welcome Guest,
Live ChatLive Chat

How Do I use DefineText.TextRecords?

Last post 08-30-2010, 12:56 PM by shahzad.latif. 14 replies.
Sort Posts: Previous Next
  •  07-03-2009, 4:52 PM 186852

    How Do I use DefineText.TextRecords? .NET

    it's the first time that i work flash for .net.

    I need to record a text inside the DefineText.

    In my code i get the GlyphShapesTable with DefineFont2Tag.

    But i don't know how to use the 'DefineText.TextRecords'.

    I research a lot , i found a lot of theoretical material, now i need the code.

    Please , someone else knows how i record  a text inside the DefineText?

     

    obs: I try this :

    Dim texttag As Tags.DefineText
    Dim text As String = texttag.TextRecords.Item(z).GlyphEntries.Item(z).GlyphCharacter

    But didn't work !

     
  •  07-04-2009, 3:56 AM 186870 in reply to 186852

    Re: How Do I use DefineText.TextRecords?

    Hi, thank you for considering Aspose.Flash,
    try the following,
    I assume that  you have font object with non-empty codetable,

    C#
    StringBuilder sb = new StringBuilder();
    //map glyphs to chars here, and construct text
    for (int i = 0; i < textRecord.GlyphEntries.Count; i++)
    {
    GlyphEntry glyph = (GlyphEntry)textRecord.GlyphEntries[i];
    sb.Append(Char.ConvertFromUtf32((int)font.CodeTable[glyph.GlyphIndex]));
    }

    string stringToDraw = sb.ToString();
    VB

    Dim sb As New StringBuilder()
    'map glyphs to chars here, and construct text
    For i As Integer = 0 To textRecord.GlyphEntries.Count - 1
    Dim glyph As GlyphEntry = CType(textRecord.GlyphEntries(i), GlyphEntry)
    sb.Append(Char.ConvertFromUtf32(CInt(Fix(font.CodeTable(glyph.GlyphIndex)))))
    Next i

    Dim stringToDraw As String = sb.ToString()





    Alex M., Product Developer,
    Aspose Odessa Team
    Contact Us
    Aspose - The .NET and Java Component Publisher
     
  •  07-06-2009, 10:53 AM 187094 in reply to 186870

    Re: How Do I use DefineText.TextRecords? .NET

    Thank you so much for this answer.

    But in my code i don't have the property "CodeTable", I have 'GlyphShapesTable'

    I adapted my code to this:
      
      Dim sb As New StringBuilder

    'map glyphs to chars here, and construct text
                                

    For y As Integer = 0 To texttag.TextRecords.Item(0).GlyphEntries.Count - 1


     Dim glyph As Types.GlyphEntry = CType(texttag.TextRecords.Item(0).GlyphEntries(y), Types.GlyphEntry) 'this works

    'sb.Append(Char.ConvertFromUtf32(CInt(Fix(font.GlyphShapesTable(glyph.GlyphIndex)))))
                      
    Dim test As String = font.GlyphShapesTable(glyph.GlyphIndex) 'This is always nothing!!!!!!
                       
    sb.Append(font.GlyphShapesTable(glyph.GlyphIndex))

    Next
     Dim stringToDraw As String = sb.ToString()
     

      My variable "test" is always nothing...I don't know Why.
      The font object is load but "font.GlyphShapesTable(glyph.GlyphIndex)" its returns nothing.

    Why "font.GlyphShapesTable(glyph.GlyphIndex)" return nothing?????

    obs: "glyph.GlyphIndex" is not empty this works well
    tks

     
  •  07-06-2009, 6:56 PM 187167 in reply to 187094

    Re: How Do I use DefineText.TextRecords?

    Hi, silver_lu, could you please check/try the following:
    1) are you sure that TextRecord object you are parsing is matched with DefineFont2 tag you are trying to use for getting text.Compare id of the font object and TextRecords's FontId property.Font can have zero glyphs if it's designed to be the device font for the dynamic text only(with no glyph fallback).

    2) you should use only CodeTable property for getting char code for DefineFont2(3),but if you deal with DefineFont tag, there should be DefineFontInfo or DefineFontInfo2 tag with FontId set to this font id, that provides necessary CodeTable property.

    If steps mentioned above don't work for you, could you please provide a sample project describing your problem.

    Alex M., Product Developer,
    Aspose Odessa Team
    Contact Us
    Aspose - The .NET and Java Component Publisher
     
  •  07-07-2009, 11:36 AM 187330 in reply to 187167

    Re: How Do I use DefineText.TextRecords? .NET

    Attachment: Present (inaccessible)

    Hi,

    My project its attach.

    Could you see my project?

    I guess better you see my projec than i try to explain to you what is happening.

    tks - Luciana

    Inside the file ASPOSE.rar has a swf file.

    obs: the problem occurs in

    Private sub SWF_Decompiler()

    in line 69 there is a code to scanner all tags inside the 1_2_1.swf file.

    When i = 653 appears the tag that i need "DefineFont2Tag"
    when i = 654 appears the tag that i need DefineText(11)

    i try to capture the text in line 79 but it doesn't work .

     
  •  07-08-2009, 3:45 AM 187430 in reply to 187330

    Re: How Do I use DefineText.TextRecords?

    Hi,

    Looks like you use SWFDotNet library in your project. The methods and explanations above are about using Aspose.Flash for .NET

    Please download and use Aspose.Flash to be able to follow the above instructions
    Alex M., Product Developer,
    Aspose Odessa Team
    Contact Us
    Aspose - The .NET and Java Component Publisher
     
  •  07-24-2009, 2:48 PM 190287 in reply to 186870

    Re: How Do I use DefineText.TextRecords?

    Please, alex.m
     
    I set my swf using

    Dim swf As Aspose.Flash.Swf.FlashContainer = New Aspose.Flash.Swf.FlashContainer(filename)

    It's right?

    How can I loop in every tags about the swf?
     
    The variable textRecord that you used is a Aspose.Flash.Text.TextRecord?

    How do I load the CodeTable?

    I downloaded the Aspose.Flash and add into my project.
     
    Sorry about the English, I'm brazilian.
     
    Thank you
     
  •  10-02-2009, 12:33 AM 200708 in reply to 190287

    Re: How Do I use DefineText.TextRecords?

    Hi Marcela,


    You can download latest Aspose.Flash for .NET from the download section. This is an installer file; simply install the component and then add reference to this component just like any other .NET component. After that, you'll be able to access the component in your code.

    In order to loop through the SWF objects, you can use the following sample:

    You can browse through DefineEditText like this.

    FlashContainer flash = new FlashContainer("Sample.swf");

    foreach (Aspose.Flash.Text.DefineEditText txt in flash.GetObjectsOfType(BaseObjectType.DefineEditText))

    {

        string text1 = txt.InitialText;

    }

    You can also use the similar code to browse through the other objects.

    FlashContainer flash = new FlashContainer("Sample.swf");

    foreach (BaseObject obj in flash.Objects)

    {

        if (obj.Type == BaseObjectType.DefineEditText)

        {

            DefineEditText txt = obj as DefineEditText;

            string text1 = txt.InitialText;

        }

    }

    I hope this helps. If you have any other questions or issues, please do let us know.
    Regards,




    Shahzad Latif
    Support Developer
    Aspose Sialkot Team
    About Us
    Contact Us
     
  •  06-29-2010, 1:47 AM 245977 in reply to 200708

    Re: How Do I use DefineText.TextRecords?

    Attachment: Present (inaccessible)

                FlashContainer swf = new FlashContainer();
                swf.ReadFromFile("d:\\a1.swf");

                Dictionary<int, DefineFont2> fonts = new Dictionary<int, DefineFont2>();
                ArrayList al = swf.GetObjectsOfType(BaseObjectType.DefineFont2);
                for (int i = 0; i < al.Count; i++)
                {
                    DefineFont2 font = al[i] as DefineFont2;
                    fonts.Add(font.FontId, font);
                    Debug.WriteLine(font.FontId + ":" + (font.CodeTable == null));
                }

                al = swf.GetObjectsOfType(BaseObjectType.DefineText2);
                for (int i = 0; i < al.Count; i++)
                {
                    DefineText2 txt = al[i] as DefineText2;
                    for (int j = 0; j < txt.TextRecords.Count; j++)
                    {
                        StringBuilder sb = new StringBuilder();
                        TextRecord tr = txt.TextRecords[j] as TextRecord;

                        if (tr.FontId == 0)
                            continue;

                        DefineFont2 font = fonts[tr.FontId];
                        tr.FontId = font.FontId;

                        if (font.CodeTable == null)
                            continue;

                        for (int k = 0; k < tr.GlyphEntries.Count; k++)
                        {
                            GlyphEntry g = tr.GlyphEntries[k] as GlyphEntry;
                            sb.Append(font.CodeTable[g.GlyphIndex].ToString());
                        }
                        Debug.WriteLine(sb.ToString());
                    }
                   
                }

     

    CodeTable  is null,   why?

     
  •  06-29-2010, 1:54 PM 246204 in reply to 245977

    Re: How Do I use DefineText.TextRecords?

    Hi,

    Please share a sample problematic SWF file with us, so we could test it at our end. You'll be updated accordingly.

    We're sorry for the inconvenience.
    Regards,


    Shahzad Latif
    Support Developer
    Aspose Sialkot Team
    About Us
    Contact Us
     
  •  06-29-2010, 8:13 PM 246267 in reply to 246204

    Re: How Do I use DefineText.TextRecords?

    shahzad.latif:
    Hi,

    Please share a sample problematic SWF file with us, so we could test it at our end. You'll be updated accordingly.

    We're sorry for the inconvenience.
    Regards,

    sample have been uploaded

     
  •  06-30-2010, 8:03 AM 246373 in reply to 246267

    Re: How Do I use DefineText.TextRecords?

    Hi,

    I would like to share with you that the CodeTable property is null because you're using an unlicensed version. You can apply license to get the values from the CodeTable. If you don't have a license at the moment, you can get a temporary license for 30 days from this link.

    I hope this helps. If you have any further questions, please do let us know.
    Regards,


    Shahzad Latif
    Support Developer
    Aspose Sialkot Team
    About Us
    Contact Us
     
  •  08-28-2010, 4:35 AM 256048 in reply to 246373

    Re: How Do I use DefineText.TextRecords?

    Hello,

    Now I have a 30 days license and downloaded the aspose.flash hot to install it using the 30 days license not the one of the donloaded package???,

    And i wanted to know if your product supports the new text layout component used in flash gumbo and flash player 10 that supports bidirectional text or not???

    Thanks in advance

     
  •  08-30-2010, 4:22 AM 256122 in reply to 256048

    Re: How Do I use DefineText.TextRecords?

    Hi Moataz,

    We're looking into your requirement at our end and you'll be updated the earliest possible.

    We're sorry for the inconvenience.

    Regards,


    Shahzad Latif
    Support Developer
    Aspose Sialkot Team
    About Us
    Contact Us
     
  •  08-30-2010, 12:56 PM 256209 in reply to 256122

    Re: How Do I use DefineText.TextRecords?

    Hi Moataz,

    Please follow up your requirement on your other thread.

    Regards,


    Shahzad Latif
    Support Developer
    Aspose Sialkot Team
    About Us
    Contact Us
     
View as RSS news feed in XML