Remove space between two characters in any font library

How to remove one vertical LED row between two characters in font library.

Please help me with solution.

(deleted)

Use a font that is one pixel narrower?

Display the first character, move left one pixel, and then display the second character?

spycatcher2k:
Sure, just change line 125 in the code you posted! (See the hint) :slight_smile:

I thought it was line 42...

Avontec:
How to remove one vertical LED row between two characters in font library.

Please help me with solution.

We would need to see the complete sketch and the font library to answer that. Something in the code is placing the spacing between characters, but how to modify that to narrow the spacing is dependent on exactly how it is being done.

<<

/*
*
* System5x7
*
*
* File Name           : System5x7.h
* Date                : 28 Oct 2008
* Font size in bytes  : 470
* Font width          : 5
* Font height         : 7
* Font first char     : 32
* Font last char      : 127
* Font used chars     : 94
*
* The font data are defined as
*
* struct _FONT_ {
*     uint16_t   font_Size_in_Bytes_over_all_included_Size_it_self;
*     uint8_t    font_Width_in_Pixel_for_fixed_drawing;
*     uint8_t    font_Height_in_Pixel_for_all_characters;
*     unit8_t    font_First_Char;
*     uint8_t    font_Char_Count;
*
*     uint8_t    font_Char_Widths[font_Last_Char - font_First_Char +1];
*                  // for each character the separate width in pixels,
*                  // characters < 128 have an implicit virtual right empty row
*
*     uint8_t    font_data[];
*                  // bit field of all characters
*/

#include <inttypes.h>
#include <avr/pgmspace.h>

#ifndef SYSTEM5x7_H
#define SYSTEM5x7_H

#define SYSTEM5x7_WIDTH 5
#define SYSTEM5x7_HEIGHT 7

/*
* added to allow fontname to match header file name. 
* as well as keep the old name for backward compability
*/

#define SystemFont5x7 System5x7

