-3

I'm working on project which needs to display some string on lcd.

I created 2d-array having hex values corresponding to each characters which is working fine. But I am unable to figure outhow to display some character in BOLD.

char pixel[10][5] = { 
  {0x7E, 0x11, 0x11, 0x11, 0x7E},  // hex values to display A
  {0x7F, 0x49, 0x49, 0x49, 0x36}   //hex values to display B
};

using these hex value I get A and B on lcd display . But I need to display A and B (in bold).

gre_gor
  • 6,669
  • 9
  • 47
  • 52
  • What LCD display are you using? – brunorey Jan 29 '19 at 13:11
  • arduino lcd display – Vijay Dubey Jan 29 '19 at 13:16
  • 1
    You should add details about the display and the software you are using to the question, not only as a comment. "arduino lcd display" is probably not sufficient to describe the LCD. You should write the display type or include a link to technical data or to a description of the display. Showing some more code how you display the characters might also help to get your question answered properly. – Bodo Jan 29 '19 at 13:38
  • Some LCDs have controls for double height, italic, bold, etc. – Weather Vane Jan 29 '19 at 13:39
  • That's just a bitmap font. If you want it in bold, then you need a bold font. Unless you just double the width of the existing font. – gre_gor Jan 29 '19 at 17:48

1 Answers1

1

It looks like your pixel array contains pixel columns for a 5x7 or 5x8 character matrix with the lowest bit in the top line and the left column first.

The two lines seem to produce

.XXX. = bit x1
X...X = bit x2
X...X = bit x4
X...X = bit x8
XXXXX = bit 1x
X...X = bit 2x
X...X = bit 4x
..... = bit 8x

and

XXXX.
X...X
X...X
XXXX.
X...X
X...X
XXXX.
.....

To get bold characters you have to think about how these should be displayed. In a 5x7 matrix it might not be possible to display all letters in bold, e.g. M. For A and B you could try to use patterns/numbers for patterns like this:

.XXX.
XX.XX
XX.XX
XX.XX
XXXXX
XX.XX
XX.XX
.....

{0x7E, 0x7F, 0x11, 0x7F, 0x7E}

or

XXXX.
XX.XX
XX.XX
XXXX.
XX.XX
XX.XX
XXXX.
.....

{0x7F, 0x7F, 0x49, 0x7F, 0x36}

Automatic generation of bold characters

It is possible to automatically generate the font (character generator) for bold characters from the regular one if you have enough background pixels between the character pixels by shifting the dots to the right by one and using an combining original and shifted values with bitwise or.

This automatic generation for fixed width characters may be difficult for characters with 3 vertical lines because you would need 9 pixels for this to have 1 column for the inter-character space. A simple algorithm could clear the rightmost column if you want to have 8 pixels width, but manual modification might produce nicer results.

Example M regular

X.....X..
XX...XX..
X.X.X.X..
X..X..X..
X..X..X..
X..X..X..
X..X..X..

M shifted to the right

.X.....X.
.XX...XX.
.X.X.X.X.
.X..X..X.
.X..X..X.
.X..X..X.
.X..X..X.

M bitwise or

XX....XX.
XXX..XXX.
XXXXXXXX.
XX.XX.XX.
XX.XX.XX.
XX.XX.XX.
XX.XX.XX.
.........

M bitwise or, last column cleared

XX....X.
XXX..XX.
XXXXXXX.
XX.XX.X.
XX.XX.X.
XX.XX.X.
XX.XX.X.
........

A handmade correction for 8x8 looks nicer

XX...XX.
XXX.XXX.
XXXXXXX.
XX.X.XX.
XX.X.XX.
XX.X.XX.
XX.X.XX.
........

A library for LCD probably contains a font table. Maybe there are already existing libraries that support bold characters.

A search for "arduino lcd bold" brought this top result: https://forum.arduino.cc/index.php?topic=458712.0

Bodo
  • 9,287
  • 1
  • 13
  • 29
  • right now I am trying with 5*7 matrix. But I can also use 8*8 matrix for this purpose. So is there any method to generate hex value for all characters or I have to right them manually. – Vijay Dubey Jan 30 '19 at 05:27
  • Such a table is a typical character generator used for LCD or (historically) computers with a text only display. Probably there are already existing character generator tables for various purposes, but I don't know any links. I will add a paragraph about automatic generation of bold characters from regular ones to my answer. – Bodo Jan 30 '19 at 08:02