Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-04-24 16:29:51 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-04-24 16:29:51 +1000
commit6f7e2bbb83d518c8df06966d71e83a23ed5dfefd (patch)
tree1cdacfaaa834f841a43d63a480b214b34b97545c
parentf58702683fda7d9b6c26548b1cf7e2382f958893 (diff)
slight font directives changes
invalid font directives stopped checkerboarding the glyph texture at some point, fixed that too
-rw-r--r--assets/opensb/interface.config.patch10
-rw-r--r--assets/opensb/interface/chat/chat.config.patch4
-rw-r--r--assets/opensb/interface/windowconfig/chatbubbles.config.patch2
-rw-r--r--source/core/StarDirectives.cpp2
-rw-r--r--source/rendering/StarFontTextureGroup.cpp34
5 files changed, 30 insertions, 22 deletions
diff --git a/assets/opensb/interface.config.patch b/assets/opensb/interface.config.patch
index 47076b2..e1ee5b7 100644
--- a/assets/opensb/interface.config.patch
+++ b/assets/opensb/interface.config.patch
@@ -6,9 +6,9 @@
},
"nametag" : {
"showMasterNames" : true,
- // border is double here as it otherwise fades out near the end
+ // outline is double here as it otherwise fades out near the end
// (could just the end to opaque too, but then diagonals are more jaggy)
- "textStyle" : { "backDirectives" : "border=1;222;2224?border=1;222;2224" },
+ "textStyle" : { "backDirectives" : "border=1;fff;fff4?border=1;fff;fff4?multiply=222" },
"inspectOpacityRate" : 0.15,
"movementThreshold" : 0.5,
"offset" : [0, 13]
@@ -24,7 +24,7 @@
"paneTextStyle" : {},
"textBoxTextStyle" : {},
"itemSlotTextStyle" : {
- "backDirectives" : "border=1;444;4444"
+ "backDirectives" : "border=1;fff;fff4?multiply=444"
},
"teamBarNameStyle" : {},
"cursorTooltip" : { "textStyle" : {} },
@@ -32,7 +32,7 @@
"debugTextStyle" : {
"font" : "iosevka-semibold",
"fontSize" : 7,
- "backDirectives" : "border=1;333a;3334"
+ "backDirectives" : "border=1;fff;fff7?multiply=333a"
},
"debugSpatialClearTime" : 0.0,
"debugOffset" : [80, 130],
@@ -40,7 +40,7 @@
// Change planet name to support the new internal string formatting.
"planetNameFormatString" : "- {} -",
"planetTextStyle" : {
- "backDirectives" : "border=6;000;000",
+ "backDirectives" : "border=5;fff;fff?border=1;fff;fff7?multiply=000",
"fontSize" : 24
},
diff --git a/assets/opensb/interface/chat/chat.config.patch b/assets/opensb/interface/chat/chat.config.patch
index afdc3f8..77ce454 100644
--- a/assets/opensb/interface/chat/chat.config.patch
+++ b/assets/opensb/interface/chat/chat.config.patch
@@ -2,8 +2,8 @@
"config" : {
"lineHeight" : 1,
"padding" : [1, 1],
- "textStyle" : { "backDirectives" : "border=1;111a;1117" },
- "chatFormatString" : "^backdirectives=border=1=333=3337;<^backdirectives=border=1=333=3330?border=1=333=3337,white;{}^reset,backdirectives=border=1=333=3337;>^reset,#eee; {}",
+ "textStyle" : { "backDirectives" : "border=1;fff;fff7?multiply=111a" },
+ "chatFormatString" : "^backdirectives=border=1=fff=fff7?multiply=333;<^backdirectives=border=1=fff=fff0?border=1=fff=fff7?multiply=333,white;{}^reset,backdirectives=border=1=fff=fff7?multiply=333;>^reset,#eee; {}",
"colors" : {
"local" : "^white;",
"party" : "^blue;",
diff --git a/assets/opensb/interface/windowconfig/chatbubbles.config.patch b/assets/opensb/interface/windowconfig/chatbubbles.config.patch
index c1773f6..a402a14 100644
--- a/assets/opensb/interface/windowconfig/chatbubbles.config.patch
+++ b/assets/opensb/interface/windowconfig/chatbubbles.config.patch
@@ -1,5 +1,5 @@
{
"movementThreshold" : 0.5,
"bubbleOffset" : [0, 1.875],
- "textStyle" : { "backDirectives" : "?border=1;111;1110?border=1;111;1117" }
+ "textStyle" : { "backDirectives" : "border=1;fff;fff0?border=1;fff;fff7?multiply=111" }
} \ No newline at end of file
diff --git a/source/core/StarDirectives.cpp b/source/core/StarDirectives.cpp
index 89985a0..b995b37 100644
--- a/source/core/StarDirectives.cpp
+++ b/source/core/StarDirectives.cpp
@@ -140,7 +140,7 @@ void Directives::parse(String&& directives) {
}
catch (StarException const& e) {
prefix = split;
- return;
+ entries.emplace_back(ImageOperation(ErrorImageOperation{std::current_exception()}), beg, end);
}
}
else {
diff --git a/source/rendering/StarFontTextureGroup.cpp b/source/rendering/StarFontTextureGroup.cpp
index 5f0cdbc..cdc667a 100644
--- a/source/rendering/StarFontTextureGroup.cpp
+++ b/source/rendering/StarFontTextureGroup.cpp
@@ -1,6 +1,7 @@
#include "StarFontTextureGroup.hpp"
#include "StarTime.hpp"
#include "StarImageProcessing.hpp"
+#include "StarLogging.hpp"
namespace Star {
@@ -58,23 +59,30 @@ const FontTextureGroup::GlyphTexture& FontTextureGroup::glyphTexture(String::Cha
auto renderResult = font->render(c);
Image& image = get<0>(renderResult);
if (processingDirectives) {
- try {
- Directives const& directives = *processingDirectives;
- Vec2F preSize = Vec2F(image.size());
-
- for (auto& entry : directives->entries)
+ Directives const& directives = *processingDirectives;
+ Vec2F preSize = Vec2F(image.size());
+
+ for (auto& entry : directives->entries) {
+ if (auto error = entry.operation.ptr<ErrorImageOperation>()) {
+ if (error->exception) {
+ try
+ { std::rethrow_exception(error->exception); }
+ catch (std::exception const& e)
+ { Logger::error("Exception parsing font directives: {}", e.what()); }
+ error->exception = {};
+ }
+ image.forEachPixel([](unsigned x, unsigned y, Vec4B& pixel) {
+ pixel = ((x + y) % 2 == 0) ? Vec4B(255, 0, 255, pixel[3]) : Vec4B(0, 0, 0, pixel[3]);
+ });
+ glyphTexture.colored = true;
+ } else
processImageOperation(entry.operation, image);
-
- glyphTexture.offset = (preSize - Vec2F(image.size())) / 2;
- }
- catch (StarException const&) {
- image.forEachPixel([](unsigned x, unsigned y, Vec4B& pixel) {
- pixel = ((x + y) % 2 == 0) ? Vec4B(255, 0, 255, pixel[3]) : Vec4B(0, 0, 0, pixel[3]);
- });
}
+
+ glyphTexture.offset = (preSize - Vec2F(image.size())) / 2;
}
- glyphTexture.colored = get<2>(renderResult);
+ glyphTexture.colored |= get<2>(renderResult);
glyphTexture.offset += Vec2F(get<1>(renderResult));
glyphTexture.texture = m_textureGroup->create(image);
}