Segger Logo Embedded Software Solutions
Software productsHardware productsDownloadsPricesCustomersOur PartnersSitemapForumAbout us
emWin: Font converter and editor
| Samples | Simulation | Font Converter | Bitmap Converter | Memory devices | Window Manager | Widgets | Dialogs | Multiple Layer/Displays | VNC Support | Touch Screen | Antialiasing | Drivers | Starter Boards | Virtual Screen Support | emWin Applications | PC Evaluation Versions |

Fonts which can be used with emWin must be defined as GUI_FONT structures in "C". The structures - or rather the font data which is referenced by these structures - can be rather large. It is very time-consuming and inefficient to generate these fonts manually. We therefore recommend using FontConvert, which automatically generates "C" files from fonts. The font converter is a Windows program which is easy to use. Simply load an installed Windows font into the program, edit it if you want or have to, and save it as a "C" file. The "C" file may then be compiled, allowing the font to be shown on your display with emWin on demand. The following is a sample screen shot of the font converter with a font loaded in normal (standard) mode:

Japanese Fonts

Using the font converter

The basic procedure for using the font converter is illustrated below.

Steps Screenshot
Step 1: Start the application.

The font converter is opened and automatically displays the Font generation options dialog box.
The same dialog box appears if File/New is chosen from the font converter menu at any point.
Step 2: Specify font generation options.

In this example, a font is to be generated in standard mode and with 16-bit Unicode encoding.
Click OK.
Step 3: Specify font options.

In this example, a regular-style, 10-point Arial font is chosen.
Click OK.
Step 4: Edit the font as necessary.

For more information please refer to the user's manual.
Step 5: Save the font as a "C" file.

Choose File/Save As.Select a destination and a name for the "C" file. The file type will be set to "C-files" by default.
Click Save.

The font converter will create a separate file in the specified destination, containing the "C" source code for the font.

Font generation options dialog

Type of font to generate

Standard
Creates a 1 bit per pixel font without antialiasing.

Antialiased, 2bpp
Creates an antialiased font using 2 bits per pixel.

Antialiased, 4bpp
Creates an antialiased font using 4 bits per pixel.

Encoding

16 Bit UNICODE
With Unicode encoding, you have access to all characters of a font. Windows font files contain a maximum of 65536 characters. All character codes of the "C" file are the same as those in the Windows font file.

8 Bit ASCII + ISO 8859
This encoding mode includes the ASCII codes (0x20 - 0x7F) and the ISO 8859 characters (0xA0 - 0xFF).

8/16 Bit SHIFT JIS
Shift JIS (Japanese Industry Standard) enables mapping from Unicode to Shift JIS in accordance with the Unicode standard 2. For example, the Katakana let- ter ieKUla is shifted from its Unicode value of 0x30AF to the Shift JIS value of 0x834E, the Kanji character 0x786F is shifted to 0x8CA5 and so on.

Antialiasing

You can choose between two ways of antialiasing. This choice only applies when an antialiased font type has been selected.

Using OS
The operating system is used to do the antialiasing. The resulting characters appear exactly the same as in any other windows application where antialiased characters are displayed.

Internal
The internal antialiasing routines of the font converter are used to do the antialiasing. The resulting characters are more exact with regard to proportions.

Sample "C"-code


/*
  C-file generated by emWin Font editor, compiled Jul 30 1999, 10:36:14

(c) 1998 SEGGER Microcontroller GmbH & Co.KG
         Tel.  49-2103-2878-0
         Fax.  49-2103-2878-28
         EMail info@segger.com
               www.segger.com

  Source file:
  Font:        CourierNew
  Height:      16
*/

#include "GUI.H"

/* 
  The following line needs to be included in any file selecting the
  font. A good place would be GUIConf.H
*/
extern const GUI_FONT FontCourierNew8x16;

const unsigned char acFontCourierNew8x16_32[16] =
/* code 32 */
{
  ________,
  ________,
  ________,
  ________,
  ________,
  ________,
  ________,
  ________,
  ________,
  ________,
  ________,
  ________,
  ________,
  ________,
  ________,
  ________
};

const unsigned char acFontCourierNew8x16_33[16] =
/* code 33 */
{
  ________,
  ________,
  ________,
  ________,
  ____X___,
  ____X___,
  ____X___,
  ____X___,
  ____X___,
  ________,
  ________,
  ____X___,
  ________,
  ________,
  ________,
  ________
};



....




const unsigned char acFontCourierNew8x16_48[16] =
/* code 48 */
{
  ________,
  ________,
  ________,
  ________,
  __XXXX__,
  _X____X_,
  _X____X_,
  _X____X_,
  _X____X_,
  _X____X_,
  _X____X_,
  __XXXX__,
  ________,
  ________,
  ________,
  ________
};

const unsigned char acFontCourierNew8x16_49[16] =
/* code 49 */
{
  ________,
  ________,
  ________,
  ________,
  ____X___,
  __XXX___,
  ____X___,
  ____X___,
  ____X___,
  ____X___,
  ____X___,
  __XXXXX_,
  ________,
  ________,
  ________,
  ________
};

const unsigned char acFontCourierNew8x16_50[16] =
/* code 50 */
{
  ________,
  ________,
  ________,
  ________,
  __XXX___,
  _X___X__,
  _____X__,
  ____X___,
  ___X____,
  __X_____,
  _X___X__,
  _XXXXX__,
  ________,
  ________,
  ________,
  ________
};

const unsigned char acFontCourierNew8x16_51[16] =
/* code 51 */
{
  ________,
  ________,
  ________,
  ________,
  __XXX___,
  _X___X__,
  _____X__,
  ___XX___,
  _____X__,
  _____X__,
  _X___X__,
  __XXX___,
  ________,
  ________,
  ________,
  ________
};

const unsigned char acFontCourierNew8x16_52[16] =
/* code 52 */
{
  ________,
  ________,
  ________,
  ________,
  ____XX__,
  ___X_X__,
  __X__X__,
  __X__X__,
  _XXXXXX_,
  _____X__,
  _____X__,
  ____XXX_,
  ________,
  ________,
  ________,
  ________
};


....


const unsigned char acFontCourierNew8x16_255[16] =
/* code 255 */
{
  ________,
  ________,
  ________,
  ________,
  ___X__X_,
  ________,
  _XXX_XXX,
  __X___X_,
  __X___X_,
  ___X_X__,
  ___X_X__,
  ____X___,
  ____X___,
  __XXX___,
  ________,
  ________
};



static const GUI_CHARINFO CharInfo[192] = {
  {   8,   8,  1, (void*)&acFontCourierNew8x16_32 }, /* code  32 */

  ...

  {   8,   8,  1, (void*)&acFontCourierNew8x16_127 }, /* code 127 */
  {   8,   8,  1, (void*)&acFontCourierNew8x16_160 }, /* code 160 */

  ...

  {   8,   8,  1, (void*)&acFontCourierNew8x16_255 } /* code 255 */
};

static const GUI_FONT_PROP FontProp2 = {
  160,            /* first character                */
  255,            /* last character                 */
  &CharInfo[96],  /* address of first character     */
  (void*)0        /* pointer to next GUI_FONT_PROP  */
};

static const GUI_FONT_PROP FontProp1 = {
   32,                  /* first character               */
  127,                  /* last character                */
  &CharInfo[0],         /* address of first character    */
  (void*)&FontProp2     /* pointer to next GUI_FONT_PROP */
};

const GUI_FONT FontCourierNew8x16 = {
  GUI_FONTTYPE_PROP,  /* type of font    */
  16,                 /* height of font  */
  16,                 /* space of font y */
   1,                 /* magnification x */
   1,                 /* magnification y */
  (void*)&FontProp1
};

Download the Font converter demo version

Copyright SEGGER Microcontroller GmbH & Co.KG. All rights reserved.
For more information, please visit our web site www.segger.com or contact us at info@segger.com
Last update: December 7, 2007