Skip to content

Commit 5eae522

Browse files
committed
Fix Textfields on Mac with Retina Display
1 parent 3b48711 commit 5eae522

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

OpenBCI_GUI/ConsoleLog.pde

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ static class ConsoleWindow extends PApplet implements Runnable {
9494

9595
void createConsoleLogButton (String bName, String bText, int x) {
9696
int y = 4; // vertical position for button
97+
PFont buttonFont = createFont("Arial", 14, true);
9798
cp5.addButton(bName)
9899
.setPosition(x, y)
99100
.setSize(buttonWidth, buttonHeight)
@@ -102,7 +103,7 @@ static class ConsoleWindow extends PApplet implements Runnable {
102103
.setColorBackground(color(144, 100));
103104
cp5.getController(bName)
104105
.getCaptionLabel()
105-
.setFont(p4)
106+
.setFont(buttonFont)
106107
.toUpperCase(false)
107108
.setText(bText);
108109
}

OpenBCI_GUI/OpenBCI_GUI.pde

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ PFont f1;
206206
PFont f2;
207207
PFont f3;
208208
PFont f4;
209+
PFont f5;
209210

210211
PFont h1; //large Montserrat
211212
PFont h2; //large/medium Montserrat
@@ -349,13 +350,14 @@ void setup() {
349350

350351
//V1 FONTS
351352
f1 = createFont("fonts/Raleway-SemiBold.otf", 16);
352-
if (isMac() && isMacOsLowerThanCatalina() && (displayDensity() > 1)) {
353-
f2 = createFont("fonts/Raleway-Regular.otf", 9);
354-
} else {
355-
f2 = createFont("fonts/Raleway-Regular.otf", 15);
356-
}
353+
//Account for Macs with Retina Display and textfield text being too large
354+
int f2FontSize = isMac() && (displayDensity() > 1) ? 8 : 15;
355+
f2 = createFont("fonts/Raleway-Regular.otf", f2FontSize);
357356
f3 = createFont("fonts/Raleway-SemiBold.otf", 15);
358357
f4 = createFont("fonts/Raleway-SemiBold.otf", 64); // clear bigger fonts for widgets
358+
//Account for Macs with Retina Display and textfield text being too large
359+
int f5FontSize = isMac() && (displayDensity() > 1) ? 6 : 12;
360+
f5 = createFont("fonts/Raleway-Regular.otf", f5FontSize);
359361

360362
h1 = createFont("fonts/Montserrat-Regular.otf", 20);
361363
h2 = createFont("fonts/Montserrat-Regular.otf", 18);

OpenBCI_GUI/SignalCheckThresholds.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class SignalCheckThresholdUI {
4545
.setPosition(_x, _y)
4646
.setCaptionLabel("")
4747
.setSize(_w, _h)
48-
.setFont(p5)
48+
.setFont(f5)
4949
.setFocus(false)
5050
.setColor(color(26, 26, 26))
5151
.setColorBackground(color(255, 255, 255)) // text field bg color

0 commit comments

Comments
 (0)