Reply by PeterElliot June 16, 20092009-06-16
--- In l..., "Kevin Townsend" wrote:
>
> > I used a program from called BMFont from Angelcode.com
> >
> > http://www.angelcode.com/products/bmfont/
>
> I hadn't come across that before. It will be a bit of work to convert the results to something usable, but it looks interesting since I often want to export non-Latin unicode characters. Thanks for the link.
>
> How are you going about converting from the txt/targa file to something usable by an MCU yourself?
>
> Kevin
>

Hi Kevin,

I took the bitmap file generated and loaded it into GIMP and then used the save as C Header/source file option to export the data for use in my application.

PJE

An Engineer's Guide to the LPC2100 Series

Reply by Toby Harris June 16, 20092009-06-16
Have a look at http://www.pocketmt.com/ as well, bang for buck its looks
pretty good.

________________________________

From: l... [mailto:l...] On Behalf
Of Kevin Townsend
Sent: 16 June 2009 15:27
To: l...
Subject: [lpc2000] Re: fonts for embedded systems

> I used a program from called BMFont from Angelcode.com
>
> http://www.angelcode.com/products/bmfont/


I hadn't come across that before. It will be a bit of work to convert
the results to something usable, but it looks interesting since I often
want to export non-Latin unicode characters. Thanks for the link.

How are you going about converting from the txt/targa file to something
usable by an MCU yourself?

Kevin



Reply by Kevin Townsend June 16, 20092009-06-16
> I used a program from called BMFont from Angelcode.com
>
> http://www.angelcode.com/products/bmfont/

I hadn't come across that before. It will be a bit of work to convert the results to something usable, but it looks interesting since I often want to export non-Latin unicode characters. Thanks for the link.

How are you going about converting from the txt/targa file to something usable by an MCU yourself?

Kevin

Reply by PeterElliot June 16, 20092009-06-16
Hi Wouter,

I used a program from called BMFont from Angelcode.com

http://www.angelcode.com/products/bmfont/

This generates a packed bitmap with x,y,w,h coordinates to extract each character. The fonts have adjustable anti-aliasing etc.

There's also some sample code for handling the bitmaps, but I wrote my own.

PJE

--- In l..., Wouter van Ooijen wrote:
>
> I am working on a tool for writing RAM applications. I want to give the
> users an easy way to include a font (for use on a graphic LCD). So far I
> have managed to process TrueType and OpenType fonts (using Python/PIL)
> but the result is often not pleasant at smaller sizes.
>
> Are there any standard file formats for bitmapped fonst that I should
> consider?
>
> --
>
> Wouter van Ooijen
>
> -- -------
> Van Ooijen Technische Informatica: www.voti.nl
> consultancy, development, PICmicro products
> docent Hogeschool van Utrecht: www.voti.nl/hvu
>

Reply by cfbsoftware1 June 16, 20092009-06-16
--- In l..., Wouter van Ooijen wrote:
>
> Note that I am not looking for fonts (unless they are really free beer),
> rather I am looking for an appropriate format that the user of my tool
> can use to supply a font.
>

A very simple technique you could use is to just to get the user to create a monochrome BMP file containing one example of each character. This can be done using the text insertion tool of a typical 'Paint' program. Just type in each character in the desire font in the correct ASCII sequence on one line and resize the canvas so that e.g. it is one character high by 95 characters (the number of printable characters in the 128-char set) wide.

--
Chris Burrows
CFB Software
Armaide: LPC2xxx Oberon-07 Development System
http://www.cfbsoftware.com/armaide

Reply by Wouter van Ooijen June 16, 20092009-06-16
> I can send you the application, but as others mentioned, there are legal
> issues.

I think what you wrote is compareable to what I have now, but I'll
consider the write-n-times trick.

--

Wouter van Ooijen

-- -------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu

Reply by "M. Manca" June 16, 20092009-06-16
Wouter van Ooijen ha scritto:
>> Some years ago I wrote a simple tool to convert ttf fonts to an
>> array of bmps using Borland C++ builder 6. Simply write a char on a
>> canvas then read the canvas at pixel level, it is not so hard.
>
> That is exactly what I do, but using Python/PIL instead of BC++. But
> the problem is that those nice fonts do not render well to small
> sizes, so in addition to the above method I need a method to handle
> smaller fonts.

the problem is if you may use anti aliasing or not. I used the same
application to convert fonts for a graphic lcd display and they look
good, and for a thermal printer and they look not so good just because
printer can't manage anti aliasing.
So, if your display may manage gray levels you may use anti aliasing and
then if font doesn't look good as in a PC screen is a problem of your
application. Try to see how looks on a PC at same size, the font has to
look the same on both displays (it has always the same size in pixel so
it looks the same).
>
> --
>
> Wouter van Ooijen
>
> -- ------- Van Ooijen Technische
> Informatica: www.voti.nl consultancy, development, PICmicro products
> docent Hogeschool van Utrecht: www.voti.nl/hvu
>
>



Reply by Jan Vanek June 16, 20092009-06-16
Hi Wouter,

I wrote a small app which generates "bitmaps" for a font of a given size and
possibly with limited set of characters (e.g. only numbers). The result is
an include file and a define like Tahoma16. There is however no support for
antialiasing (1bit per pixel currently). It is a Win32 application and I use
flag NONANTIALIASED_QUALITY in the CreateFontIndirect() function. Without
this flag the application would recognize any "shadow" resulting from
windows-antialiasing as a pixel and the font looks bad. Maybe this is
possible to set in Python? Another tip to make the appearance nicer without
antialiasing is to use "shadow", i.e. you write the same text offset by x=1,
y=1, or even 8 times at all surrounding positions, and then the text itself.

The format to store the data is following:

#pragma once

#include "shared/base/Types.h"

template
struct FontCharT
{
u8 width; // width of the character
u8 top; // first non-empty line
u8 height; // count of lines
u8 _reserved;
u16 mask[N]; // sequence of bits
};

typedef FontCharT<1> FontChar;

template
struct FontDataT
{
u8 first; // first character
u8 count; // count of characters
u8 height; // height of the font
u8 _reserved;
const FontChar* chars[N];
};

typedef FontDataT<1> FontData;

I hope this is self describing. The generated file looks like:
typedef FontDataT<10> Tahoma22FontType;
extern const Tahoma22FontType Tahoma22FontData;

#ifndef FONT_DATA

#define Tahoma22 ((const FontData*)&Tahoma22FontData)

#else

/* 0 */
static const FontCharT<9> Tahoma22FontChar48 {
11,
5,
13,
0,
{ 0xF0F8, 0x738F, 0x770E, 0xC3B8, 0xEE1D, 0x8770, 0x9C3B, 0xFC73,
0x0F83 }
};

/* 1 */
static const FontCharT<9> Tahoma22FontChar49 {
11,
5,
13,
0,
{ 0x8070, 0x1F83, 0x00FC, 0x3807, 0x01C0, 0x700E, 0x0380, 0xFC1C,
0x3FE7 }
};

...
...

const Tahoma22FontType Tahoma22FontData {
48,
10,
22,
0,
{
/* 0 */ (const FontChar*)&Tahoma22FontChar48,
/* 1 */ (const FontChar*)&Tahoma22FontChar49,
/* 2 */ (const FontChar*)&Tahoma22FontChar50,
/* 3 */ (const FontChar*)&Tahoma22FontChar51,
/* 4 */ (const FontChar*)&Tahoma22FontChar52,
/* 5 */ (const FontChar*)&Tahoma22FontChar53,
/* 6 */ (const FontChar*)&Tahoma22FontChar54,
/* 7 */ (const FontChar*)&Tahoma22FontChar55,
/* 8 */ (const FontChar*)&Tahoma22FontChar56,
/* 9 */ (const FontChar*)&Tahoma22FontChar57
}
};

#endif

I can send you the application, but as others mentioned, there are legal
issues.

With regards,
Jan

----- Original Message -----
From: "Wouter van Ooijen"
To:
Sent: Tuesday, June 16, 2009 9:05 AM
Subject: [lpc2000] fonts for embedded systems
>I am working on a tool for writing RAM applications. I want to give the
> users an easy way to include a font (for use on a graphic LCD). So far I
> have managed to process TrueType and OpenType fonts (using Python/PIL)
> but the result is often not pleasant at smaller sizes.
>
> Are there any standard file formats for bitmapped fonst that I should
> consider?
>
> --
>
> Wouter van Ooijen
>
> -- -------
> Van Ooijen Technische Informatica: www.voti.nl
> consultancy, development, PICmicro products
> docent Hogeschool van Utrecht: www.voti.nl/hvu

Reply by monger_39 June 16, 20092009-06-16
--- In l..., Wouter van Ooijen wrote:
>
> >> I am working on a tool for writing RAM applications. I want to give
>
> I meant ARM applications...
>
> > If you need to manage a scalable font
>
> no, I want to provide the user an easy way tom include a bitmapped font
> into the application. So far ttf/otf seems to be an easy source of
> fonts. Note that all processing of the ttf/otf format into bitmaps is
> done on the PC, not in the ARM application.
>
> X11 pcf seems to be a standard for bitmapped fonts, but I have not found
> an abundance of free pcf fonts.

have you ever considered using the TeX fonts ?
see http://en.wikipedia.org/wiki/TeX_font_metric

bye, Mgr

>
> --
>
> Wouter van Ooijen
>
> -- -------
> Van Ooijen Technische Informatica: www.voti.nl
> consultancy, development, PICmicro products
> docent Hogeschool van Utrecht: www.voti.nl/hvu
>

Reply by Wouter van Ooijen June 16, 20092009-06-16
> Given that you have huge amounts of code space,

I don't want to assume that, my tool targets small chips too. And I
think rendering would take significant amounts of CPU too.

> A widespread bitmap font format is *.fon or *.fnt, both are used on
> Windows since eons (both formats where already in use with Windows 3.0).

That's the kind of answer I was looking for, I'll check those up.

--

Wouter van Ooijen

-- -------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu