Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

font.c

Go to the documentation of this file.
00001 /****************************************************************************************/
00002 /*  FONT.C                                                                              */
00003 /*                                                                                      */
00004 /*  Author: Thom Robertson                                                              */
00005 /*  Description: Bitmapped font support implementation                                  */
00006 /*               This implementation supports any TrueType fonts provided by Windows    */
00007 /*                                                                                      */
00008 /*  The contents of this file are subject to the Genesis3D Public License               */
00009 /*  Version 1.01 (the "License"); you may not use this file except in                   */
00010 /*  compliance with the License. You may obtain a copy of the License at                */
00011 /*  http://www.genesis3d.com                                                            */
00012 /*                                                                                      */
00013 /*  Software distributed under the License is distributed on an "AS IS"                 */
00014 /*  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See                */
00015 /*  the License for the specific language governing rights and limitations              */
00016 /*  under the License.                                                                  */
00017 /*                                                                                      */
00018 /*  The Original Code is Genesis3D, released March 25, 1999.                            */
00019 /*Genesis3D Version 1.1 released November 15, 1999                            */
00020 /*  Copyright (C) 1999 WildTangent, Inc. All Rights Reserved           */
00021 /*                                                                                      */
00022 /****************************************************************************************/
00023 #define WIN32_LEAN_AND_MEAN
00024 #pragma warning(disable : 4201 4214 4115)
00025 #include <windows.h>
00026 #include <windowsx.h>
00027 #pragma warning(default : 4201 4214 4115)
00028 
00029 #include "extbox.h"
00030 #include "ram.h"
00031 #include "wgClip.h"
00032 
00033 #include <assert.h>
00034 #include <string.h>
00035 
00036 #include "font.h"
00037 
00038 #pragma warning (disable:4514)  // unreferenced inline function (caused by Windows)
00039 
00040 //*************************************************************************************** 
00041 GENESISAPI geBoolean  GENESISCC geFont_TestDraw(geFont *font, int16 x, int16 y, int16 index);
00042    // This is a debugging function that you shouldn't have to use.  It outputs an entire
00043    // bitmap full of characters to the screen and the x,y location.
00044 
00045    // ARGUMENTS:
00046    // font - pointer to the font to draw with.
00047    // x and y - screen location to draw the upper left corner of the bitamp at.
00048    // index - which bitmap to draw.
00049 
00050    // RETURNS:
00051    // success: GE_TRUE
00052    // failure: GE_FALSE
00053 
00054    // NOTES:
00055    // Since fonts can be of an arbitrary point size, an arbitrary amount of 256x256
00056    // bitmaps is required to represent all of the characters.  The index argument lets you
00057    // pick which bitmap in the list to display.
00058 
00059 
00060 
00061 //*******************************************************************************
00062 typedef struct geFontBitmap
00063 {
00064    void *next;
00065    geBitmap *map;
00066    int16 freeX, freeY;  // place the next character here.
00067 
00068 } geFontBitmap;
00069 
00070 //*******************************************************************************
00071 typedef struct geFontCharacterRecord
00072 {
00073    geFontBitmap *bitmapUsed;  // NULL == not initialized yet.
00074    GE_Rect bitmapRect;
00075    int32 offsetX, offsetY, fullWidth;
00076 
00077 } geFontCharacterRecord;
00078 
00079 //*******************************************************************************
00080 typedef struct geFont 
00081 {
00082    char fontNameString[64];
00083    int16 fontSize;
00084    int16 fontWeight;
00085    geFontBitmap *bitmapList;
00086    geFontCharacterRecord characterArray[256];
00087    const geEngine *Engine;
00088    geBitmap *buffer;
00089 
00090    geBoolean antialiased;
00091 
00092    int32 refCount;
00093 
00094 } geFont;
00095 
00096 
00097 
00098 GENESISAPI geBoolean GENESISCC geFont_DrawUsingDIB(geFont *font, const char *textString, 
00099                                                    RECT box, geBitmap *targetBitmap,
00100                                                    const GE_RGBA *Color, uint32 flags);
00101 
00102 //*******************************************************************************
00103 //*******************************************************************************
00104 GENESISAPI geFont *GENESISCC geFont_Create(const geEngine *Engine, const char *fontNameString, 
00105                                                const int fontSize, const int fontWeight,
00106                                                const geBoolean anti)
00107 {
00108    geFont *font;
00109    int i;
00110 
00111    // create a new font
00112    font = GE_RAM_ALLOCATE_STRUCT(geFont);
00113    assert(font);
00114 
00115    // initalize the new font to having no data in it.
00116    font->bitmapList = NULL;
00117    for (i = 0; i < 256; i++)
00118       font->characterArray[i].bitmapUsed = NULL;
00119 
00120    strncpy(font->fontNameString, fontNameString,64);
00121    font->fontNameString[63] = 0;
00122 
00123    font->fontSize = fontSize;
00124    font->fontWeight = fontWeight;
00125 
00126    font->Engine = Engine;
00127 
00128    font->buffer = NULL;
00129 
00130    font->refCount = 1;
00131 
00132    font->antialiased = anti;
00133 
00134    return font;
00135 }
00136 
00137 //*************************************************************************************** 
00138 GENESISAPI void GENESISCC geFont_CreateRef(geFont *font)
00139 {
00140    assert(font);
00141    font->refCount++;
00142 }
00143 
00144 
00145 //*******************************************************************************
00146 GENESISAPI void GENESISCC geFont_Destroy(geFont **font)
00147 {
00148 
00149    geFontBitmap *curFontBitmap, *tempFontBitmap;
00150 
00151    assert(*font);
00152 
00153    (*font)->refCount--;
00154 
00155    // don't destroy this font if there's still a reference out there.
00156    if ((*font)->refCount > 0)
00157       return;
00158 
00159    geFont_DestroyBitmapBuffer(*font);
00160 
00161    curFontBitmap = (*font)->bitmapList;
00162    while (curFontBitmap)
00163    {
00164       tempFontBitmap = curFontBitmap->next;
00165 
00166       geEngine_RemoveBitmap((geEngine *) (*font)->Engine, curFontBitmap->map);
00167 
00168       geBitmap_Destroy(&(curFontBitmap->map));
00169       geRam_Free(curFontBitmap);
00170       curFontBitmap = tempFontBitmap;
00171    }
00172 
00173    geRam_Free(*font);
00174    (*font) = NULL;
00175 
00176 }
00177 
00178 //****************************************************************************
00179 FIXED PASCAL NEAR FixedFromDouble(double d)
00180 {
00181     long l;
00182 
00183     l = (long) (d * 65536L);
00184     return *(FIXED *)&l;
00185 }
00186 
00187 //*******************************************************************************
00188 static  void    IdentityMat(LPMAT2 lpMat)
00189 {
00190     lpMat->eM11 = FixedFromDouble(1);
00191     lpMat->eM12 = FixedFromDouble(0);
00192     lpMat->eM21 = FixedFromDouble(0);
00193     lpMat->eM22 = FixedFromDouble(1);
00194 }
00195 
00196 //*******************************************************************************
00197 void PlaceLetter(int16 locX, int16 locY, geFont *font, geFontBitmap *fontMap, 
00198                  uint32 asciiValue, unsigned char *cellBuffer, DWORD bufferSize)
00199 {
00200    GLYPHMETRICS glyphMetrics;
00201    HDC hdc; 
00202    MAT2 mat2;
00203    int32 success, bufferReturnSize;
00204    uint32 x,y;
00205    unsigned char *destBits;
00206    int bufferWidth, possibleH;
00207    char c;
00208    int16 mapWidth, mapHeight;
00209    HFONT win32Font, win32OldFont;
00210    geBitmap *lock;
00211    geBitmap_Info Info;
00212    geBitmap_Info SecondaryInfo;
00213 
00214    uint32 ggoFormat;
00215 
00216    IdentityMat(&mat2);
00217 
00218 
00219    mapWidth  = geBitmap_Width (fontMap->map);
00220    mapHeight = geBitmap_Height(fontMap->map);
00221 
00222         win32Font = CreateFont( -1 * font->fontSize,
00223                                             0,0,0, font->fontWeight,
00224                                             0,0,0,0,OUT_TT_ONLY_PRECIS ,0,0,0, font->fontNameString);
00225 
00226    hdc = GetDC(GetDesktopWindow());
00227    assert(hdc);
00228 
00229    c = (char)asciiValue;
00230 
00231    if (font->antialiased)
00232       ggoFormat = GGO_GRAY8_BITMAP;
00233    else
00234       ggoFormat = GGO_BITMAP;                        
00235 
00236    win32OldFont = SelectObject( hdc, win32Font); 
00237    bufferReturnSize    = GetGlyphOutline( hdc, asciiValue, ggoFormat, 
00238                                  &glyphMetrics, 0, NULL, &mat2);
00239    success    = GetGlyphOutline( hdc, asciiValue, ggoFormat, 
00240                                  &glyphMetrics, bufferSize, cellBuffer, &mat2);
00241    assert(GDI_ERROR != success);
00242 //   success    = GetGlyphOutline( hdc, asciiValue, GGO_METRICS, &glyphMetrics, 0, NULL, &mat2);
00243 //   assert(GDI_ERROR != success);
00244    SelectObject( hdc, win32OldFont); 
00245 
00246    ReleaseDC(GetDesktopWindow(),hdc);
00247 
00248    DeleteObject(win32Font);
00249 
00250    // get buffer width
00251 //   bufferWidth = glyphMetrics.gmCellIncX - glyphMetrics.gmptGlyphOrigin.x;
00252 //   bufferWidth = glyphMetrics.gmBlackBoxX;
00253    if (glyphMetrics.gmBlackBoxY)
00254    {
00255       possibleH = glyphMetrics.gmBlackBoxY-1;
00256       do 
00257       {
00258          possibleH++;
00259          bufferWidth = bufferReturnSize / possibleH;
00260       } while (bufferWidth * possibleH != bufferReturnSize);
00261    }
00262    else
00263    bufferWidth = glyphMetrics.gmBlackBoxX;
00264 
00265    if (GGO_BITMAP == ggoFormat)
00266    {
00267       bufferWidth/= 8;
00268       if (bufferWidth <= 0)
00269          bufferWidth = 1;
00270    }
00271 
00272 
00273    // make sure it's double-word aligned.
00274    while (bufferWidth%4)
00275       bufferWidth++;
00276 
00277    font->characterArray[asciiValue].bitmapUsed = fontMap;
00278    font->characterArray[asciiValue].bitmapRect.Left   = fontMap->freeX;
00279    font->characterArray[asciiValue].bitmapRect.Top    = fontMap->freeY;
00280    font->characterArray[asciiValue].bitmapRect.Right  = fontMap->freeX +
00281                                                    glyphMetrics.gmBlackBoxX;
00282    font->characterArray[asciiValue].bitmapRect.Bottom = fontMap->freeY +
00283                                                          glyphMetrics.gmBlackBoxY;
00284    font->characterArray[asciiValue].offsetX   = glyphMetrics.gmptGlyphOrigin.x;
00285    font->characterArray[asciiValue].offsetY   = glyphMetrics.gmptGlyphOrigin.y;
00286    font->characterArray[asciiValue].fullWidth = glyphMetrics.gmCellIncX;
00287 
00288    glyphMetrics.gmptGlyphOrigin.y  = glyphMetrics.gmptGlyphOrigin.y - glyphMetrics.gmBlackBoxY;
00289 
00290 
00291    // lock the fontMap surface...
00292    success = geBitmap_LockForWrite(     fontMap->map, &lock,
00293                                     0,0);
00294    success = geBitmap_GetInfo(lock, &Info, &SecondaryInfo);
00295    mapWidth  = Info.Stride;
00296 
00297    destBits = geBitmap_GetBits(lock);
00298 
00299    // clear the character space to 0s...
00300    if (GGO_BITMAP == ggoFormat)                        
00301    {
00302 
00303       for ( y = 0; 
00304             y < glyphMetrics.gmBlackBoxY; 
00305             y++)
00306       {
00307          for (x = 0;
00308               x < glyphMetrics.gmBlackBoxX; 
00309               x++)
00310          {
00311                            uint8 temp, mask;
00312                            temp = cellBuffer[y * bufferWidth + x/8];
00313             mask = 1 << (7 - (x % 8));
00314 
00315             if (mask&temp)
00316                destBits[(y+locY)*mapWidth + (x+locX)] = 255;
00317             else
00318                destBits[(y+locY)*mapWidth + (x+locX)] = 0;
00319          }
00320       }
00321    }
00322    else
00323    {
00324       for ( y = 0; 
00325             y < glyphMetrics.gmBlackBoxY; 
00326             y++)
00327       {
00328          for (x = 0;
00329               x < glyphMetrics.gmBlackBoxX; 
00330               x++)
00331          {
00332                               int temp;
00333                               temp = 4 * cellBuffer[y * bufferWidth + x];
00334                               if (temp> 255)
00335                                       temp = 255;
00336             destBits[(y+locY)*mapWidth + (x+locX)] = temp;
00337          }
00338       }
00339    }
00340    success = geBitmap_UnLock(lock);
00341 }
00342 
00343 //*******************************************************************************
00344 GENESISAPI geBoolean GENESISCC geFont_AddCharacters(geFont *font, 
00345                                                   unsigned char leastIndex, 
00346                                                   unsigned char mostIndex
00347                                                   )
00348 {
00349    MAT2 mat2;
00350    GLYPHMETRICS glyphMetrics;
00351    HDC hdc;
00352    DWORD success;
00353    unsigned char asciiValue;
00354    int placedLetter;
00355    int16 mapWidth, mapHeight;
00356    HFONT win32Font, win32OldFont;
00357    geFontBitmap *fontBitmap;
00358    geBitmap_Palette *Palette;
00359    int i;
00360    unsigned char *cellBuffer;
00361    DWORD bufferSize;
00362 
00363    uint32 ggoFormat;
00364 
00365    mat2.eM11.fract = 0;
00366    mat2.eM11.value = 1;
00367    mat2.eM12.fract = 0;
00368    mat2.eM12.value = 0;
00369    mat2.eM21.fract = 0;
00370    mat2.eM21.value = 0;
00371    mat2.eM22.fract = 0;
00372    mat2.eM22.value = 1;
00373 
00374    // get the character bitmap
00375    bufferSize = 32768;
00376    cellBuffer = GE_RAM_ALLOCATE_ARRAY(unsigned char, bufferSize);
00377    memset(cellBuffer,0xee,bufferSize);
00378 
00379 
00380    for (asciiValue = leastIndex; asciiValue <= mostIndex; asciiValue++)
00381    {
00382       placedLetter = FALSE;
00383 
00384       if (font->antialiased)
00385          ggoFormat = GGO_GRAY8_BITMAP;
00386       else
00387          ggoFormat = GGO_BITMAP;                        
00388 
00389       // find out the dimensions of the character
00390         win32Font = CreateFont( -1 * font->fontSize,
00391                                             0,0,0, font->fontWeight,
00392                                             0,0,0,0,OUT_TT_ONLY_PRECIS ,0,0,0, font->fontNameString);
00393 
00394       hdc = GetDC(GetDesktopWindow());
00395       assert(hdc);
00396 
00397       win32OldFont = SelectObject( hdc, win32Font); 
00398       success    = GetGlyphOutline( hdc, asciiValue, ggoFormat, 
00399                                  &glyphMetrics, bufferSize, cellBuffer, &mat2);
00400       SelectObject( hdc, win32OldFont); 
00401 
00402       ReleaseDC(GetDesktopWindow(),hdc);
00403 
00404       DeleteObject(win32Font);
00405 
00406       fontBitmap = font->bitmapList;
00407       while (fontBitmap)
00408       {
00409          // will it fit into the current bitmap?
00410          mapWidth  = geBitmap_Width (fontBitmap->map);
00411          mapHeight = geBitmap_Height(fontBitmap->map);
00412 
00413          // if there's enough vertical space...
00414          if ((int32)glyphMetrics.gmBlackBoxY <= (mapHeight-1) - fontBitmap->freeY)
00415          {
00416             // if there's enough horizontal space...
00417             if (glyphMetrics.gmCellIncX <= (mapWidth-1) - fontBitmap->freeX)
00418             {
00419                // place the letter!
00420                PlaceLetter(fontBitmap->freeX, fontBitmap->freeY, font,
00421                            fontBitmap, asciiValue, cellBuffer, bufferSize); 
00422                placedLetter = TRUE;
00423                fontBitmap->freeX = fontBitmap->freeX + glyphMetrics.gmBlackBoxX;
00424             }
00425             else
00426             {
00427                fontBitmap->freeY = fontBitmap->freeY + font->fontSize;
00428                fontBitmap->freeX = 0;
00429                // if there's enough vertical space...
00430                if ((int32)glyphMetrics.gmBlackBoxY <= (mapHeight-1) - fontBitmap->freeY)
00431                {
00432                   // if there's enough horizontal space...
00433                   if (glyphMetrics.gmCellIncX <= (mapWidth-1) - fontBitmap->freeX)
00434                   {
00435                      // place the letter!
00436                      PlaceLetter(fontBitmap->freeX, fontBitmap->freeY, font,
00437                                  fontBitmap, asciiValue, cellBuffer, bufferSize);
00438                      placedLetter = TRUE;
00439                      fontBitmap->freeX = fontBitmap->freeX + glyphMetrics.gmBlackBoxX;
00440                   }
00441                }
00442             }
00443          }
00444          fontBitmap = fontBitmap->next;
00445       }
00446 
00447       if (!placedLetter)
00448       {
00449          // gotta create a new font bitmap.
00450          fontBitmap = GE_RAM_ALLOCATE_STRUCT(geFontBitmap);
00451          assert(fontBitmap);
00452          fontBitmap->next = font->bitmapList;
00453          font->bitmapList = fontBitmap;
00454          fontBitmap->freeX = 0;
00455          fontBitmap->freeY = 0;
00456          fontBitmap->map = geBitmap_Create(256,256, 1, GE_PIXELFORMAT_8BIT); 
00457 
00458          // and a pallette for it.
00459          Palette = geBitmap_Palette_Create(GE_PIXELFORMAT_32BIT_XRGB, 256);
00460 
00461          for (i = 0; i < 256; i++)
00462          {
00463             success = geBitmap_Palette_SetEntryColor(Palette, i, i, i, i, i);
00464             assert(success);
00465 
00466          }
00467 
00468          success = geBitmap_SetPalette(fontBitmap->map, Palette);
00469          assert(success);
00470 
00471                 success = geBitmap_SetColorKey(fontBitmap->map, TRUE, 0 ,FALSE );
00472 
00473 
00474          success = geBitmap_Palette_Destroy(&Palette);         
00475          assert(success);
00476 
00477 
00478          success = geEngine_AddBitmap((geEngine *)font->Engine, fontBitmap->map);
00479          assert(success);
00480 
00481          PlaceLetter(fontBitmap->freeX, fontBitmap->freeY,  font,
00482                      fontBitmap, asciiValue, cellBuffer, bufferSize);
00483          fontBitmap->freeX = fontBitmap->freeX + glyphMetrics.gmBlackBoxX;
00484 
00485      
00486       }
00487 
00488    }
00489 
00490    geRam_Free(cellBuffer);
00491 
00492    return TRUE;
00493 }
00494 
00495 //*******************************************************************************
00496 GENESISAPI geBoolean GENESISCC geFont_DrawText(geFont *font, const char *textString, 
00497                                            const GE_Rect *Rect, const GE_RGBA *Color, 
00498                                            uint32 flags, const GE_Rect *clipRect)
00499 {
00500 
00501    int32 x,y,i;
00502    int32 tempX;//, tempY;
00503    int32 lineLen;
00504 
00505    uint32 colorArray[256];
00506    geFloat  fcolorX, fcolorR, fcolorG, fcolorB;
00507 
00508    int32 stringLen;
00509    int32 currentCharIndex;
00510    int32 lineEndIndex=0;
00511    geFontCharacterRecord *charRec;
00512 
00513    geBoolean success;
00514    geBoolean longEnough, endOfText;
00515 
00516    GE_Rect artRect;
00517    RECT box;
00518    int32 resultX, resultY;
00519 
00520    geFontBitmap *lastBitmap;
00521    geBitmap_Palette * palette;
00522 
00523    // unimplemented flags which we don't want you to use yet.
00524    assert(!(flags & GE_FONT_WRAP           ));
00525    assert(!(flags & GE_FONT_JUST_RETURN_FIT));
00526    assert(!(flags & GE_FONT_JUSTIFY_RIGHT  ));
00527    assert(!(flags & GE_FONT_JUSTIFY_CENTER ));
00528 
00529    lastBitmap = NULL;
00530    x = 0;
00531    y = 0;
00532    stringLen = strlen(textString);
00533    currentCharIndex = 0;
00534 
00535    if (font->bitmapList)  // if this font has character bitmaps...
00536    {
00537 
00538       while (currentCharIndex < stringLen)
00539       {
00540          // skip leading white space for this line.
00541          while (isspace(textString[currentCharIndex]) && currentCharIndex < stringLen)
00542             currentCharIndex++;
00543 
00544          // if, because of the whitespace skip, we're out of text, exit the loop.
00545          if (currentCharIndex >= stringLen)
00546             break;
00547 
00548          lineLen = 0;
00549          lineEndIndex = currentCharIndex;
00550          longEnough = FALSE;
00551          endOfText = FALSE;
00552          while (!longEnough)
00553          {
00554             charRec = &(font->characterArray[textString[lineEndIndex]]);
00555 
00556             // if the character has art...
00557             if (charRec->bitmapUsed)
00558             {
00559 
00560                if (Rect->Left + lineLen + (charRec->fullWidth) >
00561                    Rect->Right)
00562                    longEnough = TRUE;
00563                else
00564                {
00565                   lineLen = lineLen + (charRec->fullWidth);
00566                   lineEndIndex++;
00567                   if (lineEndIndex >= stringLen)
00568                   {
00569                      longEnough = TRUE;
00570                      endOfText = TRUE;
00571                   }
00572                }
00573             }
00574             else
00575             {
00576                lineEndIndex++;
00577                if (lineEndIndex >= stringLen)
00578                {
00579                   longEnough = TRUE;
00580                   endOfText = TRUE;
00581                }
00582             }
00583          }
00584 
00585          // if we're word-wrapping, back up to BEFORE the last hunk of whitespace.
00586          if (flags & GE_FONT_WORDWRAP && !endOfText)
00587          {
00588             tempX = lineEndIndex;
00589             while (tempX > currentCharIndex && !isspace(textString[tempX]))
00590                tempX--;
00591 
00592             if (isspace(textString[tempX]))
00593             {
00594                while (tempX > currentCharIndex && isspace(textString[tempX]))
00595                   tempX--;
00596 
00597                lineEndIndex = tempX;
00598             }
00599          }
00600 
00601          // aaannnddd,  DRAW!
00602          for (; currentCharIndex <= lineEndIndex && currentCharIndex < stringLen; currentCharIndex++)
00603          {
00604             charRec = &(font->characterArray[textString[currentCharIndex]]);
00605 
00606             if (charRec->bitmapUsed)
00607             {
00608 
00609                if (charRec->bitmapUsed != lastBitmap)
00610                {
00611 
00612                   lastBitmap = charRec->bitmapUsed;
00613 
00614                   palette = geBitmap_GetPalette(lastBitmap->map);
00615                   assert(palette);
00616 
00617                   for (i = 0; i < 256; i++)
00618                   {
00619 
00620                      fcolorR = Color->r * i / 255;
00621                      fcolorG = Color->g * i / 255;
00622                      fcolorB = Color->b * i / 255;
00623                      fcolorX = Color->a * i / 255;
00624 
00625                      colorArray[i] = gePixelFormat_ComposePixel(        GE_PIXELFORMAT_32BIT_XRGB, (int)fcolorR, (int)fcolorG, (int)fcolorB, (int)fcolorX);
00626                   }
00627 
00628                   success = geBitmap_Palette_SetData(   palette ,colorArray,GE_PIXELFORMAT_32BIT_XRGB, 256);
00629            
00630                   success = geBitmap_SetPalette(lastBitmap->map, palette);
00631                   assert(success);
00632 
00633                }
00634             
00635             
00636                if (clipRect)
00637                {
00638                   artRect = charRec->bitmapRect;
00639 
00640                   if ( CalculateClipping( &artRect, &resultX, &resultY, 
00641                               Rect->Left + x + charRec->offsetX, 
00642                               Rect->Top + y + (font->fontSize - charRec->offsetY),
00643                               *clipRect, GE_CLIP_CORNER)
00644                      )
00645                   {
00646                      success = geEngine_DrawBitmap(font->Engine, charRec->bitmapUsed->map,
00647                                                                    &artRect, resultX, resultY);
00648                   }
00649 
00650                }
00651                else
00652                {
00653                  success = geEngine_DrawBitmap(font->Engine, charRec->bitmapUsed->map,
00654                                                                    &(charRec->bitmapRect), Rect->Left + x + charRec->offsetX, 
00655                               Rect->Top + y + (font->fontSize - charRec->offsetY));
00656                }
00657                x += charRec->fullWidth;
00658             }
00659             else
00660             {
00661                // we reached this point because we're trying to draw a character that
00662                // hasn't been added to the font yet using geFont_AddCharacters().
00663                assert(0);
00664             }
00665          
00666          }
00667          y += font->fontSize;
00668          x = 0;
00669       }
00670    }
00671    else // this font has no attached bitmaps, sooo, we do it another way!
00672    {
00673 
00674       // at this point, we're trying to put text to the screen using DrawText() and
00675       // a DIB.  This process REQUIRES an initialized geBitmap as a go-between.
00676       // Is it initialized?
00677       assert(font->buffer);
00678 
00679       box.left   = 0;
00680       box.right  = Rect->Right - Rect->Left;
00681       box.top    = 0;
00682       box.bottom = Rect->Bottom - Rect->Top;
00683 
00684       // does the buffer have sufficient dimensions?
00685       assert (box.right  <= geBitmap_Width (font->buffer)); 
00686       assert (box.bottom <= geBitmap_Height(font->buffer)); 
00687 
00688       artRect.Left   = box.left;
00689       artRect.Right  = box.right;
00690       artRect.Top    = box.top;
00691       artRect.Bottom = box.bottom;
00692 
00693       success = geFont_DrawTextToBitmap(font, textString, &artRect, Color,
00694                                           flags, NULL, font->buffer);
00695 
00696       if (clipRect)
00697       {
00698          if ( CalculateClipping( &artRect, &resultX, &resultY, 
00699                      Rect->Left, 
00700                      Rect->Top,
00701                      *clipRect, GE_CLIP_CORNER)
00702             )
00703          {
00704             success = geEngine_DrawBitmap(font->Engine, font->buffer,
00705                                                 &artRect, resultX, resultY);
00706          }
00707       }
00708       else
00709       {
00710          success = geEngine_DrawBitmap(font->Engine, font->buffer,
00711                                                 &artRect, Rect->Left, Rect->Top);
00712       }
00713    }
00714 
00715    return lineEndIndex;
00716 }
00717 
00718 
00719 //*******************************************************************************
00720 GENESISAPI void GENESISCC geFont_DestroyBitmapBuffer( geFont *font ) 
00721 {
00722    geBoolean success;
00723    assert(font);
00724    if (font->buffer)
00725    {
00726       success = geEngine_RemoveBitmap((geEngine *)font->Engine, font->buffer);
00727       assert(success);
00728 
00729       geBitmap_Destroy(&font->buffer);
00730    }
00731 
00732 }
00733 
00734 //*******************************************************************************
00735 GENESISAPI geBoolean GENESISCC geFont_AddBitmapBuffer(
00736                                   geFont *font, const uint32 width, const uint32 height) 
00737 {
00738    geBoolean success;
00739    geBitmap_Palette * palette;
00740    int i;
00741 
00742    assert(font);
00743 
00744    assert(width  < 1000);  // just checking for absurd values that indicate 
00745    assert(height < 1000);  // an un-initialized state.
00746 
00747    if (font->buffer)
00748       geFont_DestroyBitmapBuffer( font );
00749 
00750    font->buffer = geBitmap_Create(width, height, 1, GE_PIXELFORMAT_8BIT); 
00751    assert(font->buffer);
00752 
00753    // and a pallette for it.
00754    palette = geBitmap_Palette_Create(GE_PIXELFORMAT_32BIT_XRGB, 256);
00755    assert(palette);
00756 
00757    for (i = 0; i < 256; i++)
00758    {
00759       success = geBitmap_Palette_SetEntryColor(palette, i, i, i, i, i);
00760       assert(success);
00761 
00762    }
00763 
00764    success = geBitmap_SetPalette(font->buffer, palette);
00765    assert(success);
00766 
00767         success = geBitmap_SetColorKey(font->buffer, TRUE, 0 ,FALSE );
00768 
00769    success = geEngine_AddBitmap((geEngine *)font->Engine, font->buffer);
00770    assert(success);
00771 
00772    return GE_TRUE;
00773 
00774 }
00775 
00776 //*******************************************************************************
00777 GENESISAPI geBoolean GENESISCC geFont_DrawTextToBitmap(geFont *font, const char *textString, 
00778                                            const GE_Rect *Rect, const GE_RGBA *Color, 
00779                                            uint32 flags, const GE_Rect *clipRect,
00780                                            geBitmap *targetBitmap)
00781 {
00782 
00783    int32 x,y,i;
00784    int32 tempX;//, tempY;
00785    int32 lineLen;
00786 
00787    uint32 colorArray[256];
00788    geFloat  fcolorX, fcolorR, fcolorG, fcolorB;
00789 
00790    int32 stringLen;
00791    int32 currentCharIndex;
00792    int32 lineEndIndex=0;
00793    geFontCharacterRecord *charRec;
00794 
00795    geBoolean success;
00796    geBoolean longEnough, endOfText;
00797 
00798    GE_Rect artRect;
00799    RECT box;
00800    int32 resultX, resultY;
00801 
00802    geFontBitmap *lastBitmap;
00803    geBitmap_Palette * palette;
00804 
00805 
00806    // unimplemented flags which we don't want you to use yet.
00807    assert(!(flags & GE_FONT_WRAP           ));
00808    assert(!(flags & GE_FONT_JUST_RETURN_FIT));
00809    assert(!(flags & GE_FONT_JUSTIFY_RIGHT  ));
00810    assert(!(flags & GE_FONT_JUSTIFY_CENTER ));
00811 
00812    assert(targetBitmap);
00813 
00814    lastBitmap = NULL;
00815    x = 0;
00816    y = 0;
00817    stringLen = strlen(textString);
00818    currentCharIndex = 0;
00819 
00820    if (font->bitmapList)  // if this font has character bitmaps...
00821    {
00822 
00823       while (currentCharIndex < stringLen)
00824       {
00825          // skip leading white space for this line.
00826          while (isspace(textString[currentCharIndex]) && currentCharIndex < stringLen)
00827             currentCharIndex++;
00828 
00829          // if, because of the whitespace skip, we're out of text, exit the loop.
00830          if (currentCharIndex >= stringLen)
00831             break;
00832 
00833          lineLen = 0;
00834          lineEndIndex = currentCharIndex;
00835          longEnough = FALSE;
00836          endOfText = FALSE;
00837          while (!longEnough)
00838          {
00839             charRec = &(font->characterArray[textString[lineEndIndex]]);
00840 
00841             // if the character has art...
00842             if (charRec->bitmapUsed)
00843             {
00844 
00845                if (Rect->Left + lineLen + (charRec->fullWidth) >
00846                    Rect->Right)
00847                    longEnough = TRUE;
00848                else
00849                {
00850                   lineLen = lineLen + (charRec->fullWidth);
00851                   lineEndIndex++;
00852                   if (lineEndIndex >= stringLen)
00853                   {
00854                      longEnough = TRUE;
00855                      endOfText = TRUE;
00856                   }
00857                }
00858             }
00859             else
00860             {
00861                lineEndIndex++;
00862                if (lineEndIndex >= stringLen)
00863                {
00864                   longEnough = TRUE;
00865                   endOfText = TRUE;
00866                }
00867             }
00868          }
00869 
00870          // if we're word-wrapping, back up to BEFORE the last hunk of whitespace.
00871          if (flags & GE_FONT_WORDWRAP && !endOfText)
00872          {
00873             tempX = lineEndIndex;
00874             while (tempX > currentCharIndex && !isspace(textString[tempX]))
00875                tempX--;
00876 
00877             if (isspace(textString[tempX]))
00878             {
00879                while (tempX > currentCharIndex && isspace(textString[tempX]))
00880                   tempX--;
00881 
00882                lineEndIndex = tempX;
00883             }
00884          }
00885 
00886          // aaannnddd,  DRAW!
00887          for (; currentCharIndex <= lineEndIndex && currentCharIndex < stringLen; currentCharIndex++)
00888          {
00889             charRec = &(font->characterArray[textString[currentCharIndex]]);
00890 
00891             if (charRec->bitmapUsed)
00892             {
00893 
00894                if (charRec->bitmapUsed != lastBitmap)
00895                {
00896 
00897                   lastBitmap = charRec->bitmapUsed;
00898 
00899                   palette = geBitmap_GetPalette(lastBitmap->map);
00900                   assert(palette);
00901 
00902                   for (i = 0; i < 256; i++)
00903                   {
00904 
00905                      fcolorR = Color->r * i / 255;
00906                      fcolorG = Color->g * i / 255;
00907                      fcolorB = Color->b * i / 255;
00908                      fcolorX = Color->a * i / 255;
00909 
00910                      colorArray[i] = gePixelFormat_ComposePixel(        GE_PIXELFORMAT_32BIT_XRGB, (int)fcolorR, (int)fcolorG, (int)fcolorB, (int)fcolorX);
00911                   }
00912 
00913                   success = geBitmap_Palette_SetData(   palette ,colorArray,GE_PIXELFORMAT_32BIT_XRGB, 256);
00914            
00915                   success = geBitmap_SetPalette(lastBitmap->map, palette);
00916                   assert(success);
00917 
00918                }
00919             
00920             
00921                if (clipRect)
00922                {
00923                   artRect = charRec->bitmapRect;
00924 
00925                   if ( CalculateClipping( &artRect, &resultX, &resultY, 
00926                               Rect->Left + x + charRec->offsetX, 
00927                               Rect->Top + y + (font->fontSize - charRec->offsetY),
00928                               *clipRect, GE_CLIP_CORNER)
00929                      )
00930                   {
00931                      success = geBitmap_Blit(charRec->bitmapUsed->map, artRect.Left, artRect.Top,
00932                                                                                    targetBitmap, resultX, resultY,
00933                                                                                    artRect.Right - artRect.Left, artRect.Bottom - artRect.Top );
00934                   }
00935 
00936                }
00937                else
00938                {
00939                   success = geBitmap_Blit(charRec->bitmapUsed->map, charRec->bitmapRect.Left, 
00940                               charRec->bitmapRect.Top, targetBitmap, 
00941                               Rect->Left + x + charRec->offsetX, Rect->Top + y + (font->fontSize - charRec->offsetY),
00942                                                                            charRec->bitmapRect.Right  - charRec->bitmapRect.Left, 
00943                               charRec->bitmapRect.Bottom - charRec->bitmapRect.Top );
00944                }
00945                x += charRec->fullWidth;
00946             }
00947             else
00948             {
00949                // we reached this point because we're trying to draw a character that
00950                // hasn't been added to the font yet using geFont_AddCharacters().
00951                assert(0);
00952             }
00953          
00954          }
00955          y += font->fontSize;
00956          x = 0;
00957       }
00958    }
00959    else // this font has no attached bitmaps, sooo, we do it another way!
00960    {
00961       box.left   = Rect->Left;
00962       box.right  = Rect->Right;
00963       box.top    = Rect->Top;
00964       box.bottom = Rect->Bottom;
00965       success = geFont_DrawUsingDIB(font, textString, box, targetBitmap, Color, flags);
00966    }
00967 
00968    return lineEndIndex;
00969 }
00970 
00971 
00972 //*******************************************************************************
00973 GENESISAPI geBoolean GENESISCC geFont_TestDraw(geFont *font, int16 x, int16 y, int16 index)
00974 {
00975    geRect Source;
00976    geFontBitmap *fontBitmap;
00977    geBoolean success;
00978 
00979    fontBitmap = font->bitmapList;
00980    for (; index > 0 && fontBitmap->next; index--)
00981       fontBitmap = fontBitmap->next;
00982 
00983    assert(fontBitmap);
00984 
00985    Source.Top    = 0;
00986    Source.Left   = 0;
00987    Source.Right  = 255;
00988    Source.Bottom = 255;
00989 
00990    success = geEngine_DrawBitmap(font->Engine, fontBitmap->map,
00991                                                                 &Source, x, y);
00992 
00993    return success;
00994 }
00995 
00996 
00997 
00998 
00999 //*******************************************************************************
01000 GENESISAPI geBoolean GENESISCC geFont_DrawUsingDIB(geFont *font, const char *textString, 
01001                                                    RECT box, geBitmap *targetBitmap,
01002                                                    const GE_RGBA *Color, uint32 flags)
01003 {
01004 
01005    geBoolean success;
01006 
01007    HDC      hdc, drawDC;
01008 
01009    geFloat  fcolorR, fcolorG, fcolorB;
01010 
01011    int32          x,y;
01012 
01013    uint8          *lpDIBBuffer, tempChar;              // DIB image buffer
01014    HBITMAP     hDIB, oldMap;                     // Handle returned from CreateDIBSection
01015    HPALETTE    hPalette;                 // Handle to palette if 8-bit mode in use
01016         HFONT oldFont, winFont;
01017         LOGPALETTE       *pLogPal;            // LOGPALETTE structure
01018         BITMAPINFO       *pbmi;               // BITMAPINFO structure
01019         BITMAPINFOHEADER *pbmih;              // Pointer to pbmi header
01020 
01021    int locX, locY;
01022 
01023    geBitmap *lock;
01024    geBitmap_Info Info;
01025    geBitmap_Info SecondaryInfo;
01026 
01027    unsigned char *destBits;
01028    int16 mapWidth;
01029 
01030 
01031    int i;
01032 
01033    int desktop_bpp, display_bpp;
01034 
01035    int targetSizeX, targetSizeY;
01036 
01037    //
01038    // Init DIB stuff
01039    //
01040 
01041    desktop_bpp = 8;
01042    display_bpp = 8;
01043 
01044    targetSizeX = geBitmap_Width (targetBitmap) + ( 4 - ( geBitmap_Width (targetBitmap) % 4 ) );
01045    targetSizeY = geBitmap_Height(targetBitmap);
01046 
01047    hDIB        = NULL;
01048    lpDIBBuffer = NULL;
01049    hPalette    = NULL;
01050 
01051    pLogPal = (LOGPALETTE *) 
01052              GE_RAM_ALLOCATE_ARRAY (char, sizeof(LOGPALETTE) + (sizeof(PALETTEENTRY) * 256));
01053 
01054    assert(pLogPal);
01055 
01056    memset(pLogPal,0, sizeof(LOGPALETTE) + (sizeof(PALETTEENTRY) * 256));
01057 
01058    pLogPal->palVersion    = 0x300;
01059    pLogPal->palNumEntries = 256;
01060 
01061    pbmi = (BITMAPINFO *) 
01062           GE_RAM_ALLOCATE_ARRAY(char,sizeof (BITMAPINFOHEADER) + (sizeof (RGBQUAD) * 256));
01063 
01064    if (pbmi == NULL)
01065    {
01066       geRam_Free(pLogPal);
01067       assert(0);
01068    }
01069  
01070    memset(pbmi, 0, sizeof (BITMAPINFOHEADER) + (sizeof (RGBQUAD) * 256));
01071 
01072    pbmih = &(pbmi->bmiHeader);
01073 
01074    pbmih->biSize          =  sizeof(BITMAPINFOHEADER);
01075    pbmih->biWidth         =  (targetSizeX);
01076    pbmih->biHeight        = -(targetSizeY);
01077    pbmih->biPlanes        =  1;
01078    pbmih->biBitCount      =  (uint16) 8;
01079    pbmih->biSizeImage     =  0;
01080    pbmih->biXPelsPerMeter =  0;
01081    pbmih->biYPelsPerMeter =  0;
01082    pbmih->biClrUsed       =  0;
01083    pbmih->biClrImportant  =  0;
01084   
01085    pbmih->biCompression = BI_RGB;
01086 
01087 
01088    // set palette entries
01089    for (i = 0; i < 256; i++)
01090    {
01091       fcolorR = Color->r * i / 255;
01092       fcolorG = Color->g * i / 255;
01093       fcolorB = Color->b * i / 255;
01094 
01095       pbmi->bmiColors[i].rgbRed   = (unsigned char) fcolorR;
01096       pbmi->bmiColors[i].rgbGreen = (unsigned char) fcolorG;
01097       pbmi->bmiColors[i].rgbBlue  = (unsigned char) fcolorB;
01098    
01099    }
01100 
01101    hPalette = CreatePalette(pLogPal);
01102 
01103    //
01104    // Allocate the DIB section ("back buffer")
01105    //
01106 
01107    hdc = GetDC(GetDesktopWindow());
01108 
01109    hDIB = CreateDIBSection(hdc,             // Device context
01110                            pbmi,            // BITMAPINFO structure
01111                            DIB_RGB_COLORS,  // Color data type
01112                 (void **) &lpDIBBuffer,     // Address of image map pointer
01113                            NULL,            // File
01114                            0);              // Bitmap file offset
01115 
01116    ReleaseDC(GetDesktopWindow(), hdc);
01117    
01118    assert(hDIB);
01119 
01120    // now we DrawText to the DIB
01121 
01122    drawDC = CreateCompatibleDC(NULL);
01123 
01124         winFont = CreateFont( -1 * font->fontSize,
01125                                             0,0,0, font->fontWeight,
01126                                             0,0,0,0,OUT_TT_ONLY_PRECIS ,0,0,0, font->fontNameString);
01127    assert(winFont);
01128 
01129    oldFont = SelectObject( drawDC, winFont); 
01130    oldMap  = SelectObject( drawDC, hDIB); 
01131 
01132         SetTextColor(drawDC, RGB(Color->r,Color->g,Color->b));
01133    SetBkColor  (drawDC, RGB(0,0,0));
01134 
01135         SetBkMode( drawDC, OPAQUE );
01136 
01137         // we are accounting for the fact that Windows GDI stuff doesn't seem to draw on the end of a rect
01138         box.bottom++;
01139         box.right++;
01140 
01141    if (flags & GE_FONT_WORDWRAP)
01142       DrawText(drawDC, textString, strlen(textString), &box, DT_WORDBREAK);
01143    else
01144       DrawText(drawDC, textString, strlen(textString), &box, 0);
01145 
01146         // undoing the for-windows hack
01147         box.bottom--;
01148         box.right--;
01149 
01150         SelectObject(drawDC,oldMap);
01151         SelectObject(drawDC,oldFont);
01152 
01153    DeleteDC(drawDC);
01154 
01155    DeleteObject(winFont);
01156 
01157 
01158    // now we copy the bits in the DIB to the targetBitmap
01159    success = geBitmap_LockForWrite(     targetBitmap, &lock,
01160                                     0,0);
01161 
01162    success = geBitmap_GetInfo(lock, &Info, &SecondaryInfo);
01163 
01164    if (!gePixelFormat_IsRaw(Info.Format))
01165    {
01166       success = geBitmap_UnLock(lock);
01167 
01168       if (gePixelFormat_IsRaw(SecondaryInfo.Format))
01169       {
01170          success = geBitmap_LockForWriteFormat( targetBitmap, &lock,0,0, SecondaryInfo.Format);
01171          assert(success);
01172          Info = SecondaryInfo;
01173       }
01174       else
01175       {
01176          success = geBitmap_SetFormat(targetBitmap, GE_PIXELFORMAT_24BIT_RGB, GE_TRUE, 0, NULL);
01177          assert(success);
01178          success = geBitmap_SetColorKey(targetBitmap, GE_TRUE, 0, GE_FALSE);
01179          assert(success);
01180          success = geBitmap_LockForWrite(       targetBitmap, &lock,0,0);
01181          assert(success);
01182          success = geBitmap_GetInfo(lock, &Info, &SecondaryInfo);
01183          assert(success);
01184       }
01185 
01186    }
01187 
01188    mapWidth  = Info.Stride;
01189 
01190    destBits = geBitmap_GetBits(lock);
01191 
01192    if (GE_PIXELFORMAT_8BIT == Info.Format)
01193    {
01194       locX = 0;
01195       locY = 0;
01196 
01197       for ( y = box.top; 
01198             y <= box.bottom; 
01199             y++)
01200       {
01201          for (x = box.left;
01202               x <= box.right; 
01203               x++)
01204          {
01205             tempChar = lpDIBBuffer[y * targetSizeX + x];
01206             destBits[(y+locY)*mapWidth + (x+locX)] = tempChar;
01207          }
01208       }
01209    }
01210         else
01211         {
01212         uint8 * bptr;
01213 
01214                 // oh well, do our best
01215                 // bitmaps must have had a good reason to not give us the format we preferred,
01216 
01217                 for(y=box.top; y <= box.bottom; y++)
01218                 {
01219                         for(x=box.left; x <= box.right; x++)
01220                         {
01221                         uint32 R,G,B;
01222 
01223                                 // put a color in any format
01224             tempChar = lpDIBBuffer[y * targetSizeX + x];
01225 
01226             R = (uint32)(Color->r * tempChar / 255);
01227             G = (uint32)(Color->g * tempChar / 255);
01228             B = (uint32)(Color->b * tempChar / 255);
01229 
01230                                 // we use alpha of 255 for opaque
01231 
01232                         bptr = destBits + (Info.Stride * y * gePixelFormat_BytesPerPel(Info.Format)) 
01233                               + gePixelFormat_BytesPerPel(Info.Format) * x;
01234                                 gePixelFormat_PutColor(Info.Format,&bptr,R,G,B,255);
01235                         }
01236 
01237                 }
01238         }
01239 
01240    success = geBitmap_UnLock(lock);
01241 
01242 
01243    // finally, clean up!
01244    DeleteObject(hDIB);
01245    DeleteObject(hPalette);
01246 
01247 
01248    geRam_Free(pbmi);
01249    geRam_Free(pLogPal);
01250 
01251    return TRUE;
01252 }
01253 
01254 
01255 //*******************************************************************************
01256 GENESISAPI int32 GENESISCC geFont_GetStringPixelWidth (geFont *font, const char *textString)
01257 {
01258 
01259    if (font->bitmapList)
01260    {
01261       int32 i, width;
01262 
01263       width = 0;
01264       for (i = 0; i < (int32)strlen(textString); i++)
01265       {
01266          assert (font->characterArray[textString[i]].bitmapUsed);
01267 
01268          width += font->characterArray[textString[i]].fullWidth;
01269       }
01270 
01271       return width;
01272    }
01273    else
01274    {
01275       SIZE sizeInfo;
01276       HDC hdc;
01277            HFONT oldFont, winFont;
01278 
01279       hdc = GetDC(GetDesktopWindow());
01280         winFont = CreateFont( -1 * font->fontSize,
01281                                             0,0,0, font->fontWeight,
01282                                             0,0,0,0,OUT_TT_ONLY_PRECIS ,0,0,0, font->fontNameString);
01283       assert(winFont);
01284 
01285       oldFont = SelectObject( hdc, winFont); 
01286 
01287       GetTextExtentPoint32(  hdc, textString, strlen(textString), &sizeInfo);
01288 
01289         SelectObject(hdc,oldFont);
01290       DeleteObject(winFont);
01291 
01292       ReleaseDC(GetDesktopWindow(), hdc);
01293 
01294       return sizeInfo.cx;
01295    }
01296 }
01297 
01298 //*******************************************************************************
01299 GENESISAPI int32 GENESISCC geFont_GetStringPixelHeight(geFont *font, const char *textString)
01300 {
01301 
01302       SIZE sizeInfo;
01303       HDC hdc;
01304            HFONT oldFont, winFont;
01305 
01306       hdc = GetDC(GetDesktopWindow());
01307         winFont = CreateFont( -1 * font->fontSize,
01308                                             0,0,0, font->fontWeight,
01309                                             0,0,0,0,OUT_TT_ONLY_PRECIS ,0,0,0, font->fontNameString);
01310       assert(winFont);
01311 
01312       oldFont = SelectObject( hdc, winFont); 
01313 
01314       GetTextExtentPoint32(  hdc, textString, strlen(textString), &sizeInfo);
01315 
01316         SelectObject(hdc,oldFont);
01317       DeleteObject(winFont);
01318 
01319       ReleaseDC(GetDesktopWindow(), hdc);
01320 
01321       return sizeInfo.cy;
01322 }
01323 
01324 //*******************************************************************************
01325 GENESISAPI geBitmap* GENESISCC geFont_GetBuffer(geFont *font)
01326 {
01327 
01328    return font->buffer;
01329 }
01330 
01331 
01332 //*******************************************************************************
01333 GENESISAPI geBoolean GENESISCC geFont_GetCharMap(geFont *font, uint8 character, GE_Rect *Rect, 
01334                                                                                                  geBitmap **targetBitmap, int32 *fullWidth, int32 *fullHeight, 
01335                                                                                                  int32 *offsetX, int32 *offsetY)
01336 {
01337 
01338 
01339         assert(font);
01340         assert(font->characterArray[character].bitmapUsed);
01341 
01342         *targetBitmap = font->characterArray[character].bitmapUsed->map;
01343 
01344         *Rect = font->characterArray[character].bitmapRect;
01345 
01346         *fullWidth = font->characterArray[character].fullWidth;
01347         *fullHeight = font->fontSize;
01348         *offsetX = font->characterArray[character].offsetX;
01349         *offsetY = font->characterArray[character].offsetY;
01350 
01351         return GE_TRUE;
01352 }
01353 
01354 
01355 //*******************************************************************************
01356 GENESISAPI void GENESISCC geFont_EnableAntialiasing(geFont *font, const geBoolean anti)
01357 {
01358    font->antialiased = anti;
01359 }
01360 
01361 //*******************************************************************************
01362 GENESISAPI geBoolean GENESISCC geFont_IsAntialiased(geFont *font)
01363 {
01364    return font->antialiased;
01365 }
01366 

Generated on Tue Sep 30 12:35:43 2003 for GTestAndEngine by doxygen 1.3.2