1 /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3  * This file is part of openfx-supportext <https://github.com/devernay/openfx-supportext>,
4  * Copyright (C) 2013-2018 INRIA
5  *
6  * openfx-supportext is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * openfx-supportext is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with openfx-supportext.  If not, see <http://www.gnu.org/licenses/gpl-2.0.html>
18  * ***** END LICENSE BLOCK ***** */
19 
20 /*
21  * Small utility to draw text using OpenGL.
22  * This code is based on the free glut source code.
23  *
24  * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
25  * Written by Pawel W. Olszta, <olszta@sourceforge.net>
26  * Creation date: Thu Dec 2 1999
27  *
28  * Permission is hereby granted, free of charge, to any person obtaining a
29  * copy of this software and associated documentation files (the "Software"),
30  * to deal in the Software without restriction, including without limitation
31  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
32  * and/or sell copies of the Software, and to permit persons to whom the
33  * Software is furnished to do so, subject to the following conditions:
34  *
35  * The above copyright notice and this permission notice shall be included
36  * in all copies or substantial portions of the Software.
37  *
38  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
39  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
41  * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
42  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
43  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
44  */
45 
46 
47 #ifndef openfx_supportext_ofxsOGLTextRenderer_h
48 #define openfx_supportext_ofxsOGLTextRenderer_h
49 
50 
51 namespace OFX {
52 namespace TextRenderer {
53 enum Font
54 {
55     FONT_FIXED_8_X_13 = 0,
56     FONT_FIXED_9_X_15,
57     FONT_HELVETICA_10,
58     FONT_HELVETICA_12,
59     FONT_HELVETICA_18,
60     FONT_TIMES_ROMAN_10,
61     FONT_TIMES_ROMAN_24
62 };
63 
64 /**
65  * @brief Draws the text contained in string. This must be a NULL terminated string.
66  * @param font The font to use to render. If it doesn't correspond to one of the enum
67  * this function will not draw anything.
68  **/
69 void bitmapString(const char *string, TextRenderer::Font font = FONT_HELVETICA_12);
70 
71 /**
72  *@brief Same as strokeString() but translates the OpenGL matrix to the (x,y) position before drawing.
73  **/
74 void bitmapString(double x, double y, const char*string, TextRenderer::Font font = FONT_HELVETICA_12);
75 } // TextRendered
76 } // OFX
77 
78 
79 #endif /* defined(openfx_supportext_ofxsOGLTextRenderer_h) */
80