Miserlou / RJModules

Various modules for VCV Rack
https://github.com/Miserlou/RJModules
MIT License
98 stars 18 forks source link

EssEff/ChordSeq: Font size issues #41

Open cschol opened 5 years ago

cschol commented 5 years ago

Font issues ~on a 4K display on Windows 10~ on all platforms for EssEff and ChordSeq:

image

Miserlou commented 5 years ago

Hm, that's annoying. I'm on a rMBP and don't have that issue.

Screen Shot 2019-06-29 at 8 01 06 PM

This is the line, not sure if there's a way to set this in a density-independent way?

nvgFontSize(vg, 32);
cschol commented 5 years ago

I don't know. That would be a question for Andrew. Maybe ask in the forum?

stoermelder commented 5 years ago

I‘m not sure what difference it makes, but you can check nvgTextBox instead. https://github.com/stoermelder/vcvrack-packone/blob/9cb5dc71f6b8afb8d3a2fd77b6ef887db8b4bb6f/src/ReMove.cpp#L654

cschol commented 5 years ago

Figured out one problem:

diff --git a/src/EssEff.cpp b/src/EssEff.cpp
index dec90f4..b25720d 100644
--- a/src/EssEff.cpp
+++ b/src/EssEff.cpp
@@ -29,12 +29,12 @@ std::string soundfont_files[2] = {
 Display
 */

-struct SmallStringDisplayWidget : TransparentWidget {
+struct EssEffSmallStringDisplayWidget : TransparentWidget {

   std::string *value;
   std::shared_ptr<Font> font;

-  SmallStringDisplayWidget() {
+  EssEffSmallStringDisplayWidget() {
     font = Font::load(assetPlugin(pluginInstance, "res/Pokemon.ttf"));
   };

@@ -322,13 +322,13 @@ EssEffWidget::EssEffWidget(EssEff *module) {

     // Displays
     if(module != NULL){
-        SmallStringDisplayWidget *fileDisplay = new SmallStringDisplayWidget();
+        EssEffSmallStringDisplayWidget *fileDisplay = new EssEffSmallStringDisplayWidget();
         fileDisplay->box.pos = Vec(28, 70);
         fileDisplay->box.size = Vec(100, 40);
         fileDisplay->value = &module->file_name;
         addChild(fileDisplay);

-        SmallStringDisplayWidget *presetDisplay = new SmallStringDisplayWidget();
+        EssEffSmallStringDisplayWidget *presetDisplay = new EssEffSmallStringDisplayWidget();
         presetDisplay->box.pos = Vec(28, 170);
         presetDisplay->box.size = Vec(100, 40);
         presetDisplay->value = &module->preset_name;

Both, EssEff and ChordSeq define a class SmallStringDisplayWidget. On Windows and Linux the compiler seems to resolve the symbols to use the EssEff one in both cases and ChordSeq is messed up.

The above fix applied looks like this and ChordSeq looks correct:

image

The EssEff font size is still too big, but from the code this might need adjustment of the font size. It is 32 compared to 13 for the ChordSeq. Even with size 13 the string is overflowing the display box, though.

Miserlou commented 5 years ago

Thanks, patched.