summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMichael Brown2015-10-14 21:42:42 +0200
committerMichael Brown2015-10-14 23:16:40 +0200
commitbc69777a4044c09cfed65d84f11988448b2db277 (patch)
treeda8e8429415473fe7e817e2af93deb9f5b05d8c9 /src/core
parent[efi] Import EFI_HII_FONT_PROTOCOL definitions (diff)
downloadipxe-bc69777a4044c09cfed65d84f11988448b2db277.tar.gz
ipxe-bc69777a4044c09cfed65d84f11988448b2db277.tar.xz
ipxe-bc69777a4044c09cfed65d84f11988448b2db277.zip
[fbcon] Allow character height to be selected at runtime
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/fbcon.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/core/fbcon.c b/src/core/fbcon.c
index 6d8b0086..90139c70 100644
--- a/src/core/fbcon.c
+++ b/src/core/fbcon.c
@@ -156,7 +156,7 @@ static void fbcon_store ( struct fbcon *fbcon, struct fbcon_text_cell *cell,
*/
static void fbcon_draw ( struct fbcon *fbcon, struct fbcon_text_cell *cell,
unsigned int xpos, unsigned int ypos ) {
- struct fbcon_font_glyph glyph;
+ uint8_t glyph[fbcon->font->height];
size_t offset;
size_t pixel_len;
size_t skip_len;
@@ -167,9 +167,7 @@ static void fbcon_draw ( struct fbcon *fbcon, struct fbcon_text_cell *cell,
void *src;
/* Get font character */
- copy_from_user ( &glyph, fbcon->font->start,
- ( cell->character * sizeof ( glyph ) ),
- sizeof ( glyph ) );
+ fbcon->font->glyph ( cell->character, glyph );
/* Calculate pixel geometry */
offset = ( fbcon->indent +
@@ -182,7 +180,7 @@ static void fbcon_draw ( struct fbcon *fbcon, struct fbcon_text_cell *cell,
transparent = ( cell->background == FBCON_TRANSPARENT );
/* Draw character rows */
- for ( row = 0 ; row < FBCON_CHAR_HEIGHT ; row++ ) {
+ for ( row = 0 ; row < fbcon->font->height ; row++ ) {
/* Draw background picture, if applicable */
if ( transparent ) {
@@ -197,7 +195,7 @@ static void fbcon_draw ( struct fbcon *fbcon, struct fbcon_text_cell *cell,
}
/* Draw character row */
- for ( column = FBCON_CHAR_WIDTH, bitmask = glyph.bitmask[row] ;
+ for ( column = FBCON_CHAR_WIDTH, bitmask = glyph[row] ;
column ; column--, bitmask <<= 1, offset += pixel_len ) {
if ( bitmask & 0x80 ) {
src = &cell->foreground;
@@ -614,7 +612,8 @@ int fbcon_init ( struct fbcon *fbcon, userptr_t start,
/* Expand margin to accommodate whole characters */
width = ( pixel->width - margin->left - margin->right );
height = ( pixel->height - margin->top - margin->bottom );
- if ( ( width < FBCON_CHAR_WIDTH ) || ( height < FBCON_CHAR_HEIGHT ) ) {
+ if ( ( width < FBCON_CHAR_WIDTH ) ||
+ ( height < ( ( int ) font->height ) ) ) {
DBGC ( fbcon, "FBCON %p has unusable character area "
"[%d-%d),[%d-%d)\n", fbcon,
margin->left, ( pixel->width - margin->right ),
@@ -623,7 +622,7 @@ int fbcon_init ( struct fbcon *fbcon, userptr_t start,
goto err_margin;
}
xgap = ( width % FBCON_CHAR_WIDTH );
- ygap = ( height % FBCON_CHAR_HEIGHT );
+ ygap = ( height % font->height );
fbcon->margin.left = ( margin->left + ( xgap / 2 ) );
fbcon->margin.top = ( margin->top + ( ygap / 2 ) );
fbcon->margin.right = ( margin->right + ( xgap - ( xgap / 2 ) ) );
@@ -633,9 +632,9 @@ int fbcon_init ( struct fbcon *fbcon, userptr_t start,
/* Derive character geometry from pixel geometry */
fbcon->character.width = ( width / FBCON_CHAR_WIDTH );
- fbcon->character.height = ( height / FBCON_CHAR_HEIGHT );
+ fbcon->character.height = ( height / font->height );
fbcon->character.len = ( pixel->len * FBCON_CHAR_WIDTH );
- fbcon->character.stride = ( pixel->stride * FBCON_CHAR_HEIGHT );
+ fbcon->character.stride = ( pixel->stride * font->height );
DBGC ( fbcon, "FBCON %p is pixel %dx%d, char %dx%d at "
"[%d-%d),[%d-%d)\n", fbcon, fbcon->pixel->width,
fbcon->pixel->height, fbcon->character.width,