summaryrefslogtreecommitdiff
path: root/apps/examples/nx/nx_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/examples/nx/nx_main.c')
-rw-r--r--apps/examples/nx/nx_main.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/apps/examples/nx/nx_main.c b/apps/examples/nx/nx_main.c
index 72e8fe2ca..6d85d0fb7 100644
--- a/apps/examples/nx/nx_main.c
+++ b/apps/examples/nx/nx_main.c
@@ -102,6 +102,10 @@ static const uint8_t g_kbdmsg1[] = "NuttX is cool!";
static const uint8_t g_kbdmsg2[] = "NuttX is fun!";
#endif
+/* The font handle */
+
+NXHANDLE g_fonthandle;
+
/****************************************************************************
* Public Data
****************************************************************************/
@@ -179,7 +183,7 @@ static void nxeg_initstate(FAR struct nxeg_state_s *st, int wnum,
*/
#ifdef CONFIG_NX_KBD
- fontset = nxf_getfontset(NXFONT_DEFAULT);
+ fontset = nxf_getfontset(g_fonthandle);
st->nchars = 0;
st->nglyphs = 0;
st->height = fontset->mxheight;
@@ -637,6 +641,16 @@ int user_start(int argc, char *argv[])
goto errout;
}
+ /* Get the default font handle */
+
+ g_fonthandle = nxf_getfonthandle(NXFONT_DEFAULT);
+ if (!g_fonthandle)
+ {
+ message("user_start: Failed to get font handle: %d\n", errno);
+ g_exitcode = NXEXIT_FONTOPEN;
+ goto errout;
+ }
+
/* Set the background to the configured background color */
message("user_start: Set background color=%d\n", CONFIG_EXAMPLES_NX_BGCOLOR);