19 Hours in Front of the Keyboard – For This!

2 minute read

I’ve been writing PHP, MySQL, and LSL all day and made an amazing amount of progress on my Text on a Prim system. If you are impatient to see it, just click here for a teleport.

Here’s what I did:

  • Implemented the relevant parts of the W3C Box Model. Every prim has Margin, Border, and Padding (in that order) surrounding the content. The margin is supposed to be transparent and I initially implemented it that way, but it was of questionable utility and there were some ugly antialiasing artifacts in the text. The margin, border, and padding can be set with the following commands on channel 2:

    • Margin:MMM
    • Border:BBB
    • Padding:PPP
  • The space left over after removing margins, borders, and padding is formally known as the content area.

  • All of this geometry is taken into account when computing the image width and height if necessary. If Height and Width are supplied then these items encroach on the defined area. If Height and Width are not supplied, the text is measured and these values cause it to grow.

  • Since there’s a border, there’s now a border color:

    • BorderColorRGB:RRR,GGG,BBB
  • Default colors are now reasonable. Black text against a white background, with a blue border.

  • RGB color parsing now works as expected.

  • Text now word-wraps within the content area and newline characters are respected. I am not sure how this will work if the Width and Height are not set, so it is best to set them if a lot of text is supplied.

  • Speaking of a lot of text, I have broken the 255 character URL limit using advanced magic, some PHP, and some MySQL tables! It is now (almost) possible to pass very long strings of text into the prim. I say almost because the client-side code can handle strings of any length, but the defined interface (sending text on channel 1) is limited to 255 characters by the Second Life messaging system. I will be defining a better prim-level API, one that can accept chunks of text, soon.

  • The server now supports use of any one of a number of different TrueType fonts, although there’s no way to make it do this yet from a prim.

  • The client now includes a “cache buster” in the media parcel commands to work around some of Second Life’s client-side caching.

There’s a special “demo string” on the server to show how nicely things work with a long string of text. Visit the prim and type the following:

  • /2 Height:512
  • /2 Width:512
  • /2 Margin:4
  • /2 Border:8
  • /2 Padding:4
  • /2 FontSize:12
  • /1 ** DOI **

This will display the first two paragraphs of the Declaration of Independence on the prim:


Now that the internals are working pretty well I will get the API (the set of “Say” commands which control the text) finalized and I’ll call it 1.0. I am ever so close to being able to give away and sell this cute little prim. Stay tuned for more, or log in to Second Life and join the “Text On a Prim / Web Page On a Prim” group.

Ok, I am wiped. Let me know what you think!