This library contains RichString and RichStringBuilder objects. These objects are analogous to the normal String and StringBuilder. However RichStrings can contain formatting information that controls how they are drawn when used as the text in a View.
This library also contains a RichStringFormatter object. This object, once suitably initialised, will efficiently format RichStrings passed to it. For long strings that require many changes of format this is much more efficient than using the individual RichString formatting commands.
EDIT :- Version 1.1 posted. See post #8 for details.
EDIT :- Version 1.2 posted including RichStringFormatter. See post #13 for details.
EDIT :- Version 1.3 posted. See post #15 for details.
Andrew,
I just ran the demo and read through the code for the demo as well as the online documentation. Looks great, but I do have a couple of questions.
First, in the documentation some of the methods have parameters you call "metachars" defined as String. What do you mean by "metachars"? Would you give an example, please.
Second, I have some lengthy text in files that I will be using and want formatted for display, but don't want -- at least at this point - to use WebView. The material is envisioned as book-like pages that are to be read only. In using RichStringBuilder, what would you recommend as the View of choice for display and how should I structure the text for both input and output? Is there any way to read in a file and output it appropriately?
Finally, I notice under STYLE you have BOLD, ITALIC and BOLD_ITALIC. I see, too, that you have underlining. However, I see no combinations such as BOLD_UNDERLINE. I suspect I can get the same effect by using BOLD and UNDERLINE individually. But, if this is the case, can't I get the same effect as BOLD_ITALIC with BOLD and ITALIC individually. Or were you merely duplicating the android conventions for formatting? Oh, yes, one last question -- what if I want to use a more specific typeface other than monospace, serif or sans serif (i.e. Calibre), do I specify the typeface in the same manner as with the Typeface method in Label or EditText?
Sorry for the sort of stream of consciousness approach. And Thanks.