Skip to content

Commit

Permalink
Allows the book binder to remember font typing (tgstation#75007)
Browse files Browse the repository at this point in the history
use that for book binding
## About The Pull Request

Closes tgstation#74996
## Why It's Good For The Game
## Changelog
:cl:
fix: Bookbinder no longer takes your pen's font and throws it out the
nearest window
/:cl:
  • Loading branch information
ZephyrTFA authored Apr 29, 2023
1 parent fe5200b commit 4178abc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 2 additions & 5 deletions code/modules/library/book.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,9 @@
/datum/book_info/proc/set_content_using_paper(obj/item/paper/paper)
// Just the paper's raw data.
var/raw_content = ""

for(var/datum/paper_input/text_input as anything in paper.raw_text_inputs)
if(!isnull(text_input.colour))
raw_content += text_input.raw_text
else
raw_content += "<font color='[text_input.colour]'>[text_input.raw_text]</font>"
raw_content += text_input.to_raw_html()

content = trim(html_encode(raw_content), MAX_PAPER_LENGTH)

/datum/book_info/proc/get_content(default="N/A")
Expand Down
11 changes: 11 additions & 0 deletions code/modules/paperwork/paper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,17 @@
advanced_html = advanced_html,
)

/// Returns the raw contents of the input as html, with **ZERO SANITIZATION**
/datum/paper_input/proc/to_raw_html()
var/final = raw_text
if(font)
final = "<font face='[font]'>[final]</font>"
if(colour)
final = "<font color='[colour]'>[final]</font>"
if(bold)
final = "<b>[final]</b>"
return final

/// A single instance of a saved stamp on paper.
/datum/paper_stamp
/// Asset class of the for rendering in tgui
Expand Down

0 comments on commit 4178abc

Please sign in to comment.