const static uint8_t System5x7[] PROGMEM = {
   0x0, 0x0, // size of zero indicates fixed width font, actual length is width * height
   0x05, // width
   0x07, // height
   0x20, // first char
   0x60, // char count
   
   // Fixed width; char width table not used !!!!
   
   // font data
   0x00, 0x00, 0x00, 0x00, 0x00,// (space)
0x00, 0x00, 0x5F, 0x00, 0x00,// !
0x00, 0x07, 0x00, 0x07, 0x00,// "
0x14, 0x7F, 0x14, 0x7F, 0x14,// #
0x24, 0x2A, 0x7F, 0x2A, 0x12,// $
0x23, 0x13, 0x08, 0x64, 0x62,// %
0x36, 0x49, 0x55, 0x22, 0x50,// &
0x00, 0x05, 0x03, 0x00, 0x00,// '
0x00, 0x1C, 0x22, 0x41, 0x00,// (
0x00, 0x41, 0x22, 0x1C, 0x00,// )
0x08, 0x2A, 0x1C, 0x2A, 0x08,// *
0x08, 0x08, 0x3E, 0x08, 0x08,// +
0x00, 0x50, 0x30, 0x00, 0x00,// ,
0x08, 0x08, 0x08, 0x08, 0x08,// -
0x00, 0x60, 0x60, 0x00, 0x00,// .
0x20, 0x10, 0x08, 0x04, 0x02,// /
0x3E, 0x51, 0x49, 0x45, 0x3E,// 0
0x00, 0x42, 0x7F, 0x40, 0x00,// 1
0x42, 0x61, 0x51, 0x49, 0x46,// 2
0x21, 0x41, 0x45, 0x4B, 0x31,// 3
0x18, 0x14, 0x12, 0x7F, 0x10,// 4
0x27, 0x45, 0x45, 0x45, 0x39,// 5
0x3C, 0x4A, 0x49, 0x49, 0x30,// 6
0x01, 0x71, 0x09, 0x05, 0x03,// 7
0x36, 0x49, 0x49, 0x49, 0x36,// 8
0x06, 0x49, 0x49, 0x29, 0x1E,// 9
0x00, 0x36, 0x36, 0x00, 0x00,// :
0x00, 0x56, 0x36, 0x00, 0x00,// ;
0x00, 0x08, 0x14, 0x22, 0x41,// <
0x14, 0x14, 0x14, 0x14, 0x14,// =
0x41, 0x22, 0x14, 0x08, 0x00,// >
0x02, 0x01, 0x51, 0x09, 0x06,// ?
0x32, 0x49, 0x79, 0x41, 0x3E,// @
0x7E, 0x11, 0x11, 0x11, 0x7E, //A

0x7F, 0x49, 0x49, 0x49, 0x36,// B
0x3E, 0x41, 0x41, 0x41, 0x22,// C
0x7F, 0x41, 0x41, 0x22, 0x1C,// D
0x7F, 0x49, 0x49, 0x49, 0x41,// E
0x7F, 0x09, 0x09, 0x01, 0x01,// F
0x3E, 0x41, 0x41, 0x51, 0x32,// G
0x7F, 0x08, 0x08, 0x08, 0x7F,// H
0x00, 0x41, 0x7F, 0x41, 0x00,// I
0x20, 0x40, 0x41, 0x3F, 0x01,// J
0x7F, 0x08, 0x14, 0x22, 0x41,// K
0x7F, 0x40, 0x40, 0x40, 0x40,// L
0x7F, 0x02, 0x04, 0x02, 0x7F,// M
0x7F, 0x04, 0x08, 0x10, 0x7F,// N
0x3E, 0x41, 0x41, 0x41, 0x3E,// O
0x7F, 0x09, 0x09, 0x09, 0x06,// P
0x3E, 0x41, 0x51, 0x21, 0x5E,// Q
0x7F, 0x09, 0x19, 0x29, 0x46,// R
0x46, 0x49, 0x49, 0x49, 0x31,// S
0x01, 0x01, 0x7F, 0x01, 0x01,// T
0x3F, 0x40, 0x40, 0x40, 0x3F,// U
0x1F, 0x20, 0x40, 0x20, 0x1F,// V
0x7F, 0x20, 0x18, 0x20, 0x7F,// W
0x63, 0x14, 0x08, 0x14, 0x63,// X
0x03, 0x04, 0x78, 0x04, 0x03,// Y
0x61, 0x51, 0x49, 0x45, 0x43,// Z
0x00, 0x00, 0x7F, 0x41, 0x41,// [
 0x02, 0x04, 0x08, 0x10, 0x20,// "\"
 0x41, 0x41, 0x7F, 0x00, 0x00,// ]
0x04, 0x02, 0x01, 0x02, 0x04,// ^
0x40, 0x40, 0x40, 0x40, 0x40,// _
0x00, 0x01, 0x02, 0x04, 0x00,// `
0x20, 0x54, 0x54, 0x54, 0x78,// a
0x7F, 0x48, 0x44, 0x44, 0x38,// b
0x38, 0x44, 0x44, 0x44, 0x20,// c
0x38, 0x44, 0x44, 0x48, 0x7F,// d
0x38, 0x54, 0x54, 0x54, 0x18,// e
0x08, 0x7E, 0x09, 0x01, 0x02,// f
0x08, 0x14, 0x54, 0x54, 0x3C,// g
0x7F, 0x08, 0x04, 0x04, 0x78,// h
0x00, 0x44, 0x7D, 0x40, 0x00,// i
0x20, 0x40, 0x44, 0x3D, 0x00,// j
0x00, 0x7F, 0x10, 0x28, 0x44,// k
0x00, 0x41, 0x7F, 0x40, 0x00,// l
0x7C, 0x04, 0x18, 0x04, 0x78,// m
0x7C, 0x08, 0x04, 0x04, 0x78,// n
0x38, 0x44, 0x44, 0x44, 0x38,// o
0x7C, 0x14, 0x14, 0x14, 0x08,// p
0x08, 0x14, 0x14, 0x18, 0x7C,// q
0x7C, 0x08, 0x04, 0x04, 0x08,// r
0x48, 0x54, 0x54, 0x54, 0x20,// s
0x04, 0x3F, 0x44, 0x40, 0x20,// t
0x3C, 0x40, 0x40, 0x20, 0x7C,// u
0x1C, 0x20, 0x40, 0x20, 0x1C,// v
0x3C, 0x40, 0x30, 0x40, 0x3C,// w
0x44, 0x28, 0x10, 0x28, 0x44,// x
0x0C, 0x50, 0x50, 0x50, 0x3C,// y
0x44, 0x64, 0x54, 0x4C, 0x44,// z
0x00, 0x08, 0x36, 0x41, 0x00,// {
0x00, 0x00, 0x7F, 0x00, 0x00,// |
0x00, 0x41, 0x36, 0x08, 0x00,// }
0x08, 0x08, 0x2A, 0x1C, 0x08,// ->
0x08, 0x1C, 0x2A, 0x08, 0x08 // <-
   
};

