Add several new fonts

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3821 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2011-07-27 05:02:58 +00:00
parent fc7db01820
commit dd47d95381
13 changed files with 3532 additions and 7 deletions
+1
View File
@@ -1952,3 +1952,4 @@
stm32_reset() in order to return the write requests to the USB mass
storage driver; it is possible that a similar but could exist for other
architectures.
* graphics/nxfonts/nxfonts_*.h: Add serverl new fonts
+9
View File
@@ -484,6 +484,15 @@ o Graphics subystem (graphics/)
Status: Open
Priority: Medium
Description: Font metric structure (in include/nuttx/nx/nxfont.h) should allow
negative X offsets. Negative x-offsets are necessary for certain
glyphs (and is very common in italic fonts).
For example Eth, icircumflex, idieresis, and oslash should have
offset=1 in the 40x49b font.
Status: Open. The problem is that the x-offset is an unsigned bitfield
in the current structure.
Priority: Low.
o Pascal Add-On (pcode/)
^^^^^^^^^^^^^^^^^^^^^^
+12
View File
@@ -122,6 +122,18 @@ genfontsources:
ifeq ($(CONFIG_NXFONT_SANS23X27),y)
@$(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_FONTID=1 EXTRADEFINES=$(EXTRADEFINES)
endif
ifeq ($(CONFIG_NXFONT_SANS28X37B),y)
@$(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_FONTID=2 EXTRADEFINES=$(EXTRADEFINES)
endif
ifeq ($(CONFIG_NXFONT_SANS40X49B),y)
@$(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_FONTID=3 EXTRADEFINES=$(EXTRADEFINES)
endif
ifeq ($(CONFIG_NXFONT_SERIF27X38B),y)
@$(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_FONTID=4 EXTRADEFINES=$(EXTRADEFINES)
endif
ifeq ($(CONFIG_NXFONT_SERIF29X37),y)
@$(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_FONTID=5 EXTRADEFINES=$(EXTRADEFINES)
endif
gensources: gen1bppsources gen2bppsource gen4bppsource gen8bppsource gen16bppsource gen24bppsource gen32bppsources genfontsources
+12
View File
@@ -44,6 +44,18 @@ NXFSET_CSRCS =
ifeq ($(CONFIG_NXFONT_SANS23X27),y)
NXFSET_CSRCS += nxfonts_bitmaps_sans23x27.c
endif
ifeq ($(CONFIG_NXFONT_SANS28X37B),y)
NXFSET_CSRCS += nxfonts_bitmaps_sans28x37b.c
endif
ifeq ($(CONFIG_NXFONT_SANS40X49B),y)
NXFSET_CSRCS += nxfonts_bitmaps_sans40x49b.c
endif
ifeq ($(CONFIG_NXFONT_SERIF27X38B),y)
NXFSET_CSRCS += nxfonts_bitmaps_serif27x38b.c
endif
ifeq ($(CONFIG_NXFONT_SERIF29X37),y)
NXFSET_CSRCS += nxfonts_bitmaps_serif29x37.c
endif
NXFONTS_ASRCS = $(NXFCONV_ASRCS) $(NXFSET_ASRCS)
NXFONTS_CSRCS = nxfonts_getfont.c $(NXFCONV_CSRCS) $(NXFSET_CSRCS)
+16
View File
@@ -76,6 +76,22 @@ ifeq ($(NXFONTS_FONTID),1)
NXFONTS_PREFIX := g_sans23x27_
GEN_CSRC = nxfonts_bitmaps_sans23x27.c
endif
ifeq ($(NXFONTS_FONTID),2)
NXFONTS_PREFIX := g_sans28x37b_
GEN_CSRC = nxfonts_bitmaps_sans28x37b.c
endif
ifeq ($(NXFONTS_FONTID),3)
NXFONTS_PREFIX := g_sans40x49b_
GEN_CSRC = nxfonts_bitmaps_sans40x49b.c
endif
ifeq ($(NXFONTS_FONTID),4)
NXFONTS_PREFIX := g_serif27x38b_
GEN_CSRC = nxfonts_bitmaps_serif27x38b.c
endif
ifeq ($(NXFONTS_FONTID),5)
NXFONTS_PREFIX := g_serif29x37_
GEN_CSRC = nxfonts_bitmaps_serif29x37.c
endif
DEPENDENCY := nxfonts_bitmaps.c
CPPFLAGS += -DNXFONTS_FONTID=$(NXFONTS_FONTID)
+8
View File
@@ -48,6 +48,14 @@
#if NXFONTS_FONTID == 1
# include "nxfonts_sans23x27.h"
#elif NXFONTS_FONTID == 2
# include "nxfonts_sans28x37b.h"
#elif NXFONTS_FONTID == 3
# include "nxfonts_sans40x49b.h"
#elif NXFONTS_FONTID == 4
# include "nxfonts_serif27x38b.h"
#elif NXFONTS_FONTID == 5
# include "nxfonts_serif29x37.h"
#else
# error "No font ID specified"
#endif
+24
View File
@@ -63,11 +63,35 @@
#ifdef CONFIG_NXFONT_SANS23X27
extern const struct nx_fontpackage_s g_sans23x27_package;
#endif
#ifdef CONFIG_NXFONT_SANS28X37B
extern const struct nx_fontpackage_s g_sans28x37b_package;
#endif
#ifdef CONFIG_NXFONT_SANS40X49B
extern const struct nx_fontpackage_s g_sans40x49b_package;
#endif
#ifdef CONFIG_NXFONT_SERIF27X38B
extern const struct nx_fontpackage_s g_serif27x38b_package;
#endif
#ifdef CONFIG_NXFONT_SERIF29X37
extern const struct nx_fontpackage_s g_serif29x37_package;
#endif
static FAR const struct nx_fontpackage_s *g_fontpackages[] =
{
#ifdef CONFIG_NXFONT_SANS23X27
&g_sans23x27_package,
#endif
#ifdef CONFIG_NXFONT_SANS28X37B
&g_sans28x37b_package,
#endif
#ifdef CONFIG_NXFONT_SANS40X49B
&g_sans40x49b_package,
#endif
#ifdef CONFIG_NXFONT_SERIF27X38B
&g_serif27x38b_package,
#endif
#ifdef CONFIG_NXFONT_SERIF29X37
&g_serif29x37_package,
#endif
NULL
};
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+24
View File
@@ -58,6 +58,18 @@
# define NXFONT_DEFAULT FONTID_SANS23X27
#endif
#if defined(CONFIG_NXFONT_SANS23X27)
# define NXFONT_DEFAULT FONTID_SANS23X27
#elif defined(CONFIG_NXFONT_SANS28X37B)
# define NXFONT_DEFAULT FONTID_SANS28X37B
#elif defined(CONFIG_NXFONT_SANS40X49B)
# define NXFONT_DEFAULT FONTID_SANS40X49B
#elif defined(CONFIG_NXFONT_SERIF27X38B)
# define NXFONT_DEFAULT FONTID_SERIF27X38B
#elif defined(CONFIG_NXFONT_SERIF29X37)
# define NXFONT_DEFAULT FONTID_SERIF29X37
#endif
/****************************************************************************
* Public Types
****************************************************************************/
@@ -70,6 +82,18 @@ enum nx_fontid_e
#ifdef CONFIG_NXFONT_SANS23X27
, FONTID_SANS23X27 = 1 /* The 23x27 sans serif font */
#endif
#ifdef CONFIG_NXFONT_SANS28X37B
, FONTID_SANS28X37B = 2 /* The 28x37 sans bold font */
#endif
#ifdef CONFIG_NXFONT_SANS40X49B
, FONTID_SANS40X49B = 3 /* The 40x49 sans bold font */
#endif
#ifdef CONFIG_NXFONT_SERIF27X38B
, FONTID_SERIF27X38B = 4 /* The 27x38 serif bold font */
#endif
#ifdef CONFIG_NXFONT_SERIF29X37
, FONTID_SERIF29X37 = 5 /* The 29x37 serif font */
#endif
};
/* This structures provides the metrics for one glyph */
+30 -7
View File
@@ -53,6 +53,11 @@
* Pre-Processor Definitions
****************************************************************************/
/*
#define VERBOSE
#define DBG
*/
// BDF Specification Version 2.2:
// This version lifts the restriction on line length. In this version, the new
// maximum length of a value of the type string is 65535 characters, and hence
@@ -90,7 +95,7 @@ typedef struct glyphinfo_s
* of the bitmap from origin 0 */
int bb_y_off; /* Y displacement of the lower left corner
* of the bitmap from origin 0 */
uint32_t *bitmap; /* Hexadecimal data for the character bitmap */
uint64_t *bitmap; /* Hexadecimal data for the character bitmap */
} glyphinfo_t;
/* This structures provides the metrics for one glyph */
@@ -311,7 +316,7 @@ static void bdf_getglyphinfo(FILE *file, glyphinfo_t *ginfo)
static void bdf_getglyphbitmap(FILE *file, glyphinfo_t *ginfo)
{
char line[BDF_MAX_LINE_LENGTH];
uint32_t *bitmap;
uint64_t *bitmap;
bool readingbitmap;
bitmap = ginfo->bitmap;
@@ -414,7 +419,7 @@ static void bdf_printoutput(FILE *out,
{
int nxbyteoffset;
uint8_t nxbyte = 0;
uint32_t tempbitmap = ginfo->bitmap[i];
uint64_t tempbitmap = ginfo->bitmap[i];
/* Get the next byte */
@@ -430,7 +435,7 @@ static void bdf_printoutput(FILE *out,
{
int nxbyteoffset;
uint8_t nxbyte = 0;
uint32_t tempbitmap = ginfo->bitmap[i];
uint64_t tempbitmap = ginfo->bitmap[i];
/* Get the next byte */
@@ -583,7 +588,7 @@ int main(int argc, char **argv)
/* Glyph bitmap */
ginfo.bitmap = malloc(sizeof(uint32_t) * ginfo.bb_h);
ginfo.bitmap = malloc(sizeof(uint64_t) * ginfo.bb_h);
bdf_getglyphbitmap(file, &ginfo);
#ifdef DBG
@@ -598,10 +603,28 @@ int main(int argc, char **argv)
nxmetric.stride = stride;
nxmetric.width = ginfo.bb_w;
nxmetric.height = ginfo.bb_h;
nxmetric.xoffset = (-fbb_x_off) + ginfo.bb_x_off;
/* The NuttX font format does not support
* negative X offsets. */
if (ginfo.bb_x_off < 0)
{
nxmetric.xoffset = 0;
printf("%s: ignoring negative x offset for "
"glyph '%s' (%d)\n",
argv[0],
ginfo.name,
ginfo.encoding);
}
else
{
nxmetric.xoffset = ginfo.bb_x_off;
}
nxmetric.yoffset = fbb_y + fbb_y_off -
ginfo.bb_y_off - ginfo.bb_h;
#ifdef DBG
bdf_printnxmetricinfo(&nxmetric);
#endif /* DBG */