Skip to content

Commit

Permalink
Improved docs
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Feb 26, 2018
1 parent 8f78e40 commit 84a4fc2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ The RichText library will create gui text nodes representing the markup in the t
bold = hash("Roboto-Bold"),
bold_italic = hash("Roboto-BoldItalic"),
},
VeraMo = {
regular = hash("VeraMo"),
},
Nanum = {
regular = hash("Nanum-Regular"),
},
Expand All @@ -85,8 +82,16 @@ The RichText library will create gui text nodes representing the markup in the t
position = vmath.vector3(0, 0, 0),
parent = gui.get_node("parent"),
}
self.nodes = richtext.create("Lorem <b>ipsum</b> dolor <color=red>sit</color> amet.", "Roboto", settings)

local text = "<size=3>RichText</size>Lorem <color=0,0.5,0,1>ipsum </color>dolor <color=red>sit </color><color=#ff00ffff>amet, </color><size=1.15><font=Nanum>consectetur </font></size>adipiscing elit. <b>Nunc </b>tincidunt <b><i>mattis</i> libero</b> <i>non viverra</i>. Nullam ornare accumsan rhoncus. Nunc placerat nibh a purus auctor, id scelerisque massa rutrum."

self.nodes = richtext.create(text, "Roboto", settings)

This would result in the following output:

![](docs/example.png)

## API
### richtext.create(text, settings)
Creates rich text gui nodes from a text containing markup.

Expand Down
Binary file added docs/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions example/example.gui_script
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local richtext = require "richtext.richtext"

local TEXT = "Lorem <color=0,0.5,0,1>ipsum </color>dolor <color=red>sit </color><color=#ff00ffff>amet, </color><size=1.75><font=Nanum>consectetur </font></size>adipiscing elit. <b>Nunc </b>tincidunt <b><i>mattis</i> libero</b> <i>non viverra</i>. Nullam ornare accumsan rhoncus. Nunc placerat nibh a purus auctor, id scelerisque massa rutrum. Phasellus dui nulla, finibus eu neque sit amet, interdum suscipit mauris. Phasellus mattis sem sed leo pretium, eu eleifend quam bibendum."
local TEXT = "<size=3>RichText</size>Lorem <color=0,0.5,0,1>ipsum </color>dolor <color=red>sit </color><color=#ff00ffff>amet, </color><size=1.15><font=Nanum>consectetur </font></size>adipiscing elit. <b>Nunc </b>tincidunt <b><i>mattis</i> libero</b> <i>non viverra</i>. Nullam ornare accumsan rhoncus. Nunc placerat nibh a purus auctor, id scelerisque massa rutrum."

function init(self)
local settings = {
Expand All @@ -11,9 +11,6 @@ function init(self)
bold = hash("Roboto-Bold"),
bold_italic = hash("Roboto-BoldItalic"),
},
VeraMo = {
regular = hash("VeraMo"),
},
Nanum = {
regular = hash("Nanum-Regular"),
},
Expand Down

0 comments on commit 84a4fc2

Please sign in to comment.