~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/drivers/video/fonts.c

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * linux/drivers/video/fonts.c -- `Soft' font definitions
  3  *
  4  *    Created 1995 by Geert Uytterhoeven
  5  *    Rewritten 1998 by Martin Mares <mj@ucw.cz>
  6  *
  7  * This file is subject to the terms and conditions of the GNU General Public
  8  * License.  See the file COPYING in the main directory of this archive
  9  * for more details.
 10  */
 11 
 12 
 13 #include <linux/config.h>
 14 #include <linux/types.h>
 15 #include <linux/string.h>
 16 #if defined(__mc68000__) || defined(CONFIG_APUS)
 17 #include <asm/setup.h>
 18 #endif
 19 #include <video/font.h>
 20 
 21 #define NO_FONTS
 22 
 23 static struct fbcon_font_desc *fbcon_fonts[] = {
 24 #ifdef CONFIG_FONT_8x8
 25 #undef NO_FONTS
 26     &font_vga_8x8,
 27 #endif
 28 #ifdef CONFIG_FONT_8x16
 29 #undef NO_FONTS
 30     &font_vga_8x16,
 31 #endif
 32 #ifdef CONFIG_FONT_6x11
 33 #if defined(CONFIG_FBCON_MAC) || defined(CONFIG_FB_SBUS)
 34 #undef NO_FONTS
 35 #endif
 36     &font_vga_6x11,
 37 #endif
 38 #ifdef CONFIG_FONT_SUN8x16
 39 #undef NO_FONTS
 40     &font_sun_8x16,
 41 #endif
 42 #ifdef CONFIG_FONT_SUN12x22
 43 #if defined(CONFIG_FB_SBUS) || defined(CONFIG_FBCON_CFB8) || defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || defined(CONFIG_FBCON_CFB32)
 44 #undef NO_FONTS
 45 #endif
 46     &font_sun_12x22,
 47 #endif
 48 #ifdef CONFIG_FONT_ACORN_8x8
 49 #undef NO_FONTS
 50     &font_acorn_8x8,
 51 #endif
 52 #ifdef CONFIG_FONT_PEARL_8x8
 53 #undef NO_FONTS
 54     &font_pearl_8x8,
 55 #endif
 56 };
 57 
 58 #define num_fonts (sizeof(fbcon_fonts)/sizeof(*fbcon_fonts))
 59 
 60 #ifdef NO_FONTS
 61 #error No fonts configured.
 62 #endif
 63 
 64    /*
 65     *    Find a font with a specific name
 66     */
 67 
 68 struct fbcon_font_desc *fbcon_find_font(char *name)
 69 {
 70    unsigned int i;
 71 
 72    for (i = 0; i < num_fonts; i++)
 73       if (!strcmp(fbcon_fonts[i]->name, name))
 74           return fbcon_fonts[i];
 75    return NULL;
 76 }
 77 
 78 
 79    /*
 80     *    Get the default font for a specific screen size
 81     */
 82 
 83 struct fbcon_font_desc *fbcon_get_default_font(int xres, int yres)
 84 {
 85     int i, c, cc;
 86     struct fbcon_font_desc *f, *g;
 87 
 88     g = NULL;
 89     cc = -10000;
 90     for(i=0; i<num_fonts; i++) {
 91         f = fbcon_fonts[i];
 92         c = f->pref;
 93 #if defined(__mc68000__) || defined(CONFIG_APUS)
 94 #ifdef CONFIG_FONT_PEARL_8x8
 95         if (MACH_IS_AMIGA && f->idx == PEARL8x8_IDX)
 96             c = 100;
 97 #endif
 98 #ifdef CONFIG_FONT_6x11
 99         if (MACH_IS_MAC && xres < 640 && f->idx == VGA6x11_IDX)
100             c = 100;
101 #endif
102 #endif
103         if ((yres < 400) == (f->height <= 8))
104             c += 1000;
105         if (c > cc) {
106             cc = c;
107             g = f;
108         }
109     }
110     return g;
111 }
112 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.