#endif

johnwasser:
Use a font that is one pixel narrower?

Display the first character, move left one pixel, and then display the second character?

Sir am unable to move the character ..if i do so ...it is displaying something wierd..

Actually I want 4 rows and 5 columns but available library is 5r x 7c.

Please help me

2 things:

  • first, read the forum rules to understand how to post code correctly and fix your post #5 accordingly

  • second, understand how font are designed. it's in the header of the font file you are using.

struct _FONT_ {
 *     uint16_t   font_Size_in_Bytes_over_all_included_Size_it_self;
 *     uint8_t    font_Width_in_Pixel_for_fixed_drawing;
 *     uint8_t    font_Height_in_Pixel_for_all_characters;
 *     unit8_t    font_First_Char;
 *     uint8_t    font_Char_Count;
 *
 *     uint8_t    font_Char_Widths[font_Last_Char - font_First_Char +1];
 *                  // for each character the separate width in pixels,
 *                  // characters < 128 have an implicit virtual right empty row
 *
 *     uint8_t    font_data[];
 *                  // bit field of all characters

then look at what you have at the start of the file:

0x0, 0x0, // size of zero indicates [b][color=red]fixed width font[/color][/b], actual length is width * height[color=red][b]
0x05, // width
0x07, // height[/b][/color]
0x20, // first char
0x60, // char count
   
[color=red][b]// Fixed width; char width table not used !!!![/b][/color]
...

so you have a fixed width font, where each character is 5 pixel wide and 7 pixel high.

now if you go further in the font description, and pick a few lines, say the ones commented as '!' or '(' or '9' and have a look at where you have 0 and 1 in binary form, you can recognize something like this:

bang.png

nine.png

if you turn a bit your head, you should recognize the pictogram.

Now you want a fixed width 4x5 font, so you should understand how to describe the header of the file and then how to draw each character is up to you, using the same approach as above

bang.png

nine.png

J-M-L:
2 things:

  • first, read the forum rules to understand how to post code correctly and fix your post #5 accordingly

