root/arch/m68k/console/fonts.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. findsoftfont
  2. getdefaultfont

   1 
   2 /*
   3  * arch/m68k/console/fonts.c -- `Soft' font definitions
   4  *
   5  *    Created 1995 by Geert Uytterhoeven
   6  *
   7  * This file is subject to the terms and conditions of the GNU General Public
   8  * License.  See the file README.legal in the main directory of this archive
   9  * for more details.
  10  */
  11 
  12 
  13 #include <linux/types.h>
  14 #include <linux/string.h>
  15 #include <asm/font.h>
  16 
  17 
  18    /*
  19     *    External Font Definitions
  20     */
  21 
  22 /* VGA8x8 */
  23 extern char fontname_8x8[];
  24 extern int fontwidth_8x8, fontheight_8x8;
  25 extern u_char fontdata_8x8[];
  26 
  27 /* VGA8x16 */
  28 extern char fontname_8x16[];
  29 extern int fontwidth_8x16, fontheight_8x16;
  30 extern u_char fontdata_8x16[];
  31 
  32 
  33    /*
  34     *    Font Descriptor Array
  35     */
  36 
  37 struct softfontdesc {
  38    char *name;
  39    int *width;
  40    int *height;
  41    u_char *data;
  42 };
  43 
  44 static struct softfontdesc softfonts[] = {
  45    { fontname_8x8, &fontwidth_8x8, &fontheight_8x8, fontdata_8x8 },
  46    { fontname_8x16, &fontwidth_8x16, &fontheight_8x16, fontdata_8x16 }
  47 };
  48 
  49 static u_long numsoftfonts = sizeof(softfonts)/sizeof(*softfonts);
  50 
  51 
  52    /*
  53     *    Find a font with a specific name
  54     */
  55 
  56 int findsoftfont(char *name, int *width, int *height, u_char *data[])
     /* [previous][next][first][last][top][bottom][index][help] */
  57 {
  58    int i;
  59 
  60    for (i = 0; i < numsoftfonts; i++)
  61       if (!strcmp(softfonts[i].name, name)) {
  62          if (width)
  63             *width = *softfonts[i].width;
  64          if (height)
  65             *height = *softfonts[i].height;
  66          if (data)
  67             *data = softfonts[i].data;
  68                         return(1);
  69       }
  70         return(0);
  71 }
  72 
  73 
  74    /*
  75     *    Get the default font for a specific screen size
  76     */
  77 
  78 void getdefaultfont(int xres, int yres, char *name[], int *width, int *height,
     /* [previous][next][first][last][top][bottom][index][help] */
  79                     u_char *data[])
  80 {
  81    if (yres < 400) {
  82       if (name)
  83            *name = fontname_8x8;
  84         if (width)
  85            *width = fontwidth_8x8;
  86         if (height)
  87            *height = fontheight_8x8;
  88         if (data)
  89          *data = fontdata_8x8;
  90         } else {
  91       if (name)
  92            *name = fontname_8x16;
  93         if (width)
  94            *width = fontwidth_8x16;
  95         if (height)
  96            *height = fontheight_8x16;
  97         if (data)
  98          *data = fontdata_8x16;
  99         }
 100 }

/* [previous][next][first][last][top][bottom][index][help] */