GRASS GIS 8 Programmer's Manual 8.4.1(2025)-45ca3179ab
Loading...
Searching...
No Matches
gsd_fonts.c
Go to the documentation of this file.
1/*!
2 \file lib/ogsf/gsd_fonts.c
3
4 \brief OGSF library - loading and manipulating surfaces
5
6 GRASS OpenGL gsurf OGSF Library
7
8 \todo This file needs to be re-written in OpenGL
9
10 (C) 1999-2008 by the GRASS Development Team
11
12 This program is free software under the
13 GNU General Public License (>=v2).
14 Read the file COPYING that comes with GRASS
15 for details.
16
17 \author Bill Brown USACERL, GMSL/University of Illinois
18 \author Doxygenized by Martin Landa <landa.martin gmail.com> (May 2008)
19 */
20
21#include <string.h>
22#include <assert.h>
23
24#include <grass/ogsf.h>
25
26#include "rgbpack.h"
27
28/*!
29 \brief Get text width
30
31 \param s text string
32 \param size size
33
34 \return text width
35 */
36int gsd_get_txtwidth(const char *s, int size)
37{
38 int width, len;
39
40 len = strlen(s);
41 width = (size * len) / 2;
42
43 return (width);
44}
45
46/*!
47 \brief Get text height
48
49 \param size size
50
51 \return text height
52 */
53int gsd_get_txtheight(int size)
54{
55 unsigned long height;
56
57 height = size / 2;
58
59 return (height);
60}
61
62/*!
63 \brief Get text descender
64
65 yorig ??
66
67 Is this defined somewhere ?
68
69 \return 2
70 */
72{
73 return (2);
74}
75
76/*!
77 \brief Get text offset
78
79 xorig ??
80
81 Is this defined somewhere ?
82
83 \return 0
84 */
86{
87 return (0);
88}
89
90/*!
91 \brief Display label
92
93 \param fontbase font-base
94 \param lab_pos label position
95 \param txt text string
96 */
97void do_label_display(GLuint fontbase, float *lab_pos, const char *txt)
98{
99 glRasterPos2f(lab_pos[X], lab_pos[Y]);
100 glListBase(fontbase);
101 glCallLists(strlen(txt), GL_UNSIGNED_BYTE, (const GLvoid *)txt);
102
103 return;
104}
void do_label_display(GLuint fontbase, float *lab_pos, const char *txt)
Display label.
Definition gsd_fonts.c:97
int gsd_get_txtwidth(const char *s, int size)
Get text width.
Definition gsd_fonts.c:36
int get_txtdescender(void)
Get text descender.
Definition gsd_fonts.c:71
int gsd_get_txtheight(int size)
Get text height.
Definition gsd_fonts.c:53
int get_txtxoffset(void)
Get text offset.
Definition gsd_fonts.c:85
#define X(j)
#define Y(j)