OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [or32/] [console/] [fonts.c] - Diff between revs 1765 and 1782

Only display areas with differences | Details | Blame | View Log

Rev 1765 Rev 1782
 
 
/*
/*
 * arch/or32/console/fonts.c -- `Soft' font definitions
 * arch/or32/console/fonts.c -- `Soft' font definitions
 *
 *
 *    Created 1995 by Geert Uytterhoeven
 *    Created 1995 by Geert Uytterhoeven
 *
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file COPYING in the main directory of this archive
 * License.  See the file COPYING in the main directory of this archive
 * for more details.
 * for more details.
 */
 */
 
 
 
 
#include <linux/types.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/string.h>
#include <asm/font.h>
#include <asm/font.h>
 
 
 
 
   /*
   /*
    *    External Font Definitions
    *    External Font Definitions
    */
    */
 
 
/* VGA8x8 */
/* VGA8x8 */
extern char fontname_8x8[];
extern char fontname_8x8[];
extern int fontwidth_8x8, fontheight_8x8;
extern int fontwidth_8x8, fontheight_8x8;
extern u_char fontdata_8x8[];
extern u_char fontdata_8x8[];
 
 
/* VGA8x16 */
/* VGA8x16 */
extern char fontname_8x16[];
extern char fontname_8x16[];
extern int fontwidth_8x16, fontheight_8x16;
extern int fontwidth_8x16, fontheight_8x16;
extern u_char fontdata_8x16[];
extern u_char fontdata_8x16[];
 
 
/* PEARL8x8 */
/* PEARL8x8 */
extern char fontname_pearl8x8[];
extern char fontname_pearl8x8[];
extern int fontwidth_pearl8x8, fontheight_pearl8x8;
extern int fontwidth_pearl8x8, fontheight_pearl8x8;
extern u_char fontdata_pearl8x8[];
extern u_char fontdata_pearl8x8[];
 
 
/* MINI4x6 */
/* MINI4x6 */
extern char fontname_mini4x6[];
extern char fontname_mini4x6[];
extern int fontwidth_mini4x6, fontheight_mini4x6;
extern int fontwidth_mini4x6, fontheight_mini4x6;
extern u_char fontdata_mini4x6[];
extern u_char fontdata_mini4x6[];
 
 
 
 
   /*
   /*
    *    Font Descriptor Array
    *    Font Descriptor Array
    */
    */
 
 
struct softfontdesc {
struct softfontdesc {
   char *name;
   char *name;
   int *width;
   int *width;
   int *height;
   int *height;
   u_char *data;
   u_char *data;
};
};
 
 
#define VGA8x8_IDX      0
#define VGA8x8_IDX      0
#define VGA8x16_IDX     1
#define VGA8x16_IDX     1
#define PEARL8x8_IDX    2
#define PEARL8x8_IDX    2
#define MINI4x6_IDX     3
#define MINI4x6_IDX     3
 
 
static struct softfontdesc softfonts[] = {
static struct softfontdesc softfonts[] = {
   { fontname_8x8, &fontwidth_8x8, &fontheight_8x8, fontdata_8x8 },
   { fontname_8x8, &fontwidth_8x8, &fontheight_8x8, fontdata_8x8 },
   { fontname_8x16, &fontwidth_8x16, &fontheight_8x16, fontdata_8x16 },
   { fontname_8x16, &fontwidth_8x16, &fontheight_8x16, fontdata_8x16 },
   { fontname_pearl8x8, &fontwidth_pearl8x8, &fontheight_pearl8x8,
   { fontname_pearl8x8, &fontwidth_pearl8x8, &fontheight_pearl8x8,
     fontdata_pearl8x8 },
     fontdata_pearl8x8 },
   { fontname_mini4x6, &fontwidth_mini4x6, &fontheight_mini4x6,
   { fontname_mini4x6, &fontwidth_mini4x6, &fontheight_mini4x6,
     fontdata_mini4x6 },
     fontdata_mini4x6 },
};
};
 
 
static u_long numsoftfonts = sizeof(softfonts)/sizeof(*softfonts);
static u_long numsoftfonts = sizeof(softfonts)/sizeof(*softfonts);
 
 
 
 
   /*
   /*
    *    Find a font with a specific name
    *    Find a font with a specific name
    */
    */
 
 
int findsoftfont(char *name, int *width, int *height, u_char *data[])
int findsoftfont(char *name, int *width, int *height, u_char *data[])
{
{
   int i;
   int i;
 
 
   for (i = 0; i < numsoftfonts; i++)
   for (i = 0; i < numsoftfonts; i++)
      if (!strcmp(softfonts[i].name, name)) {
      if (!strcmp(softfonts[i].name, name)) {
         if (width)
         if (width)
            *width = *softfonts[i].width;
            *width = *softfonts[i].width;
         if (height)
         if (height)
            *height = *softfonts[i].height;
            *height = *softfonts[i].height;
         if (data)
         if (data)
            *data = softfonts[i].data;
            *data = softfonts[i].data;
                        return(1);
                        return(1);
      }
      }
        return(0);
        return(0);
}
}
 
 
 
 
   /*
   /*
    *    Get the default font for a specific screen size
    *    Get the default font for a specific screen size
    */
    */
 
 
void getdefaultfont(int xres, int yres, char *name[], int *width, int *height,
void getdefaultfont(int xres, int yres, char *name[], int *width, int *height,
                    u_char *data[])
                    u_char *data[])
{
{
    int i;
    int i;
 
 
    i = MINI4x6_IDX;
    i = MINI4x6_IDX;
 
 
    if (name)
    if (name)
        *name = softfonts[i].name;
        *name = softfonts[i].name;
    if (width)
    if (width)
        *width = *softfonts[i].width;
        *width = *softfonts[i].width;
    if (height)
    if (height)
        *height = *softfonts[i].height;
        *height = *softfonts[i].height;
    if (data)
    if (data)
        *data = softfonts[i].data;
        *data = softfonts[i].data;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.