HexText

From Second Life Wiki
Jump to navigation Jump to search

About

HexText is an LSL script to display Unicode text on 8 faced prims within Second Life. Supported is included for Japanese/Chinese, as well as many other languages and symbols. It is not all-inclusive There are some code pages that are missing. It does cover the majority of characters that avatars use in Unicode enhanced display names. Emojis that are outside of the first 256 Unicode code pages, are not included.

There are two display scripts. One is optimized for general usage, the other is optimized for Japanese/Chinese.

The primary font used is Google's Noto Monospace (Bold & Regular), supplemented with other open source or public domain fonts for code pages not covered by Noto.

The character set is broken up into individual textures for each supported Unicode code page, each texture a 16 x 16 matrix of characters. To minimize texture memory usage, the majority of textures are rendered at 512 x 256 pixels (Kanji is rendered at 512 x 384 which gets reduced to 512 x 256 at upload.)

Acknowledgments

Thanks go to Ochi Wolfe for his excellent FURWARE text display sytem and documentation. Without his, and his contributors efforts, HexText would have been significantly more difficult to create.

HexText is released under the MIT license to match the FURWARE license.

HexText uses a subset of the FURWARE_text/Reference command set. HexText does not support virtual text boxes, inline styles or touch queries.

The HexText texture set was created with FURWARE_text/TextureCreator.

HexText can use displays set up by the FURWARE_text/Tutorial#Creating_displays, however it can only use the 8 faced prim displays. HexText uses display prims with the same description format used by FURWARE text. HexText only supports a single display set per linkset, unlike FURWARE text that can handle multiple displays per linkset.

Use of both HexText and the FURWARE text scripts in the same linkset is not recommended.

Should anyone wish to combine the benefits of FURWARE text and HexText, please feel free! For my purposes, I did not need the full FURWARE text feature set, and believed that combining both might require 2 scripts, and performance may suffer.

Setup

(Fill in with info on where to get/how to use the FURWARE Display Creator)

LSL Scripts

There are two variants of HexText. The generic version allocates one prim face for each character. The 2XKanji version allocates 2 faces for Kanji/Katakana. This makes C/J/K characters easier to read, but the script is a little more convoluted. Oddly, performance of the 2XKanji version sometimes surpasses the Generic version.

Reference Manual

Commands supported in HexText (a subset of the FURWARE command set.)

Commands

The following commands can be issued from othere scripts in your linkset to control HexText.

fw_data

Display a string on the screen. The entire screen is overwritten with the text message. If you wish to only overwrite a portion of the display, consider fw_direct.

llMessageLinked(LINK_SET, 0, "Some text to draw.", "fw_data");

fw_direct

This command is not supported by FURWARE. It is unique to HexText to display text at specific display coordinates. It does not erase the display when called, instead, it overwrites existing characters in the display. Trim is ignored with fw_direct.

llMessageLinked(LINK_SET, 0, "Some text to draw.", "fw_direct:10:2");

Display the string "Some text to draw." starting at the 10th column, 2nd row (both start at 0.)

fw_conf & fw_defaultconf

Sets the global style preference for the display. Unlike FURWARE, fw_conf is treated the same as fw_defaultconf.

llMessageLinked(LINK_SET, 0, "c=red; a=center", "fw_conf");
llMessageLinked(LINK_SET, 0, "c=red; a=center", "fw_defaultconf");

fw_notify

Enable or disable link message notifications when the script has completed rendering. Off by default.

llMessageLinked(LINK_SET, 0, "on", "fw_notify");
llMessageLinked(LINK_SET, 0, "off", "fw_notify");

A link message will be sent to the linkset after rendering is complete with the key value of "fw_done"

fw_memory

Tells the owner how much memory is available.

llMessageLinked(LINK_SET, 0, "", "fw_memory");

fw_reset

Performs a full reset on the text script.

llMessageLinked(LINK_SET, 0, "", "fw_reset");

A link message will be sent to the linkset after reset is complete with the key value of "fw_ready"

Style settings

Text styles and format settings are specified using special strings. They are used for global settings ("fw_conf").

A single setting is given as a key=value pair, for example c=red.

Multiple settings are separated by ";", for example c=red; a=center; w=none.

In the following table: Italic = Default

Setting Key Values Description
Font color c R,G,B Font color as red, green, blue (each in range 0.0-1.0)
R,G,B,A Font color as red, green, blue, alpha (each in range 0.0-1.0)
rand Random color (with alpha = 1)
(predefined) Predefined color, see table below (default is White)
Alignment a left Alignment left
center Alignment centered
right Alignment right
Wrapping w word Wrap after words, if possible
char Wrap at any position
none No wrapping; cuts overlong lines
Trimming t on Trims whitespace from beginning and end of lines
off Keeps whitespace (except with wrap=word)
Force refresh force on Enables forced refresh of all faces (disables optimizations!)
off Disables forced refresh of all faces (enables optimizations)

Predefined colors

You may use the following names in place of color vectors in styles.

red green blue cyan magenta yellow white silver
darkred darkgreen darkblue darkcyan darkmagenta darkyellow black gray

Bugs

Probably a lot. Let Hexadeci Mole know.