Skip to content

Commit

Permalink
Added default fonts for window
Browse files Browse the repository at this point in the history
This font is replaced when an user explicitly requests to load
a new font to be used by window for text rendering.
  • Loading branch information
9prady9 committed Feb 23, 2016
1 parent 4927ab7 commit 8b3b756
Show file tree
Hide file tree
Showing 17 changed files with 13 additions and 151 deletions.
10 changes: 0 additions & 10 deletions examples/cpu/bubblechart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "Bubble chart with Transparency Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

fg::Chart chart(fg::FG_2D);
chart.setAxesLimits(FRANGE_START, FRANGE_END, -1.1f, 1.1f);
Expand Down
6 changes: 5 additions & 1 deletion examples/cpu/fractal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "Fractal Demo");
wnd.makeCurrent();

/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
* it can be used for rendering text
*
* NOTE: THIS IS OPTIONAL STEP, BY DEFAULT WINDOW WILL
* HAVE FONT ALREADY SETUP*/
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
Expand Down
10 changes: 0 additions & 10 deletions examples/cpu/histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "Histogram Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

/*
* Split the window into grid regions
Expand Down
10 changes: 0 additions & 10 deletions examples/cpu/plot3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "Plot3d Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

fg::Chart chart(fg::FG_3D);
chart.setAxesLimits(-1.1f, 1.1f, -1.1f, 1.1f, 0.f, 10.f);
Expand Down
10 changes: 0 additions & 10 deletions examples/cpu/plotting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "Plotting Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

fg::Chart chart(fg::FG_2D);
chart.setAxesLimits(FRANGE_START, FRANGE_END, -1.1f, 1.1f);
Expand Down
10 changes: 0 additions & 10 deletions examples/cpu/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "3d Surface Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

fg::Chart chart(fg::FG_3D);
chart.setAxesLimits(-1.1f, 1.1f, -1.1f, 1.1f, -5.f, 10.f);
Expand Down
10 changes: 0 additions & 10 deletions examples/cuda/fractal.cu
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "Fractal Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

/* Create an image object which creates the necessary
* textures and pixel buffer objects to hold the image
Expand Down
10 changes: 0 additions & 10 deletions examples/cuda/histogram.cu
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "Histogram Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

/*
* Split the window into grid regions
Expand Down
10 changes: 0 additions & 10 deletions examples/cuda/plot3.cu
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "Plot 3d Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

fg::Chart chart(fg::FG_3D);
chart.setAxesLimits(-1.1f, 1.1f, -1.1f, 1.1f, 0.f, 10.f);
Expand Down
10 changes: 0 additions & 10 deletions examples/cuda/plotting.cu
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@ int main(void)
fg::Window wnd(DIMX, DIMY, "Plotting Demo");
wnd.makeCurrent();
wnd.grid(1,2);
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

fg::Chart chart(fg::FG_2D);
chart.setAxesLimits(FRANGE_START, FRANGE_END, -1.1f, 1.1f);
Expand Down
10 changes: 0 additions & 10 deletions examples/cuda/surface.cu
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "3d Surface Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

fg::Chart chart(fg::FG_3D);
chart.setAxesLimits(-1.1f, 1.1f, -1.1f, 1.1f, -5.f, 10.f);
Expand Down
10 changes: 0 additions & 10 deletions examples/opencl/fractal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "Fractal Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

/* Create an image object which creates the necessary
* textures and pixel buffer objects to hold the image
Expand Down
10 changes: 0 additions & 10 deletions examples/opencl/histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "Histogram Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

/*
* Split the window into grid regions
Expand Down
10 changes: 0 additions & 10 deletions examples/opencl/plot3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "Plot3d Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

fg::Chart chart(fg::FG_3D);
chart.setAxesLimits(-1.1f, 1.1f, -1.1f, 1.1f, 0.f, 10.f);
Expand Down
10 changes: 0 additions & 10 deletions examples/opencl/plotting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "Plotting Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

fg::Chart chart(fg::FG_2D);
chart.setAxesLimits(FRANGE_START, FRANGE_END, -1.1f, 1.1f);
Expand Down
10 changes: 0 additions & 10 deletions examples/opencl/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,6 @@ int main(void)
*/
fg::Window wnd(DIMX, DIMY, "3d Surface Demo");
wnd.makeCurrent();
/* create an font object and load necessary font
* and later pass it on to window object so that
* it can be used for rendering text */
fg::Font fnt;
#ifdef OS_WIN
fnt.loadSystemFont("Calibri");
#else
fnt.loadSystemFont("Vera");
#endif
wnd.setFont(&fnt);

fg::Chart chart(fg::FG_3D);
chart.setAxesLimits(-1.1f, 1.1f, -1.1f, 1.1f, -5.f, 10.f);
Expand Down
8 changes: 8 additions & 0 deletions src/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ window_impl::window_impl(int pWidth, int pHeight, const char* pTitle,
mats.resize(mWindow->mRows*mWindow->mCols);
std::fill(mats.begin(), mats.end(), glm::mat4(1));

/* setup default window font */
mFont = std::make_shared<font_impl>();
#ifdef OS_WIN
mFont->loadSystemFont("Calibri");
#else
mFont->loadSystemFont("Vera");
#endif

CheckGL("End Window::Window");
}

Expand Down

0 comments on commit 8b3b756

Please sign in to comment.