summaryrefslogtreecommitdiff
path: root/nuttx/graphics
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-07-28 20:10:20 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-07-28 20:10:20 +0000
commit10c58851c2e5ef8ec1e0b59c2fdf549dd3478f0c (patch)
tree3d5b0d9edadb83f2905af68ad7f06f5b467f920a /nuttx/graphics
parent99ffb319c5af373ef135c2a3e73bf1171e55559e (diff)
downloadpx4-nuttx-10c58851c2e5ef8ec1e0b59c2fdf549dd3478f0c.tar.gz
px4-nuttx-10c58851c2e5ef8ec1e0b59c2fdf549dd3478f0c.tar.bz2
px4-nuttx-10c58851c2e5ef8ec1e0b59c2fdf549dd3478f0c.zip
If the requested font cannot be found, return the default font
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3823 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/graphics')
-rw-r--r--nuttx/graphics/nxfonts/nxfonts_getfont.c22
-rwxr-xr-xnuttx/graphics/nxfonts/nxfonts_sans28x37b.h6
-rwxr-xr-xnuttx/graphics/nxfonts/nxfonts_sans40x49b.h8
-rwxr-xr-xnuttx/graphics/nxfonts/nxfonts_serif27x38b.h2
-rwxr-xr-xnuttx/graphics/nxfonts/nxfonts_serif29x37.h2
5 files changed, 29 insertions, 11 deletions
diff --git a/nuttx/graphics/nxfonts/nxfonts_getfont.c b/nuttx/graphics/nxfonts/nxfonts_getfont.c
index efc6f8256..d36576fef 100644
--- a/nuttx/graphics/nxfonts/nxfonts_getfont.c
+++ b/nuttx/graphics/nxfonts/nxfonts_getfont.c
@@ -179,7 +179,8 @@ static inline FAR const struct nx_fontset_s *
NXHANDLE nxf_getfonthandle(enum nx_fontid_e fontid)
{
FAR const struct nx_fontpackage_s **pkglist;
- FAR const struct nx_fontpackage_s *package;
+ FAR const struct nx_fontpackage_s *package;
+ FAR const struct nx_fontpackage_s *defpkg = NULL;
/* Handle the default font package */
@@ -192,14 +193,31 @@ NXHANDLE nxf_getfonthandle(enum nx_fontid_e fontid)
for (pkglist = g_fontpackages; *pkglist; pkglist++)
{
+ /* Is this the package with the matching font ID? */
+
package = *pkglist;
if (package->id == fontid)
{
+ /* Yes.. return a pointer to the package as the handle */
+
return (NXHANDLE)package;
}
+
+ /* No.. is it the default font? */
+
+ else if (package->id == NXFONT_DEFAULT)
+ {
+ /* Yes.. save the pointer to the default font. We will return the
+ * default font if the requested font cannot be found.
+ */
+
+ defpkg = package;
+ }
}
- return (NXHANDLE)NULL;
+ /* Return a pointer to the default font as the handle. */
+
+ return (NXHANDLE)defpkg;
}
/****************************************************************************
diff --git a/nuttx/graphics/nxfonts/nxfonts_sans28x37b.h b/nuttx/graphics/nxfonts/nxfonts_sans28x37b.h
index 19a3b70a8..adc12b59b 100755
--- a/nuttx/graphics/nxfonts/nxfonts_sans28x37b.h
+++ b/nuttx/graphics/nxfonts/nxfonts_sans28x37b.h
@@ -621,7 +621,7 @@
#define NXFONT_METRICS_205 {1, 6, 24, 1, 5, 0}
#define NXFONT_BITMAP_205 {0x1c, 0x38, 0x70, 0xe0, 0x0, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70}
-/* Icircumflex (206) */
+/* Icircumflex (206) - NOTE: Xoffset should be -1, not 0. */
#define NXFONT_METRICS_206 {2, 9, 24, 0, 5, 0}
#define NXFONT_BITMAP_206 {0x1c, 0x0, 0x3e, 0x0, 0x77, 0x0, 0xe3, 0x80, 0x0, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0}
@@ -629,7 +629,7 @@
#define NXFONT_METRICS_207 {1, 7, 23, 0, 6, 0}
#define NXFONT_BITMAP_207 {0xee, 0xee, 0x0, 0x0, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38}
-/* Eth (208) */
+/* Eth (208) - NOTE: Xoffset should be -1, not 0. */
#define NXFONT_METRICS_208 {3, 19, 19, 0, 10, 0}
#define NXFONT_BITMAP_208 {0x1f, 0xfc, 0x0, 0x1f, 0xff, 0x0, 0x1c, 0xf, 0x80, 0x1c, 0x3, 0xc0, 0x1c, 0x1, 0xc0, 0x1c, 0x1, 0xe0, 0x1c, 0x0, 0xe0, 0x1c, 0x0, 0xe0, 0xff, 0xc0, 0xe0, 0xff, 0xc0, 0xe0, 0x1c, 0x0, 0xe0, 0x1c, 0x0, 0xe0, 0x1c, 0x0, 0xe0, 0x1c, 0x1, 0xe0, 0x1c, 0x1, 0xc0, 0x1c, 0x3, 0xc0, 0x1c, 0xf, 0x80, 0x1f, 0xff, 0x0, 0x1f, 0xfc, 0x0}
@@ -749,7 +749,7 @@
#define NXFONT_METRICS_237 {1, 6, 19, 1, 10, 0}
#define NXFONT_BITMAP_237 {0x1c, 0x38, 0x70, 0xe0, 0x0, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70}
-/* icircumflex (238) */
+/* icircumflex (238) - NOTE: Xoffset should be -1, not 0. */
#define NXFONT_METRICS_238 {2, 9, 19, 0, 10, 0}
#define NXFONT_BITMAP_238 {0x1c, 0x0, 0x3e, 0x0, 0x77, 0x0, 0xe3, 0x80, 0x0, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0, 0x1c, 0x0}
diff --git a/nuttx/graphics/nxfonts/nxfonts_sans40x49b.h b/nuttx/graphics/nxfonts/nxfonts_sans40x49b.h
index 24aea1933..66fc6bd83 100755
--- a/nuttx/graphics/nxfonts/nxfonts_sans40x49b.h
+++ b/nuttx/graphics/nxfonts/nxfonts_sans40x49b.h
@@ -629,7 +629,7 @@
#define NXFONT_METRICS_207 {2, 10, 31, 0, 6, 0}
#define NXFONT_BITMAP_207 {0xf3, 0xc0, 0xf3, 0xc0, 0xf3, 0xc0, 0xf3, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0, 0x3e, 0x0}
-/* Eth (208) */
+/* Eth (208) -- NOTE: Xoffset should be -1, not 0. */
#define NXFONT_METRICS_208 {3, 23, 25, 0, 12, 0}
#define NXFONT_BITMAP_208 {0x1f, 0xff, 0x80, 0x1f, 0xff, 0xe0, 0x1f, 0xff, 0xf0, 0x1f, 0xff, 0xf8, 0x1f, 0x7, 0xf8, 0x1f, 0x0, 0xfc, 0x1f, 0x0, 0xfc, 0x1f, 0x0, 0x7c, 0x1f, 0x0, 0x7e, 0x1f, 0x0, 0x3e, 0x1f, 0x0, 0x3e, 0xff, 0xf0, 0x3e, 0xff, 0xf0, 0x3e, 0xff, 0xf0, 0x3e, 0x1f, 0x0, 0x3e, 0x1f, 0x0, 0x3e, 0x1f, 0x0, 0x7c, 0x1f, 0x0, 0x7c, 0x1f, 0x0, 0x7c, 0x1f, 0x0, 0xf8, 0x1f, 0x3, 0xf8, 0x1f, 0xff, 0xf0, 0x1f, 0xff, 0xf0, 0x1f, 0xff, 0xc0, 0x1f, 0xff, 0x80}
@@ -749,11 +749,11 @@
#define NXFONT_METRICS_237 {1, 6, 25, 2, 12, 0}
#define NXFONT_BITMAP_237 {0x3c, 0x38, 0x70, 0x70, 0xe0, 0x0, 0x0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0}
-/* icircumflex (238) */
+/* icircumflex (238) -- NOTE: Xoffset should be -1, not 0. */
#define NXFONT_METRICS_238 {2, 10, 25, 0, 12, 0}
#define NXFONT_BITMAP_238 {0xc, 0x0, 0x1e, 0x0, 0x3f, 0x0, 0x73, 0x80, 0xe1, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0}
-/* idieresis (239) */
+/* idieresis (239) - NOTE: Xoffset should be -1, not 0. */
#define NXFONT_METRICS_239 {2, 10, 24, 0, 13, 0}
#define NXFONT_BITMAP_239 {0xf3, 0xc0, 0xf3, 0xc0, 0xf3, 0xc0, 0xf3, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0, 0x1e, 0x0}
@@ -789,7 +789,7 @@
#define NXFONT_METRICS_247 {2, 16, 16, 1, 21, 0}
#define NXFONT_BITMAP_247 {0x3, 0xc0, 0x3, 0xc0, 0x3, 0xc0, 0x3, 0xc0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x3, 0xc0, 0x3, 0xc0, 0x3, 0xc0, 0x3, 0xc0}
-/* oslash (248) */
+/* oslash (248) - NOTE: Xoffset should be -1, not 0. */
#define NXFONT_METRICS_248 {3, 21, 18, 0, 19, 0}
#define NXFONT_BITMAP_248 {0x1, 0xfc, 0x38, 0x7, 0xff, 0x70, 0xf, 0xff, 0xe0, 0x1f, 0xff, 0xc0, 0x1f, 0x8f, 0xc0, 0x3e, 0x7, 0xe0, 0x3e, 0xf, 0xe0, 0x3c, 0x1d, 0xe0, 0x3c, 0x39, 0xe0, 0x3c, 0x71, 0xe0, 0x3e, 0xe3, 0xe0, 0x3f, 0x83, 0xe0, 0x3f, 0x7, 0xe0, 0x1f, 0x8f, 0xc0, 0x1f, 0xff, 0xc0, 0x3f, 0xff, 0x80, 0x77, 0xff, 0x0, 0xe1, 0xfc, 0x0}
diff --git a/nuttx/graphics/nxfonts/nxfonts_serif27x38b.h b/nuttx/graphics/nxfonts/nxfonts_serif27x38b.h
index 5c121eb0e..c82dd402e 100755
--- a/nuttx/graphics/nxfonts/nxfonts_serif27x38b.h
+++ b/nuttx/graphics/nxfonts/nxfonts_serif27x38b.h
@@ -357,7 +357,7 @@
#define NXFONT_METRICS_105 {1, 5, 17, 1, 11, 0}
#define NXFONT_BITMAP_105 {0x70, 0x70, 0x70, 0x0, 0x0, 0xf0, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0xf8}
-/* j (106) */
+/* j (106) - NOTE: Xoffset should be -1, not 0. */
#define NXFONT_METRICS_106 {1, 7, 22, 0, 11, 0}
#define NXFONT_BITMAP_106 {0xe, 0xe, 0xe, 0x0, 0x0, 0x1e, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xce, 0xce, 0xcc, 0x78}
diff --git a/nuttx/graphics/nxfonts/nxfonts_serif29x37.h b/nuttx/graphics/nxfonts/nxfonts_serif29x37.h
index eaba0b39a..168317802 100755
--- a/nuttx/graphics/nxfonts/nxfonts_serif29x37.h
+++ b/nuttx/graphics/nxfonts/nxfonts_serif29x37.h
@@ -357,7 +357,7 @@
#define NXFONT_METRICS_105 {1, 4, 17, 1, 11, 0}
#define NXFONT_BITMAP_105 {0x60, 0x60, 0x0, 0x0, 0x0, 0x60, 0xe0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0}
-/* j (106) */
+/* j (106) - NOTE: Xoffset should be -2, not 0. */
#define NXFONT_METRICS_106 {1, 6, 23, 0, 11, 0}
#define NXFONT_BITMAP_106 {0xc, 0xc, 0x0, 0x0, 0x0, 0xc, 0x1c, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xcc, 0xc8, 0x70}