slight font directives changes
invalid font directives stopped checkerboarding the glyph texture at some point, fixed that too
This commit is contained in:
parent
f58702683f
commit
6f7e2bbb83
@ -6,9 +6,9 @@
|
|||||||
},
|
},
|
||||||
"nametag" : {
|
"nametag" : {
|
||||||
"showMasterNames" : true,
|
"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)
|
// (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,
|
"inspectOpacityRate" : 0.15,
|
||||||
"movementThreshold" : 0.5,
|
"movementThreshold" : 0.5,
|
||||||
"offset" : [0, 13]
|
"offset" : [0, 13]
|
||||||
@ -24,7 +24,7 @@
|
|||||||
"paneTextStyle" : {},
|
"paneTextStyle" : {},
|
||||||
"textBoxTextStyle" : {},
|
"textBoxTextStyle" : {},
|
||||||
"itemSlotTextStyle" : {
|
"itemSlotTextStyle" : {
|
||||||
"backDirectives" : "border=1;444;4444"
|
"backDirectives" : "border=1;fff;fff4?multiply=444"
|
||||||
},
|
},
|
||||||
"teamBarNameStyle" : {},
|
"teamBarNameStyle" : {},
|
||||||
"cursorTooltip" : { "textStyle" : {} },
|
"cursorTooltip" : { "textStyle" : {} },
|
||||||
@ -32,7 +32,7 @@
|
|||||||
"debugTextStyle" : {
|
"debugTextStyle" : {
|
||||||
"font" : "iosevka-semibold",
|
"font" : "iosevka-semibold",
|
||||||
"fontSize" : 7,
|
"fontSize" : 7,
|
||||||
"backDirectives" : "border=1;333a;3334"
|
"backDirectives" : "border=1;fff;fff7?multiply=333a"
|
||||||
},
|
},
|
||||||
"debugSpatialClearTime" : 0.0,
|
"debugSpatialClearTime" : 0.0,
|
||||||
"debugOffset" : [80, 130],
|
"debugOffset" : [80, 130],
|
||||||
@ -40,7 +40,7 @@
|
|||||||
// Change planet name to support the new internal string formatting.
|
// Change planet name to support the new internal string formatting.
|
||||||
"planetNameFormatString" : "- {} -",
|
"planetNameFormatString" : "- {} -",
|
||||||
"planetTextStyle" : {
|
"planetTextStyle" : {
|
||||||
"backDirectives" : "border=6;000;000",
|
"backDirectives" : "border=5;fff;fff?border=1;fff;fff7?multiply=000",
|
||||||
"fontSize" : 24
|
"fontSize" : 24
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
"config" : {
|
"config" : {
|
||||||
"lineHeight" : 1,
|
"lineHeight" : 1,
|
||||||
"padding" : [1, 1],
|
"padding" : [1, 1],
|
||||||
"textStyle" : { "backDirectives" : "border=1;111a;1117" },
|
"textStyle" : { "backDirectives" : "border=1;fff;fff7?multiply=111a" },
|
||||||
"chatFormatString" : "^backdirectives=border=1=333=3337;<^backdirectives=border=1=333=3330?border=1=333=3337,white;{}^reset,backdirectives=border=1=333=3337;>^reset,#eee; {}",
|
"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" : {
|
"colors" : {
|
||||||
"local" : "^white;",
|
"local" : "^white;",
|
||||||
"party" : "^blue;",
|
"party" : "^blue;",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"movementThreshold" : 0.5,
|
"movementThreshold" : 0.5,
|
||||||
"bubbleOffset" : [0, 1.875],
|
"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" }
|
||||||
}
|
}
|
@ -140,7 +140,7 @@ void Directives::parse(String&& directives) {
|
|||||||
}
|
}
|
||||||
catch (StarException const& e) {
|
catch (StarException const& e) {
|
||||||
prefix = split;
|
prefix = split;
|
||||||
return;
|
entries.emplace_back(ImageOperation(ErrorImageOperation{std::current_exception()}), beg, end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "StarFontTextureGroup.hpp"
|
#include "StarFontTextureGroup.hpp"
|
||||||
#include "StarTime.hpp"
|
#include "StarTime.hpp"
|
||||||
#include "StarImageProcessing.hpp"
|
#include "StarImageProcessing.hpp"
|
||||||
|
#include "StarLogging.hpp"
|
||||||
|
|
||||||
namespace Star {
|
namespace Star {
|
||||||
|
|
||||||
@ -58,23 +59,30 @@ const FontTextureGroup::GlyphTexture& FontTextureGroup::glyphTexture(String::Cha
|
|||||||
auto renderResult = font->render(c);
|
auto renderResult = font->render(c);
|
||||||
Image& image = get<0>(renderResult);
|
Image& image = get<0>(renderResult);
|
||||||
if (processingDirectives) {
|
if (processingDirectives) {
|
||||||
try {
|
Directives const& directives = *processingDirectives;
|
||||||
Directives const& directives = *processingDirectives;
|
Vec2F preSize = Vec2F(image.size());
|
||||||
Vec2F preSize = Vec2F(image.size());
|
|
||||||
|
|
||||||
for (auto& entry : directives->entries)
|
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);
|
processImageOperation(entry.operation, image);
|
||||||
|
}
|
||||||
|
|
||||||
glyphTexture.offset = (preSize - Vec2F(image.size())) / 2;
|
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.colored = get<2>(renderResult);
|
glyphTexture.colored |= get<2>(renderResult);
|
||||||
glyphTexture.offset += Vec2F(get<1>(renderResult));
|
glyphTexture.offset += Vec2F(get<1>(renderResult));
|
||||||
glyphTexture.texture = m_textureGroup->create(image);
|
glyphTexture.texture = m_textureGroup->create(image);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user