From 61b53c516cc43bc458a679c1f3cac6906dc55c5b Mon Sep 17 00:00:00 2001
From: Kyle <41976328+ImKyle4815@users.noreply.github.com>
Date: Sun, 8 May 2022 14:01:29 -0700
Subject: [PATCH] absolute font sizes
---
creator/index.php | 1 +
js/creator-23.js | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/creator/index.php b/creator/index.php
index 275e46a4..f2ce768a 100644
--- a/creator/index.php
+++ b/creator/index.php
@@ -225,6 +225,7 @@ include('../globalHTML/header-1.php');
{lns}
Moves to the next line without an extra space (stands for line-no-space)
{divider}
Moves to the next line and draws the flavor text bar
{flavor}
Moves to the next line, draws the flavor text bar, and italicizes
+ {fontsize#pt}
Changes the font size to #pt (absolute)
{fontsize#}
Changes the font size by # pixels (relative - use negative integers to shrink text - ie '{fontsize-12}')
{fontcolor___}
Changes the font color to ___ (ie '{fontcolor#00FF00}')
{left}
Aligns text to the left
diff --git a/js/creator-23.js b/js/creator-23.js
index eab5c394..4e73c0a4 100644
--- a/js/creator-23.js
+++ b/js/creator-23.js
@@ -1051,7 +1051,11 @@ function writeText(textObject, targetContext) {
textColor = possibleCode.replace('fontcolor', '');
lineContext.fillStyle = textColor;
} else if (possibleCode.includes('fontsize')) {
- textSize += parseInt(possibleCode.replace('fontsize', '')) || 0;
+ if (possibleCode.slice(-2) === "pt") {
+ textSize = (parseInt(possibleCode.replace('fontsize', '').replace('pt', '')) * 600 / 72) || 0;
+ } else {
+ textSize += parseInt(possibleCode.replace('fontsize', '')) || 0;
+ }
lineContext.font = textFontStyle + textSize + 'px ' + textFont + textFontExtension;
} else if (possibleCode.includes('font') || savedFont) {
textFont = word.replace('{font', '').replace('}', '');