📄 ap_fonts.c
字号:
/* * linux/drivers/video/fonts.c -- `Soft' font definitions * * Created 1995 by Geert Uytterhoeven * Rewritten 1998 by Martin Mares <mj@ucw.cz> * * 2001 - Documented with DocBook * - Brad Douglas <brad@neruo.com> * * 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 * for more details. *///#include <linux/types.h>#include <linux/string.h>//#include <string.h>#include "ap_font.h"//#define NO_FONTS/*static*/ const struct ap_font_desc *ap_fonts[] = { &ap_font_gb2312_16x16, //&ap_font_sun_8x16,};#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))#define num_fonts ARRAY_SIZE(ap_fonts)//#ifdef NO_FONTS//#error No fonts configured.//#endif/** * find_font - find a font * @name: string name of a font * * Find a specified font with string name @name. * * Returns %NULL if no font found, or a pointer to the * specified font. * :*///const struct ap_font_desc *ap_find_font(const char *name);const struct ap_font_desc *ap_find_font(const char *name)/*void ap_find_font(void)*/{/**/ unsigned int i;// unsigned char *name;
for (i = 0; i < num_fonts; i++) if (!strcmp(ap_fonts[i]->name, name)) return ap_fonts[i]; return NULL;}/** * get_default_font - get default font * @xres: screen size of X * @yres: screen size of Y * * Get the default font for a specified screen size. * Dimensions are in pixels. * * Returns %NULL if no font is found, or a pointer to the * chosen font. * */const struct ap_font_desc *ap_get_default_font(int xres, int yres){ int i, c, cc; const struct ap_font_desc *f, *g; g = NULL; cc = -10000; for(i=0; i<num_fonts; i++) { f = ap_fonts[i]; c = f->pref;/*#if defined(__mc68000__) || defined(CONFIG_APUS)#ifdef CONFIG_FONT_PEARL_8x8 if (MACH_IS_AMIGA && f->idx == PEARL8x8_IDX) c = 100;#endif#ifdef CONFIG_FONT_6x11 if (MACH_IS_MAC && xres < 640 && f->idx == VGA6x11_IDX) c = 100;#endif#endif*/ if ((yres < 400) == (f->high <= 8)) c += 1000; if (c > cc) { cc = c; g = f; } } return g;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -