Update BDF converter
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3815 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
4a623ea78e
commit
9d0882c525
@ -2439,7 +2439,7 @@ FAR const struct nx_font_s *nxf_getfontset(NXHANDLE handle);
|
|||||||
<b>Input Parameters:</b>
|
<b>Input Parameters:</b>
|
||||||
<ul><dl>
|
<ul><dl>
|
||||||
<dt><code>handle</code>
|
<dt><code>handle</code>
|
||||||
<dd>A font handle previously returned by <code>nxf_getfonthandle()</code>.
|
<dd>A font handle previously returned by <a href="#nxfgetfonthandle"><code>nxf_getfonthandle()</code></a>.
|
||||||
</dl></ul>
|
</dl></ul>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@ -2465,7 +2465,7 @@ FAR const struct nx_fontbitmap_s *nxf_getbitmap(NXHANDLE handle, uint16_t ch);
|
|||||||
<dt><code>ch</code>
|
<dt><code>ch</code>
|
||||||
<dd>The char code for the requested bitmap.
|
<dd>The char code for the requested bitmap.
|
||||||
<dt><code>handle</code>
|
<dt><code>handle</code>
|
||||||
<dd>A font handle previously returned by <code>nxf_getfonthandle()</code>.
|
<dd>A font handle previously returned by <a href="#nxfgetfonthandle"><code>nxf_getfonthandle()</code></a>.
|
||||||
</dl></ul>
|
</dl></ul>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@ -2882,7 +2882,8 @@ endif
|
|||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
Finally, we need to extend the logic that does the run-time font lookups so that can find our new font.
|
Finally, we need to extend the logic that does the run-time font lookups so that can find our new font.
|
||||||
The lookup function is <code>NXHANDLE nxf_getfonthandle(enum nx_fontid_e fontid)</code>.
|
The lookup function is <a href="#nxfgetfonthandle"><code>NXHANDLE nxf_getfonthandle(enum nx_fontid_e fontid)</code></a>.
|
||||||
|
Note that the lookup is based on the font ID that was defined in step 4.
|
||||||
The new font information needs to be added to data structures used by that function:
|
The new font information needs to be added to data structures used by that function:
|
||||||
</p>
|
</p>
|
||||||
<ul><pre>
|
<ul><pre>
|
||||||
|
32
TODO
32
TODO
@ -42,7 +42,7 @@ apps/
|
|||||||
|
|
||||||
(5) Network Utilities (apps/netutils/)
|
(5) Network Utilities (apps/netutils/)
|
||||||
(5) NuttShell (NSH) (apps/nshlib)
|
(5) NuttShell (NSH) (apps/nshlib)
|
||||||
(3) Other Applications & Tests (apps/examples/)
|
(6) Other Applications & Tests (apps/examples/)
|
||||||
|
|
||||||
o Task/Scheduler (sched/)
|
o Task/Scheduler (sched/)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -1310,4 +1310,34 @@ o Other Applications & Tests (apps/examples/)
|
|||||||
Priority: Low. This is not really a problem becauses examples/nx works
|
Priority: Low. This is not really a problem becauses examples/nx works
|
||||||
fine with its bogus font caching.
|
fine with its bogus font caching.
|
||||||
|
|
||||||
|
Description: examples/nxtext. Artifacts when the pop-up window is opened.
|
||||||
|
There are some artifacts that appear in the upper left hand
|
||||||
|
corner. These seems to be related to window creation. At
|
||||||
|
tiny artifact would not be surprising (the initial window
|
||||||
|
should like at (0,0) and be of size (1,1)), but sometimes
|
||||||
|
the artifact is larger.
|
||||||
|
Status: Open
|
||||||
|
Priority: Medium.
|
||||||
|
|
||||||
|
Description: USB Mass Storage Memory Leak. When examples/usbstorage is
|
||||||
|
built as an NuttShell (NSH) built-in, there appears to be a
|
||||||
|
memory leak that occurs when a USB mass storage connection is
|
||||||
|
established and then torn down. This leak is 608 bytes each
|
||||||
|
time:
|
||||||
|
|
||||||
|
NuttShell (NSH) NuttX-6.6
|
||||||
|
nsh> free
|
||||||
|
total used free largest
|
||||||
|
Mem: 59360 9536 49824 49824
|
||||||
|
nsh> msconn
|
||||||
|
total used free largest
|
||||||
|
Mem: 59360 15296 44064 41712
|
||||||
|
nsh> msdis
|
||||||
|
nsh> free
|
||||||
|
total used free largest
|
||||||
|
Mem: 59360 10144 49216 41712 <-- Leaked 608 bytes
|
||||||
|
Status: Open
|
||||||
|
Priority: Medium. Obviously, this must be fixed. However the USB
|
||||||
|
Mass storage example is fine for supporting most development
|
||||||
|
needs even thought it does leak.
|
||||||
|
|
||||||
|
@ -455,13 +455,13 @@ Where <subdir> is one of the following:
|
|||||||
=========== ======================= ================================
|
=========== ======================= ================================
|
||||||
nsh nsh2
|
nsh nsh2
|
||||||
=========== ======================= ================================
|
=========== ======================= ================================
|
||||||
Toolchain: NuttX buildroot for Codesourcery for Windows *
|
Toolchain: NuttX buildroot for Codesourcery for Windows (1)
|
||||||
Linux or Cygwin *,**
|
Linux or Cygwin (1,2)
|
||||||
----------- ----------------------- --------------------------------
|
----------- ----------------------- --------------------------------
|
||||||
Loader: DfuSe DfuSe
|
Loader: DfuSe DfuSe
|
||||||
----------- ----------------------- --------------------------------
|
----------- ----------------------- --------------------------------
|
||||||
Serial Debug output: USART1 Debug output: USART1
|
Serial Debug output: USART1 Debug output: USART1
|
||||||
Console: NSH output: USART1 NSH output: USART1 ***
|
Console: NSH output: USART1 NSH output: USART1 (3)
|
||||||
----------- ----------------------- --------------------------------
|
----------- ----------------------- --------------------------------
|
||||||
I2C1 Disabled Enabled
|
I2C1 Disabled Enabled
|
||||||
----------- ----------------------- --------------------------------
|
----------- ----------------------- --------------------------------
|
||||||
@ -469,7 +469,7 @@ Where <subdir> is one of the following:
|
|||||||
Support
|
Support
|
||||||
----------- ----------------------- --------------------------------
|
----------- ----------------------- --------------------------------
|
||||||
FAT FS CONFIG_FAT_LCNAME=y CONFIG_FAT_LCNAME=y
|
FAT FS CONFIG_FAT_LCNAME=y CONFIG_FAT_LCNAME=y
|
||||||
Config CONFIG_FAT_LFN=n CONFIG_FAT_LFN=y ****
|
Config CONFIG_FAT_LFN=n CONFIG_FAT_LFN=y (4)
|
||||||
----------- ----------------------- --------------------------------
|
----------- ----------------------- --------------------------------
|
||||||
Support for No Yes
|
Support for No Yes
|
||||||
Built-in
|
Built-in
|
||||||
@ -477,23 +477,37 @@ Where <subdir> is one of the following:
|
|||||||
----------- ----------------------- --------------------------------
|
----------- ----------------------- --------------------------------
|
||||||
Built-in None apps/examples/nx
|
Built-in None apps/examples/nx
|
||||||
Apps apps/examples/nxhello
|
Apps apps/examples/nxhello
|
||||||
apps/examples/usbstorage
|
apps/examples/usbstorage (5)
|
||||||
=========== ======================= ================================
|
=========== ======================= ================================
|
||||||
|
|
||||||
* You will probably need to modify nsh/setenv.sh or nsh2/setenv.sh
|
(1) You will probably need to modify nsh/setenv.sh or nsh2/setenv.sh
|
||||||
to set up the correct PATH variable for whichever toolchain you
|
to set up the correct PATH variable for whichever toolchain you
|
||||||
may use.
|
may use.
|
||||||
** Since DfuSe is assumed, this configuration may only work under
|
(2) Since DfuSe is assumed, this configuration may only work under
|
||||||
Cygwin without modification.
|
Cygwin without modification.
|
||||||
*** When any other device other than /dev/console is used for a user
|
(3) When any other device other than /dev/console is used for a user
|
||||||
interface, (1) linefeeds (\n) will not be expanded to carriage return
|
interface, (1) linefeeds (\n) will not be expanded to carriage return
|
||||||
/ linefeeds \r\n). You will need to configure your terminal program
|
/ linefeeds \r\n). You will need to configure your terminal program
|
||||||
to account for this. And (2) input is not automatically echoed so
|
to account for this. And (2) input is not automatically echoed so
|
||||||
you will have to turn local echo on.
|
you will have to turn local echo on.
|
||||||
**** Microsoft holds several patents related to the design of
|
(4) Microsoft holds several patents related to the design of
|
||||||
long file names in the FAT file system. Please refer to the
|
long file names in the FAT file system. Please refer to the
|
||||||
details in the top-level COPYING file. Please do not use FAT
|
details in the top-level COPYING file. Please do not use FAT
|
||||||
long file name unless you are familiar with these patent issues.
|
long file name unless you are familiar with these patent issues.
|
||||||
|
(5) When built as an NSH add-on command (CONFIG_EXAMPLES_USBSTRG_BUILTIN=y),
|
||||||
|
Caution should be used to assure that the SD drive is not in use when
|
||||||
|
the USB storage device is configured. Specifically, the SD driver
|
||||||
|
should be unmounted like:
|
||||||
|
|
||||||
|
nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard # Card is mounted in NSH
|
||||||
|
...
|
||||||
|
nsh> umount /mnd/sdcard # Unmount before connecting USB!!!
|
||||||
|
nsh> msconn # Connect the USB storage device
|
||||||
|
...
|
||||||
|
nsh> msdis # Disconnect USB storate device
|
||||||
|
nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard # Restore the mount
|
||||||
|
|
||||||
|
Failure to do this could result in corruption of the SD card format.
|
||||||
|
|
||||||
nx:
|
nx:
|
||||||
---
|
---
|
||||||
|
@ -56,7 +56,7 @@ mkversion: mkconfig.c cfgparser.c
|
|||||||
mksyscall: mksyscall.c
|
mksyscall: mksyscall.c
|
||||||
@gcc $(CFLAGS) -o mksyscall mksyscall.c
|
@gcc $(CFLAGS) -o mksyscall mksyscall.c
|
||||||
|
|
||||||
# mksyscall - Convert a CSV file into syscall stubs and proxies
|
# bdf-converter - Converts a BDF font to the NuttX font format
|
||||||
|
|
||||||
bdf-converter: bdf-converter.c
|
bdf-converter: bdf-converter.c
|
||||||
@gcc $(CFLAGS) -o bdf-converter bdf-converter.c
|
@gcc $(CFLAGS) -o bdf-converter bdf-converter.c
|
||||||
|
@ -33,6 +33,12 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Based one the "Glyph Bitmap Distribution Format (BDF) Specification",
|
||||||
|
* Version 2.2, by Adobe Systems Incorporated.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -70,15 +76,15 @@
|
|||||||
|
|
||||||
typedef struct glyphinfo_s
|
typedef struct glyphinfo_s
|
||||||
{
|
{
|
||||||
char *name; /* Name for they glyph */
|
char *name; /* Name for they glyph */
|
||||||
int encoding; /* The Adobe Standard Encoding value */
|
int encoding; /* The Adobe Standard Encoding value */
|
||||||
int bb_w; /* The width of the black pixels in x */
|
int bb_w; /* The width of the black pixels in x */
|
||||||
int bb_h; /* The height of the black pixels in y */
|
int bb_h; /* The height of the black pixels in y */
|
||||||
int bb_x_off; /* X displacement of the lower left corner
|
int bb_x_off; /* X displacement of the lower left corner
|
||||||
* of the bitmap from origin 0 */
|
* of the bitmap from origin 0 */
|
||||||
int bb_y_off; /* Y displacement of the lower left corner
|
int bb_y_off; /* Y displacement of the lower left corner
|
||||||
* of the bitmap from origin 0 */
|
* of the bitmap from origin 0 */
|
||||||
uint32_t *bitmap; /* Hexadecimal data for the */
|
uint32_t *bitmap; /* Hexadecimal data for the character bitmap */
|
||||||
} glyphinfo_t;
|
} glyphinfo_t;
|
||||||
|
|
||||||
/* This structures provides the metrics for one glyph */
|
/* This structures provides the metrics for one glyph */
|
||||||
@ -97,6 +103,17 @@ typedef struct nx_fontmetric_s
|
|||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: trimLine
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Trims the line removing space characters at the front and at the end
|
||||||
|
* of the line.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* line - The line to trim
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
static void trimLine(char *line)
|
static void trimLine(char *line)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
@ -143,6 +160,17 @@ static void bdf_parseintline(char *line, unsigned int count, int *info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bdf_printflyphinfo
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Prints the information available for a glyph.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* ginfo - A glyphinfo_t struct with the glyph's information.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#ifdef DBG
|
||||||
static void bdf_printglyphinfo(const glyphinfo_t *ginfo)
|
static void bdf_printglyphinfo(const glyphinfo_t *ginfo)
|
||||||
{
|
{
|
||||||
printf("NAME = %s\n", ginfo->name);
|
printf("NAME = %s\n", ginfo->name);
|
||||||
@ -157,7 +185,20 @@ static void bdf_printglyphinfo(const glyphinfo_t *ginfo)
|
|||||||
printf("BITMAP[%d] = %x\n", i, ginfo->bitmap[i]);
|
printf("BITMAP[%d] = %x\n", i, ginfo->bitmap[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* DBG */
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bdf_printnxmetricinfo
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Prints the information available for a glyph's metric in the NX
|
||||||
|
* graphics system.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* info - A nx_fontmetric_t struct with the glyph's information.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#ifdef DBG
|
||||||
static void bdf_printnxmetricinfo(const nx_fontmetric_t *info)
|
static void bdf_printnxmetricinfo(const nx_fontmetric_t *info)
|
||||||
{
|
{
|
||||||
printf("STRIDE = %d\n", info->stride);
|
printf("STRIDE = %d\n", info->stride);
|
||||||
@ -166,7 +207,29 @@ static void bdf_printnxmetricinfo(const nx_fontmetric_t *info)
|
|||||||
printf("XOFFSET = %d\n", info->xoffset);
|
printf("XOFFSET = %d\n", info->xoffset);
|
||||||
printf("YOFFSET = %d\n", info->yoffset);
|
printf("YOFFSET = %d\n", info->yoffset);
|
||||||
}
|
}
|
||||||
|
#endif /* DBG */
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bdf_getglyphinfo
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Obtains the information for an individual glyph. The BDF properties
|
||||||
|
* taken into account are:
|
||||||
|
* - ENCODING
|
||||||
|
* - BBX
|
||||||
|
* BDF properties ignored:
|
||||||
|
* - SWIDTH
|
||||||
|
* - DWIDTH
|
||||||
|
* - SWIDTH1
|
||||||
|
* - DWIDTH1
|
||||||
|
* - VVECTOR
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* file - The input file stream pointing to the first line of the
|
||||||
|
* glyph's information (right after STARTCHAR).
|
||||||
|
* ginfo - A glyphinfo_t struct to fill with the glyph's information.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
static void bdf_getglyphinfo(FILE *file, glyphinfo_t *ginfo)
|
static void bdf_getglyphinfo(FILE *file, glyphinfo_t *ginfo)
|
||||||
{
|
{
|
||||||
char line[BDF_MAX_LINE_LENGTH];
|
char line[BDF_MAX_LINE_LENGTH];
|
||||||
@ -215,6 +278,18 @@ static void bdf_getglyphinfo(FILE *file, glyphinfo_t *ginfo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bdf_getglyphbitmap
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Obtains the character bitmap information for an individual glyph.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* file - The input file stream pointing to the first line of the
|
||||||
|
* glyph's bitmap (right after BITMAP).
|
||||||
|
* ginfo - A glyphinfo_t struct to fill with the glyph's bitmap.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
static void bdf_getglyphbitmap(FILE *file, glyphinfo_t *ginfo)
|
static void bdf_getglyphbitmap(FILE *file, glyphinfo_t *ginfo)
|
||||||
{
|
{
|
||||||
char line[BDF_MAX_LINE_LENGTH];
|
char line[BDF_MAX_LINE_LENGTH];
|
||||||
@ -252,11 +327,37 @@ static void bdf_getglyphbitmap(FILE *file, glyphinfo_t *ginfo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bdf_getstride
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Obtains the stride for an individual glyph. The stride is the width
|
||||||
|
* of one glyph's bitmap row in bytes.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* ginfo - A glyphinfo_t struct with the glyph's information.
|
||||||
|
* stride - A pointer to memory provided by the caller in which to
|
||||||
|
* return the stride.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
static void bdf_getstride(glyphinfo_t *ginfo, uint32_t *stride)
|
static void bdf_getstride(glyphinfo_t *ginfo, uint32_t *stride)
|
||||||
{
|
{
|
||||||
*stride = (ginfo->bb_w % 8 == 0) ? ginfo->bb_w / 8 : ginfo->bb_w / 8 + 1 ;
|
*stride = (ginfo->bb_w % 8 == 0) ? ginfo->bb_w / 8 : ginfo->bb_w / 8 + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bdf_printoutput
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Prints to the output stream the information of an individual glyph in
|
||||||
|
* the NuttX font format.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* out - The output stream.
|
||||||
|
* ginfo - A glyphinfo_t struct with the glyph's information.
|
||||||
|
* nxmetric - A nx_fontmetric_t struct with the glyph's information.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
static void bdf_printoutput(FILE *out,
|
static void bdf_printoutput(FILE *out,
|
||||||
glyphinfo_t *ginfo,
|
glyphinfo_t *ginfo,
|
||||||
nx_fontmetric_t *nxmetric)
|
nx_fontmetric_t *nxmetric)
|
||||||
@ -310,22 +411,57 @@ int main(int argc, char **argv)
|
|||||||
char line[BDF_MAX_LINE_LENGTH];
|
char line[BDF_MAX_LINE_LENGTH];
|
||||||
char lineCopy[BDF_MAX_LINE_LENGTH];
|
char lineCopy[BDF_MAX_LINE_LENGTH];
|
||||||
char *str, *token, *saveptr1;
|
char *str, *token, *saveptr1;
|
||||||
|
char *input, *output;
|
||||||
|
|
||||||
/* FONTBOUNDINGBOX properties*/
|
/* FONTBOUNDINGBOX properties*/
|
||||||
int fbb_x, fbb_y, fbb_x_off, fbb_y_off;
|
|
||||||
|
|
||||||
file = fopen("8x13.bdf", "r");
|
int fbb_x = 0;
|
||||||
out = fopen("out.txt", "w");
|
int fbb_y = 0;
|
||||||
|
int fbb_x_off = 0;
|
||||||
|
int fbb_y_off = 0;
|
||||||
|
|
||||||
|
/* Input BDF file */
|
||||||
|
|
||||||
|
input = argv[1];
|
||||||
|
|
||||||
|
if (input == NULL)
|
||||||
|
{
|
||||||
|
printf("%s: no input file\n", argv[0]);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
file = fopen(input, "r");
|
||||||
|
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
{
|
{
|
||||||
perror("Error opening file");
|
printf("%s: error opening file %s\n", argv[0], input);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef VERBOSE
|
||||||
|
printf("Opening \"%s\"\n", input);
|
||||||
|
#endif /* VERBOSE */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Output file */
|
||||||
|
output = "out.txt";
|
||||||
|
out = fopen(output, "w");
|
||||||
|
|
||||||
|
if (out == NULL)
|
||||||
|
{
|
||||||
|
printf("%s: error opening file %s\n", argv[0], output);
|
||||||
|
fclose(file);
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (fgets(line, BDF_MAX_LINE_LENGTH, file) != NULL)
|
while (fgets(line, BDF_MAX_LINE_LENGTH, file) != NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifdef DBG
|
||||||
printf("--\n");
|
printf("--\n");
|
||||||
|
#endif /* DBG */
|
||||||
|
|
||||||
// Save a copy of the line
|
// Save a copy of the line
|
||||||
|
|
||||||
@ -349,6 +485,13 @@ int main(int argc, char **argv)
|
|||||||
fbb_y = fbbinfo[1];
|
fbb_y = fbbinfo[1];
|
||||||
fbb_x_off = fbbinfo[2];
|
fbb_x_off = fbbinfo[2];
|
||||||
fbb_y_off = fbbinfo[3];
|
fbb_y_off = fbbinfo[3];
|
||||||
|
|
||||||
|
/* Print FONTBOUNDINGBOX information */
|
||||||
|
|
||||||
|
fprintf(out, "/* Maximum height and width of any");
|
||||||
|
fprintf(out, " glyph in the set */\n\n");
|
||||||
|
fprintf(out, "#define NXFONT_MAXHEIGHT %d\n", fbb_y);
|
||||||
|
fprintf(out, "#define NXFONT_MAXWIDTH %d\n\n", fbb_x);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STARTCHAR - Individual glyph information */
|
/* STARTCHAR - Individual glyph information */
|
||||||
@ -361,11 +504,19 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
ginfo.name = (char *)strtok_r(NULL, " ", &saveptr1);
|
ginfo.name = (char *)strtok_r(NULL, " ", &saveptr1);
|
||||||
|
|
||||||
|
#ifdef VERBOSE
|
||||||
|
printf("Processing glyph: %s\n", ginfo.name);
|
||||||
|
#endif /* VERBOSE */
|
||||||
|
|
||||||
/* Glyph information:
|
/* Glyph information:
|
||||||
* ENCODING
|
* ENCODING
|
||||||
* BBX
|
* BBX
|
||||||
*/
|
*/
|
||||||
|
ginfo.encoding = 0;
|
||||||
|
ginfo.bb_w = 0;
|
||||||
|
ginfo.bb_h = 0;
|
||||||
|
ginfo.bb_x_off = 0;
|
||||||
|
ginfo.bb_y_off = 0;
|
||||||
bdf_getglyphinfo(file, &ginfo);
|
bdf_getglyphinfo(file, &ginfo);
|
||||||
|
|
||||||
/* Glyph bitmap */
|
/* Glyph bitmap */
|
||||||
@ -373,7 +524,9 @@ int main(int argc, char **argv)
|
|||||||
ginfo.bitmap = malloc(sizeof(uint32_t) * ginfo.bb_h);
|
ginfo.bitmap = malloc(sizeof(uint32_t) * ginfo.bb_h);
|
||||||
bdf_getglyphbitmap(file, &ginfo);
|
bdf_getglyphbitmap(file, &ginfo);
|
||||||
|
|
||||||
|
#ifdef DBG
|
||||||
bdf_printglyphinfo(&ginfo);
|
bdf_printglyphinfo(&ginfo);
|
||||||
|
#endif /* DBG */
|
||||||
|
|
||||||
/* Convert to nxfonts */
|
/* Convert to nxfonts */
|
||||||
|
|
||||||
@ -385,7 +538,10 @@ int main(int argc, char **argv)
|
|||||||
nxmetric.height = ginfo.bb_h;
|
nxmetric.height = ginfo.bb_h;
|
||||||
nxmetric.xoffset = (-fbb_x_off) + ginfo.bb_x_off;
|
nxmetric.xoffset = (-fbb_x_off) + ginfo.bb_x_off;
|
||||||
nxmetric.yoffset = fbb_y + fbb_y_off - ginfo.bb_y_off;
|
nxmetric.yoffset = fbb_y + fbb_y_off - ginfo.bb_y_off;
|
||||||
|
|
||||||
|
#ifdef DBG
|
||||||
bdf_printnxmetricinfo(&nxmetric);
|
bdf_printnxmetricinfo(&nxmetric);
|
||||||
|
#endif /* DBG */
|
||||||
|
|
||||||
bdf_printoutput(out, &ginfo, &nxmetric);
|
bdf_printoutput(out, &ginfo, &nxmetric);
|
||||||
|
|
||||||
@ -401,6 +557,11 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
fclose(out);
|
fclose(out);
|
||||||
|
|
||||||
|
/* The End */
|
||||||
|
|
||||||
|
printf("Generated \"%s\"\n", output);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
Loading…
Reference in New Issue
Block a user