diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-08-23 15:09:14 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-08-23 15:09:14 -0700 |
commit | 89222f86a0dc3dd774ce46afaa1ba791ed65dba9 (patch) | |
tree | 66603b7aec59f2d25a4ed58318687896ae7877f2 | |
parent | 43dfa184d6e63e17efcd0c20a1090632eba88141 (diff) | |
download | text.love-89222f86a0dc3dd774ce46afaa1ba791ed65dba9.tar.gz |
set color for each fragment
In general it seems like good practice to minimize assumptions about the current color.
-rw-r--r-- | text.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/text.lua b/text.lua index 61ead17..2e3aa32 100644 --- a/text.lua +++ b/text.lua @@ -9,7 +9,6 @@ require 'text_tests' -- draw a line starting from startpos to screen at y between State.left and State.right -- return the final y, and position of start of final screen line drawn function Text.draw(State, line_index, y, startpos) - App.color(Text_color) local line = State.lines[line_index] local line_cache = State.line_cache[line_index] line_cache.starty = y @@ -20,6 +19,7 @@ function Text.draw(State, line_index, y, startpos) local screen_line_starting_pos = startpos Text.compute_fragments(State, line_index) for _, f in ipairs(line_cache.fragments) do + App.color(Text_color) local frag, frag_text = f.data, f.text local frag_len = utf8.len(frag) --? print('text.draw:', frag, 'at', line_index,pos, 'after', x,y) |