DEATHSHADOW'S
MADNESS
Madness and You, Perfect together!

  1. Top of Page
  2. Main Menu
  3. Page Content
  4. Page Extras
  5. Bottom of Page

Function tglKernedFont.stringSize

Declaration


  function stringSize(st:string):glFloat;

Purpose

Calculate how wide the string passed will be at the current font settings. Useful for positioning tricks like centering text, or telling if the next 'word' will wordwrap.

Parameters

st : string

The string to calculate the width of.

Returns

glFloat - the width in OpenGL coordinates.

Code Example


  st:='This font will render centered on the current X';
  stWidth:=demoFont.stringSize(st);
  glPushMatrix;
  glTranslate3f(-stWidth/2,0,0);
  demoFont.writeString(st);
  glPopMatrix;
  1. Top of Page
  2. Main Menu
  3. Page Content
  4. Page Extras
  5. Bottom of Page