Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54937
b: refs/heads/master
c: 2d2699d
h: refs/heads/master
i:
  54935: 52378e8
v: v3
  • Loading branch information
Antonino A. Daplas authored and Linus Torvalds committed May 8, 2007
1 parent d5086e4 commit 10c6679
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bf26ad72a60c0009a99179b449a43daa6bf4b4f6
refs/heads/master: 2d2699d984924890f6dac8cf51c3b6311f56816c
17 changes: 14 additions & 3 deletions trunk/drivers/video/console/fbcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,9 @@ static const char *fbcon_startup(void)
if (!p->fontdata) {
if (!fontname[0] || !(font = find_font(fontname)))
font = get_default_font(info->var.xres,
info->var.yres);
info->var.yres,
info->pixmap.blit_x,
info->pixmap.blit_y);
vc->vc_font.width = font->width;
vc->vc_font.height = font->height;
vc->vc_font.data = (void *)(p->fontdata = font->data);
Expand Down Expand Up @@ -1108,7 +1110,9 @@ static void fbcon_init(struct vc_data *vc, int init)

if (!fontname[0] || !(font = find_font(fontname)))
font = get_default_font(info->var.xres,
info->var.yres);
info->var.yres,
info->pixmap.blit_x,
info->pixmap.blit_y);
vc->vc_font.width = font->width;
vc->vc_font.height = font->height;
vc->vc_font.data = (void *)(p->fontdata = font->data);
Expand Down Expand Up @@ -2495,6 +2499,7 @@ static int fbcon_copy_font(struct vc_data *vc, int con)

static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigned flags)
{
struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
unsigned charcount = font->charcount;
int w = font->width;
int h = font->height;
Expand All @@ -2508,6 +2513,11 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
if (charcount != 256 && charcount != 512)
return -EINVAL;

/* Make sure drawing engine can handle the font */
if (!(info->pixmap.blit_x & (1 << (font->width - 1))) ||
!(info->pixmap.blit_y & (1 << (font->height - 1))))
return -EINVAL;

size = h * pitch * charcount;

new_data = kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, GFP_USER);
Expand Down Expand Up @@ -2552,7 +2562,8 @@ static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, cha
const struct font_desc *f;

if (!name)
f = get_default_font(info->var.xres, info->var.yres);
f = get_default_font(info->var.xres, info->var.yres,
info->pixmap.blit_x, info->pixmap.blit_y);
else if (!(f = find_font(name)))
return -ENOENT;

Expand Down
10 changes: 9 additions & 1 deletion trunk/drivers/video/console/fonts.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ const struct font_desc *find_font(const char *name)
* get_default_font - get default font
* @xres: screen size of X
* @yres: screen size of Y
* @font_w: bit array of supported widths (1 - 32)
* @font_h: bit array of supported heights (1 - 32)
*
* Get the default font for a specified screen size.
* Dimensions are in pixels.
Expand All @@ -107,7 +109,8 @@ const struct font_desc *find_font(const char *name)
*
*/

const struct font_desc *get_default_font(int xres, int yres)
const struct font_desc *get_default_font(int xres, int yres, u32 font_w,
u32 font_h)
{
int i, c, cc;
const struct font_desc *f, *g;
Expand All @@ -129,6 +132,11 @@ const struct font_desc *get_default_font(int xres, int yres)
#endif
if ((yres < 400) == (f->height <= 8))
c += 1000;

if (!(font_w & (1 << (f->width - 1))) ||
!(font_w & (1 << (f->height - 1))))
c += 1000;

if (c > cc) {
cc = c;
g = f;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/video/console/sticore.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
return NULL;
fbfont = find_font(fbfont_name);
if (!fbfont)
fbfont = get_default_font(1024,768);
fbfont = get_default_font(1024,768, ~(u32)0, ~(u32)0);
if (!fbfont)
return NULL;

Expand Down
3 changes: 2 additions & 1 deletion trunk/include/linux/font.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ extern const struct font_desc *find_font(const char *name);

/* Get the default font for a specific screen size */

extern const struct font_desc *get_default_font(int xres, int yres);
extern const struct font_desc *get_default_font(int xres, int yres,
u32 font_w, u32 font_h);

/* Max. length for the name of a predefined font */
#define MAX_FONT_NAME 32
Expand Down

0 comments on commit 10c6679

Please sign in to comment.