[Laszlo-dev] dual-api/doc question

Benjamin Shine ben at laszlosystems.com
Fri Dec 2 10:23:26 PST 2005


Cort, I see where you're going here... but I think making text  
formatting stuff available for alternate runtimes is going to need to  
be a big discussion and a big architectural change. Flash's  
TextFormat is very flash-specific and quirky. Right now, LzTextFormat  
is a dumb wrapper around Flash's TextFormat. When we want to upgrade  
or alternate-runtime-ify our rich text api, we should take a step  
back and create a new class based on a better, more standard  
character/paragraph description; probably CSS's text properties.

The LzTextFormat object is not a complete shield from Flash oddness.  
Flash exports invalid html for rich text. The html it exports has  
weird units, invalid HTML, and a TextFormat tag that doesn't mean  
anything in standard html. David Nault has written a Java transcoder  
that fixes Flash's html. Right now, doing richinputtext.getHTML()  
gives you bad flash HTML.

The flash TextFormat object describes both character and paragraph  
formatting, and it's _horrible_. Paragraph formatting for an entire  
paragraph is drawn from the first character in the paragraph. This  
causes major problems when inserting a newline in the middle of a  
paragraph. The current RTE has split up the handling of character  
formatting and paragraph formatting, and it needs to be split up even  
more. Basically, paragraph formatting using TextFormat is very  
broken, and it's the source of many user-visible RTE bugs.

css does exist in an internal version, and I've been using it a ton  
on Laszlo Mail. Anybody know when the plan is to integrate css over  
to dev?

-ben

On Dec 2, 2005, at 7:26 AM, Cortlandt Winters wrote:

> There is a textformat object. I don't know of a textformat tag in  
> flash7 or 8, but after reading your note I checed the Flex2 alpha  
> docs and they do have one. Apparently they use it just for  
> blockindent, leading, leftmargin, rightmargin and tabstops, so they  
> are using the textformat tag just for the paragraph level  
> properties of what used to be the textformat object (which like the  
> lztextformat is appled via script only). I can see the logic in  
> this as it's that paragraph level stuff that one most wants to be  
> able to access programmatically via the cursor position, so this  
> way they can just search the hierarchy for the enclosing textformat  
> object when someone wants to realign a paragraph with nothing  
> selected. I cant say that I'm wild about that name though. If it's  
> just going to be paragarph formatting it should be <paragraphformat>
>
> In terms of how this relates to laszlo syntax, a good thing about  
> having a textformat tag  (or a combination of <fontformat> and  
> <paragraphformat> which would make sense too) is that rather than  
> use the html tags for text that might cause confusing  
> incompatabilities between dhtml and flash rendered html text, the  
> difference in capabilities are pointed out by their different names  
> and the need to translate true html text to a flash renderable  
> version is given a name and a place in the system. That way if  
> somebody creates a dhtml laszlo app and then decides they need to  
> add sound and try to retarget the flash player, they will more  
> easily be able to get in there and see what is changing the output  
> and where. It might be annoying to make the switch, but at least it  
> won't be confusing. An example would be, say, the font size, where  
> the flash font size implies pixel size and html font size = a  
> relative big picture value. I hope I'm being clear, I'm trying to  
> type this out quickly in order to get back to work.
>
> Hope this helps and isn't confusing,
>
> -Cort
>
> On 12/2/05, Henry Minsky <henry.minsky at gmail.com> wrote: Note that  
> Flash 7 (or is it Flash 8?) has  a <textformat> tag which is  
> supposed to be one of the legal tags supported in HTML text  
> content,  by the TextField object. I haven't
> actually tried it, but it is documented in the Macromedia docs.
>
>
>
>
>
>
> On 12/2/05, Cortlandt Winters <cortrah at gmail.com > wrote: Hi Guys,
>
> I might be missing something here, but I'm thinking that even if  
> it's not the case today, the tag might be usefull in a couple of  
> ways down the road that fits well with the laszlo way of doing  
> things such as to have a declarative way of styling of initial text.
>
> <LzTextFormat name="joe" bold="true" italics="false" ... etc />
>
> <richinputtext name="rich" width="300" height="100"  
> multiline="true" textFormat="joe">
>   "Use setTextFormat to set several formatting attributes at once  
> declaratively."
> </richinputtext>
>
> Or as a way of declarativly styling sections of text. (There could  
> be some mistakes in this example when it comes to what the syntax  
> of this should look like, I'm just thinking out loud)
>
> <textstyle name="regular" bold="true" underlined="false"  
> color="..etc />
> <textstyle name="underlined" bold="true" underlined="false"...etc />
>
> <richinputtext name="rich" width="300" height="100" multiline="true">
>   <LzTextFormat textstyle="regular">Use setTextFormat to set</ 
> LzTextFormat>
>   <LzTextFormat textstyle="underlined">several</LzTextFormat>
>   <LzTextFormat textstyle="regular">formatting attributes at  
> once."></LzTextFormat>
> </richinputtext>
>
> Somthing like this will probably be the goal especially when css is  
> implemented, won't it? I'm also thinking that having that tag has  
> the potential to make it easier to protect users from Flash's  
> underlying textformat quirks and gives the programmer more control  
> over individual nodes in order to handle crazy things like the  
> align handling than embedding font tag text into a string.
>
> Just thinking out loud.
>
> Thanks for everything you are doing, I hope to check out the  
> current version more closely soon.
>
> -Cort
>
>
> On 12/2/05, John Sundman <jsundman at laszlosystems.com > wrote: D'oh!
>
> Actually, although that's an obvious point, it never occured to me.
>
> I'll make sure it's made more clear in the documentation.  Actually  
> the
> Developer's Guide doesn't even have a full chapter on scripting (it
> merely has a short tutorial).  I guess it's about time I wrote one.
>
> jrs
>
> PS: I like your idea about alllowing the .js suffix.
>
> On Dec 1, 2005, at 4:51 PM, P T Withington wrote:
>
> >>
> >
> > If it is meant to only be used in script, then it should be  
> defined in
> > script.  Then you won't get the magic parallel tag interface.
> >
> > <script>
> >   function LzTextFormat () {
> >     ...
> >   }
> > </script>
> >
> > Perhaps we should also allow files consisting solely of script to  
> have
> > a .js suffix, but I don't think that is required to solve this  
> issue.
>
> _______________________________________________
> Laszlo-dev mailing list
> Laszlo-dev at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>
>
> _______________________________________________
> Laszlo-dev mailing list
> Laszlo-dev at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>
>
>
>
>
> -- 
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>
>
> _______________________________________________
> Laszlo-dev mailing list
> Laszlo-dev at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev



More information about the Laszlo-dev mailing list