source: git/lib/TexFont.h @ b72f4b5

RELEASE/1.1RELEASE/1.2debug-cidebug-ci-sanitisersstereowalls-data
Last change on this file since b72f4b5 was b72f4b5, checked in by Olly Betts <olly@…>, 18 years ago

Apply Mark's OS X changes.

git-svn-id: file:///home/survex-svn/survex/branches/survex-1_1@3310 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

  • Property mode set to 100644
File size: 1.8 KB
Line 
1
2/* Copyright (c) Mark J. Kilgard, 1997. */
3
4/* This program is freely distributable without licensing fees  and is
5   provided without guarantee or warrantee expressed or  implied. This
6   program is -not- in the public domain. */
7
8#ifndef __TEXFONT_H__
9#define __TEXFONT_H__
10
11#ifdef __APPLE_CC__
12#include <OpenGL/gl.h>
13#else
14#include <GL/gl.h>
15#endif
16
17#define TXF_FORMAT_BYTE         0
18#define TXF_FORMAT_BITMAP       1
19
20typedef struct {
21  unsigned short c;       /* Potentially support 16-bit glyphs. */
22  unsigned char width;
23  unsigned char height;
24  signed char xoffset;
25  signed char yoffset;
26  signed char advance;
27  char dummy;           /* Space holder for alignment reasons. */
28  short x;
29  short y;
30} TexGlyphInfo;
31
32typedef struct {
33  GLfloat t0[2];
34  GLshort v0[2];
35  GLfloat t1[2];
36  GLshort v1[2];
37  GLfloat t2[2];
38  GLshort v2[2];
39  GLfloat t3[2];
40  GLshort v3[2];
41  GLfloat advance;
42} TexGlyphVertexInfo;
43
44typedef struct {
45  GLuint texobj;
46  int tex_width;
47  int tex_height;
48  int max_ascent;
49  int max_descent;
50  int num_glyphs;
51  int min_glyph;
52  int range;
53  unsigned char *teximage;
54  TexGlyphInfo *tgi;
55  TexGlyphVertexInfo *tgvi;
56  TexGlyphVertexInfo **lut;
57} TexFont;
58
59extern char *txfErrorString(void);
60
61extern TexFont *txfLoadFont(
62  char *filename);
63
64extern void txfUnloadFont(
65  TexFont * txf);
66
67extern GLuint txfEstablishTexture(
68  TexFont * txf,
69  GLuint texobj,
70  GLboolean setupMipmaps);
71
72extern void txfBindFontTexture(
73  TexFont * txf);
74
75extern void txfGetStringMetrics(
76  TexFont * txf,
77  char *string,
78  int len,
79  int *width,
80  int *max_ascent,
81  int *max_descent);
82
83extern void txfRenderGlyph(
84  TexFont * txf,
85  int c);
86
87extern void txfRenderString(
88  TexFont * txf,
89  char *string,
90  int len);
91
92extern void txfRenderFancyString(
93  TexFont * txf,
94  char *string,
95  int len);
96
97#endif /* __TEXFONT_H__ */
Note: See TracBrowser for help on using the repository browser.