SilverScreen Solid Modeler

font_get

font_get

Previous topic Next topic  

font_get

Previous topic Next topic JavaScript is required for the print function  

 

SilverScreenAPI

 

int font_get ( SS_FONT_INFO *fi )

 

SS_FONT_INFO *fi;   // A pointer to an SS_FONT_INFO structure

 

 




Synopsis

#include "silver.h"

 

The font_get function retrieves information about the font used for the screen text functions, message area functions, and the internal editor.

 

 

Parameters

fi is a pointer to an SS_FONT_INFO structure that will be filled with the properties of the current screen text font.

 

 

Return Value

font_get returns TRUE if successful and FALSE if there was a problem retrieving the font information.

 

 

See Also

font_set, screen text functions

 

 

Example

The following example will save the current font, set it to a Courier font, fill the graphics screen with strings, then wait for the user to press ESCAPE. Afterward the original font will be restored.

SilverC Code

 

#include "silver.h"

#include "string.h"

 

#include <stdio.h>

#include <stdlib.h>

 

void main(void)

  {

  SS_FONTINFO fi, was;

  int         i, pos;

 

 

  font_get(&was); // Retrieve the screen text font information

 

  memset(&fi, 0, sizeof(SS_FONTINFO));

 

  strcpy(fi.name, "Courier New");

  fi.weight = 400;  // Normal

  fi.height = 12;   // 12 pts

  fi.is_italic = FALSE;

 

  font_set(&fi); Set the screen text font information

 

  cv_set(CV_REDRAW_LOCAL, 0);

  cv_set(CV_REFRESH, 0);

 

  for (i = 1; i < schar_height; i++)

     {

     pos = wcolor(fi.name,

                  i,

                  1,

                  color_white,

                  color_blue);

 

     pos = wcolor("   ",

                  i,

                  pos,

                  color_white,

                  color_blue);

 

     wcolorc("ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789",

             i,

             pos,

             color_white,

             color_blue);

     }

 

  wcolorc("Press ESCAPE to continue...", schar_height, 1,

           color_white, color_light_blue);

 

  while ( inchar() != ESCAPE )

     ;

 

  cv_set(CV_REDRAW_LOCAL, 1);

  cv_set(CV_REFRESH, 1);

 

 

  font_set(&was);   // Restore the original screen text font

  }