1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2003 by Warren Lyford Delano of DeLano Scientific.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* --------------------------------------------------\-----------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_Text
#define _H_Text
#include"PyMOLGlobals.h"
#include"Base.h"
/* Here are the issues:
- Many different types of fonts:
bitmap (glut)
stroke vector
3D-vector (extrusion)
pixmap (raster)
texture
- Availability:
* we don't want to load fonts which consume resources before they're needed.
* we don't want to slow down PyMOL launching any more than it already has been
- Performance:
* really, only vector and texture fonts deliver the performance we seek
* want zero overhead when using a pre-loaded font (no Python locks allowed)
- Raytracing:
* glut font cannot be raytraced,
* pixmap and texture mapped fonts need resolution resolution >= PNG file
* need a geometric stand-in for the font for rendering (filled rect + alpha okay)
- Quality:
* vector font looks klunky
* antialiasing essential if labels are to work with PyMOL imagery
- Flexibility: want to be able to color fonts on the fly, but also support multi-color fonts
- Threading:
* font loading will require the Python interpreter lock, since some fonts are defined
* fonts are global PyMOL data
- Geometric:
* are fonts rendered in screen space, model space, or both?
* when we specify size, do we mean screen pixels or model distances?
* do we support kerning? what other metrics are critical?
- Portability:
* can we support fonts without C++? FreeType2 is ANSI C...
*/
/* font_sources */
#define cTextSrcGeneral 0
#define cTextSrcGLUT 1
#define cTextSrcFreeType 2
int TextInit(PyMOLGlobals * G);
int TextGetFontID(PyMOLGlobals * G, int src, int code, const char *name, int size_mode,
int style);
void TextFree(PyMOLGlobals * G);
void TextSetLabPos(PyMOLGlobals * G, float *pos, LabPosType * labpos, const char *text);
void TextSetPickColor(PyMOLGlobals * G, int index, int pass);
void TextSetWorldPos(PyMOLGlobals * G, float *pos);
float *TextGetWorldPos(PyMOLGlobals * G);
void TextSetScreenWorldOffset(PyMOLGlobals * G, float *pos);
float *TextGetScreenWorldOffset(PyMOLGlobals * G);
void TextSetPos(PyMOLGlobals * G, float *pos);
void TextSetColor(PyMOLGlobals * G, float *color);
void TextSetColor3f(PyMOLGlobals * G, float red, float green, float blue);
void TextGetOutlineColor(PyMOLGlobals * G,
unsigned char *red,
unsigned char *green, unsigned char *blue, unsigned char *alpha);
void TextSetOutlineColor(PyMOLGlobals * G, int color);
void TextSetPosNColor(PyMOLGlobals * G, float *pos, float *color);
float *TextGetColor(PyMOLGlobals * G);
float *TextGetPos(PyMOLGlobals * G);
void TextGetColorUChar(PyMOLGlobals * G, unsigned char *red,
unsigned char *green, unsigned char *blue, unsigned char *alpha);
const char *TextRenderOpenGL(PyMOLGlobals * G, RenderInfo * info, int text_id, const char *st,
float size, float *rpos, CGO *shaderCGO);
const char *TextRenderRay(PyMOLGlobals * G, CRay * ray, int text_id, const char *st, float size,
float *rpos);
void TextDrawStrAt(PyMOLGlobals * G, const char *st, int x, int y ORTHOCGOARG);
void TextDrawStr(PyMOLGlobals * G, const char *st ORTHOCGOARG);
void TextIndent(PyMOLGlobals * G, float x, float y);
void TextAdvance(PyMOLGlobals * G, float advance);
void TextSetPos2i(PyMOLGlobals * G, int x, int y);
void TextDrawChar(PyMOLGlobals * G, char ch ORTHOCGOARG);
void TextDrawSubStrFast(PyMOLGlobals * G, const char *c, int x, int y, int start, int n ORTHOCGOARG);
void TextDrawCharRepeat(PyMOLGlobals * G, char c, int x, int y, int start, int n ORTHOCGOARG);
#endif
|