I'm not entirely sure about the syntax at all since this subject can debated for ages.
Code: Select all
rt = rich.new{"Hello, {big}world! {smile}", big = bigFont, smile = smileyImage}
On another note it would most likely be nice if this rich text can somehow be serialized to file and thus loaded from file as well.
With this in mind an alteration to the tags would be handy.
Code: Select all
rt = rich.new{"Hello, {font:path/to/font.fnt, 32}world! {image:path/to/image.png} {smile}", smile = smileyImage}
However this has a down side when in a text a certain image appears multiple times. As far as I know there is no caching of image data done with love.graphics.newImage so this would increase the memory usage and io. However in most longer texts it does not happen often that a larger image is repeated.
Another idea although I tend to dislike it myself is embedding the hex data of images. Would work nicely on generate "documents" but would kinda need an editor to make these kinds of "exported" texts.
Code: Select all
rt = rich.new{"Hello, {font:path/to/font.fnt, 32}world! {imagehex:0x89504E470D0A1A0A0000000D49484452000000100000001008060000001FF3FF61000000017352474200AECE1CE900000006624B474400FF00FF00FFA0BDA793000000097048597300000B1300000B1301009A9C180000000774494D4507DA0606091311D1D4657A000001794944415438CBA593CD2B446114C67F7367D860A15093C69558B09014294916CA2CA4A9BBB4F2272856AC2E49BE52568A859DAD88B26249928562E163868D9291CC4CCAEDB1B877CC9831938F53CFE29CF39EE77CBEF04FF1E51A4C5BE5C0283000747AE623600F588C4EFA5E0BB299B67A1B677433BE2D1DC724C771F1F0222D1D486D0BBA356DF5160A8EB42D7C0DCCC5C38B34B82699B6229F2D98B604E0F7C3E630B4D7BA8EBA29884D6412A4F5C704581B108BBB76233AE9F301D3566B26B8985495C1581F00D35E2C98B64E8B959E8BE794D43CAB3300C3236E69AACECF6618DFEB15A5505F490340C0F3A50206A5E95E8B497A2E01BF9B3C9DE3E6F6E9770774F7CC5536C1CEEE45FEA35010462C17A160C67E780DF1245BD904CBEB47241E1399124341E8EFCE2F3FF50EF3072481E5DC43B2C2ABEEB1388ED4B5FA158E23BDBE49E3DB9269CB2A748DFD3D2B8A6E9DBBABCA5EDDFEA534B4AE7BD3D6C04F3ED358498070730D1DDEC04EE2497680B9A29FE92FF201256503BC657B05300000000049454E44AE426082}"}
Some other things one might want to think about is:
- Text orientation (angling)
- color (fore- and background)
- animation (i.e. quads that can be altered or images that at runtime can be replaced)
Then again these ideas may complicate things beyond its simplistic function that is most appreciated.