swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swftools-common] swfc text


From: Matthias Kramm
Subject: Re: [Swftools-common] swfc text
Date: Sun, 28 Nov 2004 17:28:51 +0100
User-agent: Mutt/1.5.6i

On Thu, Nov 25, 2004 at 04:14:57PM +0000, Leo Schalkwyk wrote:
> I have been using a simple perl script to convert a seminar
> outline into simple html slides, and I have already crudely
> hacked that to make a single frame swf for each slide using
> swfc.  Then it's a simple matter to swfcombine these along with
> any other pictures and default_viewer.swf to make a usable
> slide presentation.
> 
> This might not be the smartest way to do this, and maybe the
> response to my questions is 'use TeX', 

Actually it's "use OpenOffice" (or KPresenter or some other
presentation tool capable of producing PDFs). :)

> but still I have some questions about .text

> Things that I can't figure out / may be missing include
> -is there an escape mechanism to allow things like double quotes in strings?
>       (currently a swfc syntax error)

Yes, escape the double quotes with backslash:
    text="This is a \"text\""

> -how can you calculate the x coordinate of the end of a string?
>       (eg I want to use a different typeface for code examples,
>       so I need a separate .text -- how do I know where to start it?)
>       or are there plans to interpret some kind of markup?

The only thing planned so far is supporting newline ("\n").
Markup is tricky because of the way swf fonts work (see below).

Also, there's no immediate way for accessing the graphical 
width of a string. (Short of swfc-compiling the file and then
using swfbbox to determine the width, then add another string,
run swfc again,...)
Have you considered using the Python library, btw.?
There, you could do e.g.

    helvetica = SWF.DefineFont("Helvetica.ttf")
    swf = SWF.create(version=5, bbox=(0,0,640,480), fps=25)
    swf.tags += helvetica
    text = SWF.DefineText(font=helvetica, text=u"Test Text", size=20)
    swf.tags += text
    swf.tags += SWF.PlaceObject(text, depth=1, matrix=SWF.Matrix(y=100.0)) 

    (x1,y1,x2,y2) = text.bbox
    text_width = x2-x1

> -.edittext has a number of useful looking parameters:
>       multiline, html, wordwrap.  I think these don't work yet.  Would
>       I be smarter to use .edittext ?

Well, .edittext has the advantage that you can copy&paste
the text out of the swf file (normal text doesn't support that).
The main problem with it, however, is that markup (<b>, <i> etc.)
only works with the default font. That is, you can use only the Arial
font for html .edittext (because all other fonts have only one variant for
each character, not four (standard,bold,italic,bolditalic).

Btw., why do you think the parameters don't work yet?

Greetings

Matthias








reply via email to

[Prev in Thread] Current Thread [Next in Thread]