loader: remove BORDER_PIXELS

BORDER_PIXELS is left over from picking up the source from illumos
port. Since FreeBSD VT does not use border in terminal size
calculation, there is no reason why should loader use it.

MFC after: 1 week
This commit is contained in:
Toomas Soome 2021-02-08 20:49:09 +02:00
parent 504ebd612e
commit 96bef2053a
4 changed files with 11 additions and 19 deletions

View File

@ -1888,25 +1888,18 @@ set_font(teken_unit_t *rows, teken_unit_t *cols, teken_unit_t h, teken_unit_t w)
}
if (font != NULL) {
*rows = (height - BORDER_PIXELS) / font->vfbd_height;
*cols = (width - BORDER_PIXELS) / font->vfbd_width;
*rows = height / font->vfbd_height;
*cols = width / font->vfbd_width;
return (font);
}
/*
* Find best font for these dimensions, or use default
*
* A 1 pixel border is the absolute minimum we could have
* as a border around the text window (BORDER_PIXELS = 2),
* however a slightly larger border not only looks better
* but for the fonts currently statically built into the
* emulator causes much better font selection for the
* normal range of screen resolutions.
*/
STAILQ_FOREACH(fl, &fonts, font_next) {
font = fl->font_data;
if ((((*rows * font->vfbd_height) + BORDER_PIXELS) <= height) &&
(((*cols * font->vfbd_width) + BORDER_PIXELS) <= width)) {
if ((*rows * font->vfbd_height <= height) &&
(*cols * font->vfbd_width <= width)) {
if (font->vfbd_font == NULL ||
fl->font_flags == FONT_RELOAD) {
if (fl->font_load != NULL &&
@ -1916,8 +1909,8 @@ set_font(teken_unit_t *rows, teken_unit_t *cols, teken_unit_t h, teken_unit_t w)
if (font == NULL)
continue;
}
*rows = (height - BORDER_PIXELS) / font->vfbd_height;
*cols = (width - BORDER_PIXELS) / font->vfbd_width;
*rows = height / font->vfbd_height;
*cols = width / font->vfbd_width;
break;
}
font = NULL;
@ -1936,8 +1929,8 @@ set_font(teken_unit_t *rows, teken_unit_t *cols, teken_unit_t h, teken_unit_t w)
if (font == NULL)
font = &DEFAULT_FONT_DATA;
*rows = (height - BORDER_PIXELS) / font->vfbd_height;
*cols = (width - BORDER_PIXELS) / font->vfbd_width;
*rows = height / font->vfbd_height;
*cols = width / font->vfbd_width;
}
return (font);

View File

@ -908,8 +908,8 @@ cons_update_mode(bool use_gfx_mode)
} else {
/* Trigger loading of 8x16 font. */
setup_font(&gfx_state,
16 * gfx_state.tg_fb.fb_height + BORDER_PIXELS,
8 * gfx_state.tg_fb.fb_width + BORDER_PIXELS);
16 * gfx_state.tg_fb.fb_height,
8 * gfx_state.tg_fb.fb_width);
gfx_state.tg_functions = &tf;
/* ensure the following are not set for text mode */
unsetenv("screen.height");

View File

@ -308,7 +308,7 @@ local function drawbrand()
if core.isFramebufferConsole() and
loader.term_putimage ~= nil and
branddef.image ~= nil then
if loader.term_putimage(branddef.image, 0, 0, 0, 7, 0)
if loader.term_putimage(branddef.image, 1, 1, 0, 7, 0)
then
return true
end

View File

@ -107,7 +107,6 @@ struct fontlist {
STAILQ_ENTRY(fontlist) font_next;
};
#define BORDER_PIXELS 10 /* space from screen border */
typedef STAILQ_HEAD(font_list, fontlist) font_list_t;
#define FONT_HEADER_MAGIC "VFNT0002"