Skip to content

Commit

Permalink
Fix Max theme bug, fix [note] custom font bug
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Dec 18, 2024
1 parent cb320b0 commit 6594570
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
3 changes: 0 additions & 3 deletions Source/Components/WelcomePanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,6 @@ class WelcomePanel final : public Component
}

nvgSave(nvg);
auto const sB = bounds.toFloat().reduced(0.2f);
nvgRoundedScissor(nvg, sB.getX(), sB.getY(), sB.getWidth(), sB.getHeight(), Corners::largeCornerRadius);

auto const lB = bounds.toFloat().expanded(0.5f);
// Draw background even for images incase there is a transparent PNG
nvgDrawRoundedRect(nvg, lB.getX(), lB.getY(), lB.getWidth(), lB.getHeight(), convertColour(findColour(PlugDataColour::panelForegroundColourId)), convertColour(findColour(PlugDataColour::toolbarOutlineColourId)), Corners::largeCornerRadius);
Expand Down
9 changes: 6 additions & 3 deletions Source/Objects/NoteObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,12 @@ class NoteObject final : public ObjectBase {
return Fonts::getVariableFont().withStyle(style).withHeight(fontHeight);
}

// Check if there is a patch font loaded via the patch loading
if (auto const patchFont = Fonts::findFont(cnv->patch.getCurrentFile(), typefaceName); patchFont.has_value())
return patchFont->withStyle(style).withHeight(fontHeight);
auto currentFile = cnv->patch.getCurrentFile();
if(currentFile.exists() && !currentFile.isRoot()) {
// Check if there is a patch font loaded via the patch loading
if (auto const patchFont = Fonts::findFont(currentFile, typefaceName); patchFont.has_value())
return patchFont->withStyle(style).withHeight(fontHeight);
}

return { typefaceName, static_cast<float>(fontHeight), style };
}
Expand Down
9 changes: 2 additions & 7 deletions Source/Objects/TextObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,10 @@ class TextBase : public ObjectBase
bool const hasIoletArea = ioletAreaColour.r != backgroundColour.getRed() || ioletAreaColour.g != backgroundColour.getGreen() || ioletAreaColour.b != backgroundColour.getBlue() || ioletAreaColour.a != backgroundColour.getAlpha();

if (isValid && hasIoletArea) {
NVGScopedState scopedState(nvg);
constexpr float padding = 1.0f;
float constexpr padding2x = padding * 2;
nvgRoundedScissor(nvg, padding, padding, getWidth() - padding2x, getHeight() - padding2x, jmax(0.0f, Corners::objectCornerRadius - 1.0f));

nvgFillColor(nvg, ioletAreaColour);
nvgBeginPath(nvg);
nvgRect(nvg, 0, 0, getWidth(), 3.5f);
nvgRect(nvg, 0, getHeight() - 3.5f, getWidth(), 3.5f);
nvgRoundedRectVarying(nvg, 0, 0, getWidth(), 3.5f, Corners::defaultCornerRadius, Corners::defaultCornerRadius, 0.0f, 0.0f);
nvgRoundedRectVarying(nvg, 0, getHeight() - 3.5f, getWidth(), 3.5f, 0.0f, 0.0f, Corners::defaultCornerRadius, Corners::defaultCornerRadius);
nvgFill(nvg);

nvgDrawRoundedRect(nvg, b.getX(), b.getY(), b.getWidth(), b.getHeight(), nvgRGBA(0, 0, 0, 0), outlineCol, Corners::objectCornerRadius);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void runTests(PluginEditor* editor)
HelpFileFuzzTest helpfileFuzzer(editor);

UnitTestRunner runner;
//runner.runTests({&objectFuzzer, &helpfileFuzzer}, 23);
runner.runTests({&objectFuzzer, &helpfileFuzzer}, 23);
});
testRunnerThread.detach();
}

0 comments on commit 6594570

Please sign in to comment.