Loading...
Searching...
No Matches
gsd_fonts.c
Go to the documentation of this file.
/*!
\file lib/ogsf/gsd_fonts.c
\brief OGSF library - loading and manipulating surfaces
GRASS OpenGL gsurf OGSF Library
\todo This file needs to be re-written in OpenGL
(C) 1999-2008 by the GRASS Development Team
This program is free software under the
GNU General Public License (>=v2).
Read the file COPYING that comes with GRASS
for details.
\author Bill Brown USACERL, GMSL/University of Illinois
\author Doxygenized by Martin Landa <landa.martin gmail.com> (May 2008)
*/
#include <string.h>
#include <assert.h>
#include <grass/ogsf.h>
#include "rgbpack.h"
/*!
\brief Get text width
\param s text string
\param size size
\return text width
*/
int gsd_get_txtwidth(const char *s, int size)
{
int width, len;
len = strlen(s);
width = (size * len) / 2;
return (width);
}
/*!
\brief Get text height
\param size size
\return text height
*/
int gsd_get_txtheight(int size)
{
unsigned long height;
height = size / 2;
return (height);
}
/*!
\brief Get text descender
yorig ??
Is this defined somewhere ?
\return 2
*/
int get_txtdescender(void)
{
return (2);
}
/*!
\brief Get text offset
xorig ??
Is this defined somewhere ?
\return 0
*/
int get_txtxoffset(void)
{
return (0);
}
/*!
\brief Display label
\param fontbase font-base
\param lab_pos label position
\param txt text string
*/
void do_label_display(GLuint fontbase, float *lab_pos, const char *txt)
{
glRasterPos2f(lab_pos[X], lab_pos[Y]);
glListBase(fontbase);
glCallLists(strlen(txt), GL_UNSIGNED_BYTE, (const GLvoid *)txt);
return;
}
do_label_display
void do_label_display(GLuint fontbase, float *lab_pos, const char *txt)
Display label.
Definition gsd_fonts.c:97
gsd_get_txtwidth
int gsd_get_txtwidth(const char *s, int size)
Get text width.
Definition gsd_fonts.c:36
get_txtdescender
int get_txtdescender(void)
Get text descender.
Definition gsd_fonts.c:71
gsd_get_txtheight
int gsd_get_txtheight(int size)
Get text height.
Definition gsd_fonts.c:53
get_txtxoffset
int get_txtxoffset(void)
Get text offset.
Definition gsd_fonts.c:85
rgbpack.h
X
#define X(j)
Y
#define Y(j)