FontGen
   Multilingual
   Grayscale
   Graphics support
   Rotation
   Cross Platform
   Compression
   Release notes
   Get it
  
Keil LCD extension
Display library
FAQ

 

The display library for font/image definition files is offered to all FontGen users to simplify the integration process. It is tested with the Keil development environment, and provides the capability to draw the images and texts on LCD display. Download and navigate through the code to see how to use the FontGen generated source codes. It will take minutes to be able to have different fonts on your LCD as long as you have the driver for the LCD controller.

It does not include the LCD controller drivers except a simple T6963C driver, therefore the basic access routines should be implemented by the user.

The code only works for 1-bit color depth.

Interface

/* prints the given string 
      left: x position to print the text
      top:  y position to print the text
      font: index of the font to be used in the fonts[] array
      str:  points to the string to be printed
 */
void lcd_text(coord left, coord top, unsigned char font, glyph_t *str);

/* paints the given image
      left: x position
      top:  y position
      img:  pointer to the image to be printed
 */
void lcd_pic(coord left, coord top, struct IMG_DEF *img);

/* fills the given area
      left:   x1 position 
      top:    y1 position
      right:  x2 position
      bottom: y2 position
 */
void lcd_fill_rect(coord left,  coord top,
                   coord right, coord bottom);

/* clears the given area
      left:   x1 position
      top:    y1 position
      right:  x2 position
      bottom: y2 position
 */
void lcd_clear_rect(coord left,  coord top,
                    coord right, coord bottom);

/* draws a horizontal line
      left:   x1 position
      right:  x2 position
      row:    y position
 */
void lcd_horz_line(coord left, coord right, coord row);

/* draws a vertical line
      top:    y1 position
      bottom: y2 position
      column: x position
 */
void lcd_vert_line(coord top, coord bottom, coord column);

/* draws a box
      left:   x1 position
      top:    y1 position
      right:  x2 position
      bottom: y2 position
 */
void lcd_box(coord left, coord top,
             coord right, coord bottom);

// Initializes the internal data of the display library   
void lcd_init_lib();

Initialization

User should call lcd_init_lib() function before any access to the library. This function initializes the internal data of the library.

User is also expected to set the fonts[] array with the intended font definitions, since display library refers to this array while printing a text on the LCD buffer.

Make sure that you've updated SCREEN_WIDTH and SCREEN_HEIGHT constants to reflect the size of your LCD. SCREEN_WIDTH is expected to be multiple of 8.

Actual display update

This library updates the screen buffer in the XDATA memory for each utility function called. Since the LCD is not updated for each pixel set/reset, the functions execute faster; but the user must perform the LCD display update whenever he's ready to do so.

The LCD update function is not implemented as a part of the library since this part can be LCD controller specific. It can use the auto increment mode supported by T6963C for this controller, and use other methods for the controller which does not support this mode.

The example code has a sample update function for T6963C, and this is called once the screen buffer is ready to be displayed.

Example code

A sample example code is provided for the demonstration of the library. The library can be verified with integration of the Keil LCD extension. The output of the LCD will be as in the following picture.

Release notes

v1.0: Initial release
v1.1: Updated to support negative advance width, and offset values. Updated to support FontGen v2.40

Copyright 2006-2015 - dreamsware - info@dreamsware.info