  • second, understand how font are designed. it's in the header of the font file you are using.

struct _FONT_ {

*    uint16_t  font_Size_in_Bytes_over_all_included_Size_it_self;
*    uint8_t    font_Width_in_Pixel_for_fixed_drawing;
*    uint8_t    font_Height_in_Pixel_for_all_characters;
*    unit8_t    font_First_Char;
*    uint8_t    font_Char_Count;
*
*    uint8_t    font_Char_Widths[font_Last_Char - font_First_Char +1];
*                  // for each character the separate width in pixels,
*                  // characters < 128 have an implicit virtual right empty row
*
*    uint8_t    font_data[];
*                  // bit field of all characters





then look at what you have at the start of the file:


0x0, 0x0, // size of zero indicates fixed width font, actual length is width * height
0x05, // width
0x07, // height

0x20, // first char
0x60, // char count
 
// Fixed width; char width table not used !!!!
...




so you have a fixed width font, where each character is 5 pixel wide and 7 pixel high.

now if you go further in the font description, and pick a few lines, say the ones commented as '!' or '(' or '9' and have a look at where you have 0 and 1 in binary form, you can recognize something like this:

![bang.png|679x180](upload://waWo9bmHqRxHuaNyMpj2QFIn4kB.png)

![par.png|701x180](upload://7pZq4fRJe9xhlG1rgyEzUah0PYt.png)

![nine.png|662x180](upload://s5N9qnXmxpTWscYj4aro2RH4ZJD.png)

if you turn a bit your head, you should recognize the pictogram.

Now you want a fixed width 4x5 font, so you should understand how to describe the header of the file and then how to draw each character is up to you, using the same approach as above

Sir,
Thanks alot ...I got the pictorial view.
I changed the width to 4 and height to 5 .
But M not getting the rite characters.

what didn't you get in this first ask?

"- first, read the forum rules to understand how to post code correctly and fix your post #5 accordingly"

seems you just don't show respect for the forum, it's all about your needs. good luck.

J-M-L:
what didn't you get in this first ask?

"- first, read the forum rules to understand how to post code correctly and fix your post #5 accordingly"

seems you just don't show respect for the forum, it's all about your needs. good luck.

Sir,
Sorry Sir... I am new to forum.
I'll follow the rules henceforth.
I have made changes to Post#5

johnwasser:
Use a font that is one pixel narrower?

Display the first character, move left one pixel, and then display the second character?

Sir,
Shifting will not help...because I am writing a 4x5 font library.
And by default its adding a single LED row between 2 characters.(in case of 5x7 font) and 2 LED rows (in case of 4x5 font)

Avontec:
Sir,
Sorry Sir... I am new to forum.
I'll follow the rules henceforth.
I have made changes to Post#5

you did not.

Avontec:
Actually I want 4 rows and 5 columns but available library is 5r x 7c.

Please help me

To turn the 5x7 font into a 4x5 font you would start by changing the column count to 4 and the row count to 5. Then you have to remove one byte from every row so the data lines up. I provide an example below.

Then you have to figure o9out how you are going to represent each character in 20 dots (four bytes for columns using just the bottom five bits of each byte).

/*
  System4x5


  File Name           : System4x5.h
  Date                : 28 Oct 2008
  Font size in bytes  : 94*4=376
  Font width          : 4
  Font height         : 5
  Font first char     : 32
  Font last char      : 127
  Font used chars     : 94

  The font data are defined as

  struct _FONT_ {
      uint16_t   font_Size_in_Bytes_over_all_included_Size_it_self;
      uint8_t    font_Width_in_Pixel_for_fixed_drawing;
      uint8_t    font_Height_in_Pixel_for_all_characters;
      unit8_t    font_First_Char;
      uint8_t    font_Char_Count;

      uint8_t    font_Char_Widths[font_Last_Char - font_First_Char +1];
                   // for each character the separate width in pixels,
                   // characters < 128 have an implicit virtual right empty row

      uint8_t    font_data[];
                   // bit field of all characters
*/

#include <inttypes.h>
#include <avr/pgmspace.h>

#ifndef SYSTEM4x5_H
#define SYSTEM4x5_H

#define SYSTEM4x5_WIDTH 4
#define SYSTEM4x5_HEIGHT 7

/*
  added to allow fontname to match header file name.
  as well as keep the old name for backward compability
*/

#define SystemFont4x5 System4x5

const static uint8_t System5x7[] PROGMEM =
{
  0x0, 0x0, // size of zero indicates fixed width font, actual length is width * height
  0x04, // width
  0x05, // height
  0x20, // first char
  0x60, // char count

  // Fixed width; char width table not used !!!!

  // font data
  0x00, 0x00, 0x00, 0x00,// (space)
  0x00, 0x00, 0x5F, 0x00,// !
  0x00, 0x07, 0x00, 0x07,// "
  0x14, 0x7F, 0x14, 0x7F,// #
  0x24, 0x2A, 0x7F, 0x2A,// $
  0x23, 0x13, 0x08, 0x64,// %
  0x36, 0x49, 0x55, 0x22,// &
  0x00, 0x05, 0x03, 0x00,// '
  0x00, 0x1C, 0x22, 0x41,// (
  0x00, 0x41, 0x22, 0x1C,// )
 .
 .
 .
  0x0C, 0x50, 0x50, 0x50,// y
  0x44, 0x64, 0x54, 0x4C,// z
  0x00, 0x08, 0x36, 0x41,// {
  0x00, 0x00, 0x7F, 0x00,// |
  0x00, 0x41, 0x36, 0x08,// }
  0x08, 0x08, 0x2A, 0x1C,// ->
  0x08, 0x1C, 0x2A, 0x08,// <-

};

#endif

johnwasser:
To turn the 5x7 font into a 4x5 font you would start by changing the column count to 4 and the row count to 5. Then you have to remove one byte from every row so the data lines up. I provide an example below.

Then you have to figure o9out how you are going to represent each character in 20 dots (four bytes for columns using just the bottom five bits of each byte).

/*

System4x5

File Name          : System4x5.h
  Date                : 28 Oct 2008
  Font size in bytes  : 94*4=376
  Font width          : 4
  Font height        : 5
  Font first char    : 32
  Font last char      : 127
  Font used chars    : 94

The font data are defined as

struct FONT {
      uint16_t  font_Size_in_Bytes_over_all_included_Size_it_self;
      uint8_t    font_Width_in_Pixel_for_fixed_drawing;
      uint8_t    font_Height_in_Pixel_for_all_characters;
      unit8_t    font_First_Char;
      uint8_t    font_Char_Count;

uint8_t    font_Char_Widths[font_Last_Char - font_First_Char +1];
                  // for each character the separate width in pixels,
                  // characters < 128 have an implicit virtual right empty row

uint8_t    font_data[];
                  // bit field of all characters
*/

#include <inttypes.h>
#include <avr/pgmspace.h>

#ifndef SYSTEM4x5_H
#define SYSTEM4x5_H

#define SYSTEM4x5_WIDTH 4
#define SYSTEM4x5_HEIGHT 7

/*
  added to allow fontname to match header file name.
  as well as keep the old name for backward compability
*/

#define SystemFont4x5 System4x5

const static uint8_t System5x7[] PROGMEM =
{
  0x0, 0x0, // size of zero indicates fixed width font, actual length is width * height
  0x04, // width
  0x05, // height
  0x20, // first char
  0x60, // char count

// Fixed width; char width table not used !!!!

// font data
  0x00, 0x00, 0x00, 0x00,// (space)
  0x00, 0x00, 0x5F, 0x00,// !
  0x00, 0x07, 0x00, 0x07,// "
  0x14, 0x7F, 0x14, 0x7F,// #
  0x24, 0x2A, 0x7F, 0x2A,// $
  0x23, 0x13, 0x08, 0x64,// %
  0x36, 0x49, 0x55, 0x22,// &
  0x00, 0x05, 0x03, 0x00,// '
  0x00, 0x1C, 0x22, 0x41,// (
  0x00, 0x41, 0x22, 0x1C,// )
.
.
.
  0x0C, 0x50, 0x50, 0x50,// y
  0x44, 0x64, 0x54, 0x4C,// z
  0x00, 0x08, 0x36, 0x41,// {
  0x00, 0x00, 0x7F, 0x00,// |
  0x00, 0x41, 0x36, 0x08,// }
  0x08, 0x08, 0x2A, 0x1C,// ->
  0x08, 0x1C, 0x2A, 0x08,// <-

};

#endif

Sir,
I tried the same procedure ....
But M getting the following display

Sir,
I got the following weird something on display
one LED row is skipped for each character ( because of default space between two characters)

Your post #5 is still ugly

J-M-L:
you did not.

I tried sir...May be its not updated.

I see you tried but you failed...

You have put the closing [/code] tag right after the opening one

your post content looks like this

[code][/code]

<<
/*
*

  • System5x7
  • File Name : System5x7.h
  • Date : 28 Oct 2008
  • Font size in bytes : 470
  • Font width : 5
  • Font height : 7
    ...

the closing tag needs to go AFTER the code...


for your stuff to work you need to design each of your own characters... pixel by pixel. to fit in the 2D bitmap of your selected size

J-M-L:
I see you tried but you failed...

You have put the closing [/code] tag right after the opening one

your post content looks like this

[code][/code]

<<
/*
*

  • System5x7
  • File Name : System5x7.h
  • Date : 28 Oct 2008
  • Font size in bytes : 470
  • Font width : 5
  • Font height : 7
    ...

the closing tag needs to go AFTER the code...


for your stuff to work you need to design each of your own characters... pixel by pixel. to fit in the 2D bitmap of your selected size

Thanks Sir,
1] I'll change the #Post5
2] I am designing each character pixel by pixel using Link- LED Matrix Editor
but I am unable to fit the characters in 4x5 font...Consider Character A- Hex value is (0x1E,0x05,0x05,0x1E)

3] Its displaying random wierd something.