[Previous]
[Contents]
[Next]

console_font()

change the font for a console

Synopsis:

#include <sys/console.h>
int console_font( struct _console_ctrl *cc,
                  int console,
                  int font );

Description:

The console_font() function changes a console to the specified font, where font is an integer with a value of [0...N-1]. The range (that is, N) can be determined by calling console_info(), and looking at the max_fonts field of the _console_info structure.

If font is -1, the font is the current font defined on console. Since the previous font value is returned, this allows you to query a font without changing it if you don't know what it is set to.

Returns:

Upon successful completion, the console_font() function returns the previous font value, otherwise -1 is returned, and errno is set.

Errors:

EACCES
You don't have write permission.
EINVAL
One of the arguments is invalid.

Examples:

#include <sys/console.h>
#include <fcntl.h>
#include <stdio.h>

int main( void )
  {
    struct _console_ctrl *cc;
    int font;

    /*
     * Open up a channel to the console driver
     * associated with standard input
     */
    cc = console_open( fileno(stdin), O_RDWR );

    if( cc ) {
      /*
       * Query current font of stdin's console
       */
      font = console_font( cc, 0, -1 );
      printf("Current font is %d\n", font );

      /*
       * Change to font #1
       */
      font = console_font( cc, 0, 1 );
      if( font == -1 )
        printf("Unable to set font %d\n", font );
      else
        printf("Font now 1, Previous font was %d\n", font );
      }

    /*
     * Close the channel
     */
    console_close( cc );
    return (EXIT_SUCCESS);
  }

Classification:

QNX

Safety:
Interrupt handler No
Signal handler Yes, but modifies errno
Thread Yes

See also:

console_active(), console_arm(), console_close(), console_ctrl(), console_info(), console_open(), console_protocol(), console_read(), console_size(), console_state(), console_write(), errno


[Previous]
[Contents]
[Next]