Skip to content

Commit ceb2ff9

Browse files
authored
Fixes error with Hershey Draw call on windows (openscad#6122)
1 parent 4c9d585 commit ceb2ff9

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/glview/GLView.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,11 +637,11 @@ void GLView::decodeMarkerValue(double i, double l, int size_div_sm)
637637
axis_draw(x, y, font_size, baseline_offset);
638638
};
639639

640-
hershey::DrawText(pos_number_str, i, 0, hershey::TextAlign::kCenter, font_size, plot_fun);
640+
hershey::DrawTextHershey(pos_number_str, i, 0, hershey::TextAlign::kCenter, font_size, plot_fun);
641641
if (needs_glend) glEnd();
642642
needs_glend = false;
643-
hershey::DrawText(neg_number_str, -i - prefix_offset, 0, hershey::TextAlign::kCenter, font_size,
644-
plot_fun);
643+
hershey::DrawTextHershey(neg_number_str, -i - prefix_offset, 0, hershey::TextAlign::kCenter,
644+
font_size, plot_fun);
645645
if (needs_glend) glEnd();
646646
needs_glend = false;
647647
}

src/glview/hershey.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ float TextWidth(std::string_view str, float size)
3737
return std::max(longest_line, w);
3838
}
3939

40-
void DrawText(std::string_view str, float tx, float ty, TextAlign align, float size,
41-
const std::function<void(bool do_line, float x, float y)>& draw)
40+
void DrawTextHershey(std::string_view str, float tx, float ty, TextAlign align, float size,
41+
const std::function<void(bool do_line, float x, float y)>& draw)
4242
{
4343
float dx = 0;
4444
if (align == TextAlign::kRight) dx = -TextWidth(str, size);

src/glview/hershey.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace hershey {
1010

11-
// Determine the width of the text if drawn with DrawText()
11+
// Determine the width of the text if drawn with DrawTextHershey()
1212
float TextWidth(std::string_view str, float size);
1313

1414
// Horizontal alignment
@@ -20,6 +20,6 @@ enum class TextAlign { kLeft, kCenter, kRight };
2020
// "x", "y" - the position to moveto/lineto
2121
// The function makes it independent of any output device and easy to
2222
// adapt in any environment including 3D projection.
23-
void DrawText(std::string_view str, float tx, float ty, TextAlign align, float size,
24-
const std::function<void(bool pen_down, float x, float y)>& draw);
23+
void DrawTextHershey(std::string_view str, float tx, float ty, TextAlign align, float size,
24+
const std::function<void(bool pen_down, float x, float y)>& draw);
2525
} // namespace hershey

0 commit comments

Comments
 (0)