Message ID | 20190701121720.18009-4-y.karadz@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Add support for text rendering | expand |
diff --git a/kernel-shark/examples/dataplot.cpp b/kernel-shark/examples/dataplot.cpp index 94841e7..1f06dc9 100644 --- a/kernel-shark/examples/dataplot.cpp +++ b/kernel-shark/examples/dataplot.cpp @@ -27,6 +27,9 @@ using namespace std; #define default_file (char*)"trace.dat" +struct ksplot_font font; +const char *font_file = "/usr/share/fonts/truetype/msttcorefonts/times.ttf"; + struct kshark_trace_histo histo; vector<KsPlot::Graph *> graphs; @@ -72,6 +75,11 @@ void drawShapes() r.setFill(false); r.draw(); + if (ksplot_init_font(&font, 60, font_file)) { + struct ksplot_color col = {100, 255, 0}; + ksplot_print_text(&font, &col, 250, 70, "Hello Kernel!"); + } + glFlush(); }
run: kernel-shark/bin/dplot -s And if the font file is loaded successfully you will see "Hello Kernel!" rendered. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> --- kernel-shark/examples/dataplot.cpp | 8 ++++++++ 1 file changed, 8 insertions(+)