123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- /*!
- \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;
- }
|