19264 GLC FONT HELP

General discussion on mikroPascal PRO for PIC.
Author
Message
pumper
Posts: 285
Joined: 10 Jan 2011 17:37

Re: 19264 GLC FONT HELP

#16 Post by pumper » 16 Apr 2021 13:13

I did not see any missing characters between H and e but I don't know what special characters should be between Z and a so
I added a dummy character just before a and now I get Hello on the GLCD.

The characters that are there before I added a dummy are [ \ ] ^ _ '

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: 19264 GLC FONT HELP

#17 Post by janni » 16 Apr 2021 15:15

Well, I don't know why your font file is wrong :( . I've checked the font against ASCII table and all characters are there. I've also checked against other fonts - they have same chars (except for the smallest one, 3x6, which does not have lower-case letters and for some reason always had '/' instead of '*' char). I've even run a program with this exact font on GLCD and it works flawlessly.

pumper
Posts: 285
Joined: 10 Jan 2011 17:37

Re: 19264 GLC FONT HELP

#18 Post by pumper » 18 Apr 2021 19:11

janni, I need some help with uGLCD.
In the standard Library I have used the GLCD_PARTIAL image function to draw the large number 2.

with uGLCD I am trying uGLCD_Icon function it draws something on the screen the correct size but it is not number 2.

I call it with this:

Located at the top of my program is this:

Code: Select all

#include "FONT_HEADER.h"
Then in my main loop is this:

Code: Select all

uGLCD_CancelRAMdraw;
uGLCD_Icon(0,0,40,40,uGLCD_dsNormal,&NUM2_40X40);
The Icon number 2 is this located in FONT_HEADER.h:

Code: Select all

const unsigned short NUM2_40X40[200] = {
//---------------------------------------NUM2-----------------------------------------------------
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x00, 0x00, 0x00};
Can you see what is wrong?

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: 19264 GLC FONT HELP

#19 Post by janni » 18 Apr 2021 22:12

How is the array organized? Consecutive bytes should represent 8-pixel columns (most significant bit corresponding to topmost pixel) so 40x40 icon would have 5 rows of 40 8-pixel columns. Just by looking at your array it seems to have different organization.

If you have a bitmap, to convert it to array you could use the Bitmap2Array program that comes with uGLCD library. Just remember to use 'Load icon' option if you intend to use the uGLCD_Icon function.

pumper
Posts: 285
Joined: 10 Jan 2011 17:37

Re: 19264 GLC FONT HELP

#20 Post by pumper » 18 Apr 2021 23:21

That array is arranged as little endianness, what you are telling me it needs to be big endianess with the most significant bit to topmost pixel.
I will correct that and try it.

Is uGLCD_Icon() the best way to display it? I did not see any other way that allows me to position it.

pumper
Posts: 285
Joined: 10 Jan 2011 17:37

Re: 19264 GLC FONT HELP

#21 Post by pumper » 18 Apr 2021 23:58

I can't find the Bitmap2Array program, where is it hiding?

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: 19264 GLC FONT HELP

#22 Post by janni » 19 Apr 2021 00:09

pumper wrote:
18 Apr 2021 23:21
Is uGLCD_Icon() the best way to display it? I did not see any other way that allows me to position it.
If you need to position it at just any point then that's the only way. There's also the uGLCD_Area function but it operates on 'pages', i.e. multiples of 8 bits in the vertical direction. In other words, the area cannot be just any size nor can it be placed at just any x,y coordinate.

And I have misled you, I'm afraid :( - screens and areas are organized as I described earlier. Icons are organized differently (can't remember now why, it was years ago) and I'll have to check the method.

As for the Bitmap2Array program, it's in the archive with the library packages, along with uGLCDfonts program that converts fonts produced by mE's GLCD font Creator.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: 19264 GLC FONT HELP

#23 Post by janni » 19 Apr 2021 00:27

