Skip to content

Commit ccf5b32

Browse files
authored
Merge pull request openscad#5293 from openscad/gl-font-fix
Fix Axis Font Not Rendering Correctly Windows 11 (fixes openscad#5292).
2 parents df9595d + 39bfcbc commit ccf5b32

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/glview/GLView.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,21 +566,25 @@ void GLView::decodeMarkerValue(double i, double l, int size_div_sm)
566566
glVertex3d(-y + (fh + bl), 0, x); // z-label along z-axis; font below
567567
},
568568
};
569+
bool needs_glend = false;
569570
for (const PlaneVertexDraw& axis_draw : axis_draw_planes) {
570571
// We get 'plot instructions', a sequence of vertices. Translate into gl ops
571-
const auto plot_fun = [ = ](bool pen_down, float x, float y) {
572+
const auto plot_fun = [&](bool pen_down, float x, float y) {
572573
if (!pen_down) { // Start a new line, coordinates just move not draw
573-
glEnd();
574+
if (needs_glend) glEnd();
574575
glBegin(GL_LINE_STRIP);
576+
needs_glend = true;
575577
}
576578
axis_draw(x, y, font_size, baseline_offset);
577579
};
578580

579581
hershey::DrawText(pos_number_str, i, 0,
580582
hershey::TextAlign::kCenter, font_size, plot_fun);
581-
glEnd();
583+
if (needs_glend) glEnd();
584+
needs_glend = false;
582585
hershey::DrawText(neg_number_str, -i - prefix_offset, 0,
583586
hershey::TextAlign::kCenter, font_size, plot_fun);
584-
glEnd();
587+
if (needs_glend) glEnd();
588+
needs_glend = false;
585589
}
586590
}

0 commit comments

Comments
 (0)