video: Allow querying the font size
All the font size to be queried using the 'font size' command. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -55,9 +55,6 @@ static int do_font_size(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||||||
uint size;
|
uint size;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (argc != 2)
|
|
||||||
return CMD_RET_USAGE;
|
|
||||||
|
|
||||||
if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
|
if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
ret = vidconsole_get_font_size(dev, &font_name, &size);
|
ret = vidconsole_get_font_size(dev, &font_name, &size);
|
||||||
@@ -66,6 +63,9 @@ static int do_font_size(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argc < 2) {
|
||||||
|
printf("%d\n", size);
|
||||||
|
} else {
|
||||||
size = dectoul(argv[1], NULL);
|
size = dectoul(argv[1], NULL);
|
||||||
|
|
||||||
ret = vidconsole_select_font(dev, font_name, size);
|
ret = vidconsole_select_font(dev, font_name, size);
|
||||||
@@ -73,6 +73,7 @@ static int do_font_size(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||||||
printf("Failed (error %d)\n", ret);
|
printf("Failed (error %d)\n", ret);
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,7 @@ Synopsis
|
|||||||
|
|
||||||
font list
|
font list
|
||||||
font select <name> [<size>]
|
font select <name> [<size>]
|
||||||
font size <size>
|
font size [<size>]
|
||||||
|
|
||||||
Description
|
Description
|
||||||
-----------
|
-----------
|
||||||
@@ -34,7 +34,7 @@ This selects a new font and optionally changes the size.
|
|||||||
font size
|
font size
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
This changes the font size only.
|
This changes the font size only. With no argument it shows the current size.
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
--------
|
--------
|
||||||
@@ -44,6 +44,8 @@ Examples
|
|||||||
=> font list
|
=> font list
|
||||||
nimbus_sans_l_regular
|
nimbus_sans_l_regular
|
||||||
cantoraone_regular
|
cantoraone_regular
|
||||||
|
=> font size
|
||||||
|
30
|
||||||
=> font size 40
|
=> font size 40
|
||||||
=> font select cantoraone_regular 20
|
=> font select cantoraone_regular 20
|
||||||
=>
|
=>
|
||||||
|
@@ -58,10 +58,19 @@ static int font_test_base(struct unit_test_state *uts)
|
|||||||
ut_assertok(vidconsole_get_font_size(dev, &name, &size));
|
ut_assertok(vidconsole_get_font_size(dev, &name, &size));
|
||||||
ut_asserteq_str("cantoraone_regular", name);
|
ut_asserteq_str("cantoraone_regular", name);
|
||||||
ut_asserteq(40, size);
|
ut_asserteq(40, size);
|
||||||
|
ut_assertok(ut_check_console_end(uts));
|
||||||
|
|
||||||
|
ut_assertok(run_command("font size", 0));
|
||||||
|
ut_assert_nextline("40");
|
||||||
|
ut_assertok(ut_check_console_end(uts));
|
||||||
|
|
||||||
ut_assertok(run_command("font size 30", 0));
|
ut_assertok(run_command("font size 30", 0));
|
||||||
ut_assert_console_end();
|
ut_assert_console_end();
|
||||||
|
|
||||||
|
ut_assertok(run_command("font size", 0));
|
||||||
|
ut_assert_nextline("30");
|
||||||
|
ut_assertok(ut_check_console_end(uts));
|
||||||
|
|
||||||
ut_assertok(vidconsole_get_font_size(dev, &name, &size));
|
ut_assertok(vidconsole_get_font_size(dev, &name, &size));
|
||||||
ut_asserteq_str("cantoraone_regular", name);
|
ut_asserteq_str("cantoraone_regular", name);
|
||||||
ut_asserteq(30, size);
|
ut_asserteq(30, size);
|
||||||
|
Reference in New Issue
Block a user