It appears that 10 years is too long time for my memory to keep details :( . You were right as to the 'endian' - it's always the least significant bit that corresponds to the topmost pixel as the y-axis starts at the top. Screens and areas are drawn by 8-pixel columns in x-direction while icons, due to the fact that they may be of any height, are drawn from up to down, pixel by pixel. Hopefully, you will not have to remember that if you use the Bitmap2Array program.

pumper
Posts: 285
Joined: 10 Jan 2011 17:37

Re: 19264 GLC FONT HELP

#24 Post by pumper » 19 Apr 2021 02:27

I was just looking at your const unsigned char Arial19x32num[996] and I called it like this.

Code: Select all

uGLCD_Set_Font(&Arial19x32num);
uGLCD_Write_Text("25",0,0,uGLCD_tsWrite);
That's what I am looking for but a little larger and not necessarily the Arial font style.
I don't know much about the Font file that it has like how did it know how to find the number I called for.
Comment says it has an offset of 48 but the numbers start at 16.

I will investigate the GLCD Font Creator it says made the Font.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: 19264 GLC FONT HELP

#25 Post by janni » 19 Apr 2021 12:53

With special numerical fonts it's a bit more complicated than with complete fonts. Offset of 48 means that formally the font starts with '0', following the ASCII table (it doesn't mean that nothing will be displayed when using other character codes). To avoid the necessity to erase previous text (and thus increasing display flickering) a number font should have all number characters (and space character) of equal width. Some other useful characters, like mentioned space, digital dot, '-', or ':' have to be added and they won't be at places following the ASCII table so some string manipulation will be necessary to display them. See my post here.

pumper
Posts: 285
Joined: 10 Jan 2011 17:37

Re: 19264 GLC FONT HELP

#26 Post by pumper » 19 Apr 2021 15:00

I hate to keep bothering you but I can't find the archives folder or Bitmao2array can you post it here or PM me.
In the help file uGLCD Library\Fonts it talks about a program called uGLCDfonts can be used to change the fonts format I can't find that either.
I had windows search the entire computer for Bitmap2array with no luck.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: 19264 GLC FONT HELP

#27 Post by janni » 19 Apr 2021 15:09

Just download again the library uGLCDlib_mC.rar. The archive contains both executables.
In the help file uGLCD Library\Fonts...
Hm, I had time to prepare Help for mC? Unbelievable :roll: :) .

pumper
Posts: 285
Joined: 10 Jan 2011 17:37

Re: 19264 GLC FONT HELP

#28 Post by pumper » 19 Apr 2021 21:08

I downloaded the Library and found Bitmap2array, ran it and the the numbers are different but in my program it still showed garbage on the screen.

I decided to use a routine that came with my GLCD192x64 along with the uGLCD library and it displays as it should.
I have 40x40 and 24x24 fonts 11 characters each they take a lot of memory close to 3000 bytes of memory my PIC18F46K22 has 3875 bytes.
Is there a way to store the font in ROM?

The MikroC GLCD has GLCD_PartialImage that I have used on a similar project but with a 128x64 GLCD, it must store the bit maps somewhere besides RAM.
It uses very little of the PICs RAM.

Just for information
When I downloaded the Library I reinstalled the GLCD_font package before I saw the Bitmap2array program. After running my program I had to go and put
a char between the Capital letters and small letters in the font file like before.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: 19264 GLC FONT HELP

#29 Post by janni » 20 Apr 2021 00:13

There's obviously something wrong going on here - I used exactly same font without problem, like a lot of other people over the years. I've checked again with the font file attached to the archive for mC - there's nothing wrong with it. Do you have similar problem with other fixed fonts?

The Icon function works correctly with arrays produced by Bitmap2array - are you sure you used the 'Load icon' option while opening the bitmap?

As for keeping the fonts in RAM - nobody does that. Fonts are declared as constants and thus placed in Flash. Same concerns images. With the uGLCD library one may operate on a screen kept in RAM (a necessity with write-only displays and a good way to speed-up graphical functions for all displays), but the fonts and sources of images are still kept in program memory.

pumper
Posts: 285
Joined: 10 Jan 2011 17:37

Re: 19264 GLC FONT HELP

#30 Post by pumper » 20 Apr 2021 03:01

Here is the code that gives me the problem with Bold7x8. I tried system5x8 and system5x8v2 without a problem.
All fonts have the same count from M to i before I added a character in the Bold7x8 font.
I am confused as well, I will try some some other wrings in different location on my GLCD.

Code: Select all

uGLCD_Set_Font(&Bold7x8);
uGLCD_Write_Text("Miles",128,28,uGLCD_tsWrite);
I am sure I used the 'Load icon' with Bitmap2array but I will do some more test to be sure.

Post Reply

Return to “mikroPascal PRO for PIC General”