1This file contains general informations about QuesoGLC. For installation 2instructions, see the INSTALL file if you run a POSIX platform and INSTALL.win 3if you run Windows. 4 5QuesoGLC is a free implementation of SGI's OpenGL Character Renderer (GLC). 6QuesoGLC is based on the FreeType library, provides Unicode support and is 7designed to be easily ported on any platform that supports both FreeType and 8OpenGL. 9 10The most authoritative documentation on GLC is the GLC specification document, 11which is available in Postscript form at www.opengl.org 12 13Overview of GLC 14--------------- 15 16The OpenGL Character Renderer (GLC) is a subroutine library that provides 17OpenGL programs with character rendering services. 18 19A GLC context is an instantiation of the GLC state machine. A GLC client 20is a program that uses both OpenGL (henceforth, "GL") and GLC. When a 21client thread issues a GLC command, the thread's current GLC context 22executes the command. 23 24To render a character, a GLC client issues the command 25 26 glcRenderChar(GLint inCode); 27 28GLC then goes through these steps: 29 301. GLC finds a font that maps inCode to a character such as LATIN 31 CAPITAL LETTER A. 32 332. GLC uses one or more glyphs from the font to create a graphical 34 layout that represents the character. 35 363. GLC issues a sequence of GL commands to draw the layout. 37 38A font is a stylistically consistent set of glyphs that can be used to 39render some set of characters. Each font has a family name (e.g. Palatino) 40and a state variable that selects one of the faces (e.g. Regular, Bold, 41Italic, Bold Italic) that the font contains. A typeface is the combination 42of a family and a face (e.g. Palatino Bold). 43 44A font is an instantiation of a master. A master is a representation of the 45font that is stored outside of GLC in a standard format such as Type 1. 46 47A catalog is a file containing a list of master file names. A list of catalog 48names (GLC_CATALOG_LIST) defines the list of masters that can be instantiated 49in a GLC context. 50 51By default, GLC interprets all character codes as elements of the Unicode 52Character Database (UCD) defined by Unicode 4.0.1. 53 54The interpretation of arrays of character codes of type GLCchar in the 55GLC API is determined by the value of the GLC context state variable 56GLC_STRING_TYPE. The values GLC_UCS1, GLC_UCS2, GLC_UCS4 and GLC_UTF8 specify 57that each array element is either a Unicode code point of type GLubyte, 58GLushort, GLint, or GLubyte respectively. The initial value of GLC_STRING_TYPE 59is GLC_UCS1. 60 61Before issuing a GLC rendering command, a client must issue GL commands 62directly to establish a GL state such that the GL commands issued by GLC 63produce the desired result. For example, before issuing a glcRenderChar 64command, a client may issue glColor and glRasterPos commands to establish 65the color and origin of the resulting layout. 66 67Before issuing any GLC commands, the client must create a GL context and 68make it current. 69 70Glyph coordinates are defined in em units and are transformed during 71rendering to produce the desired mapping of the glyph shape into the GL 72window coordinate system. 73 74In addition to commands for rendering, the GLC API includes measurement 75commands that return certain metrics (currently the bounding box and the 76baseline) for the layout. 77 78Since the focus of GLC is on rendering and not modeling, the GLC API does 79not provide access to glyph shape data. 80 81EXAMPLES 82-------- 83 84The following ISO C code fragment uses GL and GLC to render the character 85LATIN CAPITAL LETTER A in red at (100, 100) using a default typeface at a 86scale of 24 pixels per em. In this example, GLC issues a glBitmap command 87to draw the layout. 88 89 glcContext(glcGenContext()); 90 glcScale(24.f, 24.f); 91 glColor3f(1.f, 0.f, 0.f); 92 glRasterPos2f(100.f, 100.f); 93 glcRenderChar(`A'); 94 95In the following example, GLC renders the string "Hello, world!" in red 9624 pixel Palatino Bold at a rotation of 30 degrees, starting at (100, 97100). 98 99 glcContext(glcGenContext()); 100 glcFont (glcNewFontFromFamily(1, "palatino")); 101 glcFontFace(1, "bold"); 102 glcScale(24.f, 24.f); 103 glcRotate(30.f); 104 glColor3f(1.f, 0.f, 0.f); 105 glRasterPos2f(100.f, 100.f); 106 glcRenderString("Hello, world!"); 107 108More examples can be found in the directory 'tests' of QuesoGLC. 109 110More info on QuesoGLC 111--------------------- 112 113Although the GLC specs are the authoritative doc, some details are left 114implementation dependant. Read the file 'specific.txt' for more info about 115that topic concerning QuesoGLC. 116