source: git/lib/TexFont.h @ 7b2006f

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

Utility to generate .txf files.

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

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