You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+1
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,7 @@ The following tags are supported:
54
54
| p | Adds extra spacing below the line where this |`<p>A paragraph</p>\nSome other text`|
55
55
|| tag ends. Adds a newline before its opening |`<p=2.5>This has 2.5 lines of spacing<p>`|
56
56
|| tag if it doesn't already exist. ||
57
+
| repeat | Repeat the text enclosed by the tag |`<repeat=5>Echo </repeat> five times`|
57
58
58
59
### Line breaks
59
60
Note that there is no need for the HTML `<br/>` tag since line breaks (i.e. `\n`) are parsed and presented by the system. Note that a single `<br>` (ie without a closing or empty tag) isn't supported (even though most browsers accept it).
Copy file name to clipboardexpand all lines: example/example.gui_script
+22-16
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,18 @@ local color = require "richtext.color"
3
3
4
4
local sherlock = [[At three o'clock precisely I was at Baker Street, but Holmes had not yet returned. The landlady informed me that he had left the house shortly after eight o'clock in the morning. I sat down beside the fire, however, with the intention of awaiting him, however long he might be. I was already deeply interested in his inquiry, for, though it was surrounded by none of the grim and strange features which were associated with the two crimes which I have already recorded, still, the nature of the case and the exalted station of his client gave it a character of its own. Indeed, apart from the nature of the investigation which my friend had on hand, there was something in his masterly grasp of a situation, and his keen, incisive reasoning, which made it a pleasure to me to study his system of work, and to follow the quick, subtle methods by which he disentangled the most inextricable mysteries. So accustomed was I to his invariable success that the very possibility of his failing had ceased to enter into my head. It was close upon four before the door opened, and a drunken-looking groom, ill-kempt and side-whiskered, with an inflamed face and disreputable clothes, walked into the room. Accustomed as I was to my friend's amazing powers in the use of disguises, I had to look three times before I was certain that it was indeed he. With a nod he vanished into the bedroom, whence he emerged in five minutes tweed-suited and respectable, as of old. Putting his hands into his pockets, he stretched out his legs in front of the fire and laughed heartily for some minutes. 'Well, really!' he cried, and then he choked and laughed again until he was obliged to lie back, limp and helpless, in the chair. 'What is it?' 'It's quite too funny. I am sure you could never guess how I employed my morning, or what I ended by doing.' 'I can't imagine. I suppose that you have been watching the habits, and perhaps the house, of Miss Irene Adler.' 'Quite so; but the sequel was rather unusual. I will tell you, however. I left the house a little after eight o'clock this morning in the character of a groom out of work. There is a wonderful sympathy and freemasonry among horsey men. Be one of them, and you will know all that there is to know. I soon found Briony Lodge. It is a bijou villa, with a garden at the back, but built out in front right up to the road, two stories. Chubb lock to the door. Large sitting-room on the right side, well furnished, with long windows almost to the floor, and those preposterous English window fasteners which a child could open. Behind there was nothing remarkable, save that the passage window could be reached from the top of the coach-house. I walked round it and examined it closely from every point of view, but without noting anything else of interest. 'I then lounged down the street and found, as I expected, that there was a mews in a lane which runs down by one wall of the garden. I lent the ostlers a hand in rubbing down their horses, and received in exchange twopence, a glass of half and half, two fills of shag tobacco, and as much information as I could desire about Miss Adler, to say nothing of half a dozen other people in the neighbourhood in whom I was not in the least interested, but whose biographies I was compelled to listen to.']]
5
5
6
+
local ROBOTO = {
7
+
regular = hash("Roboto-Regular"),
8
+
italic = hash("Roboto-Italic"),
9
+
bold = hash("Roboto-Bold"),
10
+
bold_italic = hash("Roboto-BoldItalic"),
11
+
}
12
+
13
+
local NANUM = {
14
+
regular = hash("Nanum-Regular"),
15
+
}
16
+
17
+
6
18
local function merge(...)
7
19
local out = {}
8
20
for _,words in pairs({...}) do
@@ -27,15 +39,8 @@ end
27
39
local function create_complex_example()
28
40
local settings = {
29
41
fonts = {
30
-
Roboto = {
31
-
regular = hash("Roboto-Regular"),
32
-
italic = hash("Roboto-Italic"),
33
-
bold = hash("Roboto-Bold"),
34
-
bold_italic = hash("Roboto-BoldItalic"),
35
-
},
36
-
Nanum = {
37
-
regular = hash("Nanum-Regular"),
38
-
},
42
+
Roboto = ROBOTO,
43
+
Nanum = NANUM,
39
44
},
40
45
layers = {
41
46
fonts = {
@@ -204,12 +209,7 @@ end
204
209
local function create_overlapping_tags_example()
205
210
local settings_overlap = {
206
211
fonts = {
207
-
Roboto = {
208
-
regular = hash("Roboto-Regular"),
209
-
italic = hash("Roboto-Italic"),
210
-
bold = hash("Roboto-Bold"),
211
-
bold_italic = hash("Roboto-BoldItalic"),
212
-
},
212
+
Roboto = ROBOTO
213
213
},
214
214
position = vmath.vector3(0, 650, 0),
215
215
}
@@ -231,7 +231,6 @@ local function create_html_entities_example()
231
231
232
232
local settings_zwsp = { position = vmath.vector3(20, 500, 0), align = richtext.ALIGN_LEFT, width = 640 }
233
233
local zwsp = richtext.create("There is space&zwsp;&zwsp;&zwsp;&zwsp;here but you barely see it\nThere is no spacehere", "Roboto-Regular", settings_zwsp)
234
-
print(#zwsp)
235
234
return merge(ltgt, nbsp, zwsp)
236
235
end
237
236
@@ -299,6 +298,12 @@ local function create_colors_example()
299
298
end
300
299
301
300
301
+
local function create_repeat_example()
302
+
local settings = { position = vmath.vector3(320, 450, 0), align = richtext.ALIGN_CENTER, fonts = { Roboto = ROBOTO } }
0 commit comments