XGLCD Font Creator Problem

General discussion on mikroBasic.
Post Reply
Author
Message
OldSpring
Posts: 134
Joined: 07 Feb 2007 00:01

XGLCD Font Creator Problem

#1 Post by OldSpring » 28 Dec 2007 19:08

Octal;

I'm very interested your XGLCD Font Creator. I want to make a counter for my project. But the numbers that were displayed on screen were not good enough for me. I'm wondering if your xGLCD_Lib or my test code has problem. Could you help me to solve this problem?

Thank you.

Below is my test code:
(18F452, 8MHz)

Code: Select all

program MyNewFont

include"xGLCD_Lib"
include "propfont"
include"xGLCDCommon"

dim  ii as byte
dim  someText as string[20]
dim temp_str as string[5]

main:
Glcd_Init(PORTB, 2, 3, 4, 5, 7, 6, PORTD)
Glcd_Fill(0x00)
   XGlcd_Set_Font(@Comic_Sans_MS22x26, 22,26,32)

  while true
   inc(ii)
   WordToStrWithZeros(ii,temp_str)
   someText = temp_str
   XGlcd_write_text(someText,33,10,1)   'Write counter value
   XGlcd_write_text(someText,33,30,2)
    delay_ms(1000)
  wend
  
end.

Screen pictures:
Image
Image
Image
Image
Image

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

#2 Post by LGR » 28 Dec 2007 21:27

Octal has a site and a forum:

http://www.pocketmt.com/

You should ask there.
If you know what you're doing, you're not learning anything.

octal
Posts: 534
Joined: 09 Feb 2005 14:15
Location: France
Contact:

#3 Post by octal » 28 Dec 2007 23:16

Hi OldSpring,
There is NO problem with XGlcd nor with the fonts. You are suffering from a "traditional" problem that all users of "PROPORTIONAL" fonts face first time. I already posted details of this behaviour on XGLCD Forum. here is the details again on this forum. This may be helpfull for other users:

What you are experiencing is not a bug, it's a misunderstanding of the side effects of using Proportional width fonts.
All chars have NOT the same width, not like fixed font width provided with original mE GLCD Lib.
So if you draw 0, and draw 1 on top of it, even if the transparency is not set, the "0" is wider than "1" (more pixels in x direction), so drawing "1" will not completely erase "0" pixels.

Now When you draw a blank line on top of chars, blanks (char #32) will also not have the same width of "0" or "W" ... sot this also not is the correct way to do it.

The solution:

I gave an example with the lib that shows a counter... and it works fine ;)

the functions xGLCD_Write_text() and xGLCD_Write_Char() have a parameter COLOR (last param) that says if we must set/clear/invert pixels.

You have to draw a text with the color xColorSet (=1)
You have to erase it NOT by drawing Blanks, but by drawing the SAME TEXT with xColorClear (=0) ... this garantee that you have deleted all chars and thus cleared all their pixels...
and thus you can draw the new text ....

Code: Select all

while (1==1) // infinite loop
{
  // we get time
  currentTimeText = ......  <<< Some text like a counter for example
  // we draw time
  xGlcd_Write_Text(currentTimeText, 20, 20, xColorSet);
  delayms(1000) ....  
  // we delete/erase our time by drawing the same text in xColorClear mode.
  
  xGlcd_Write_Text(currentTimeText, 20, 20, xColorClear);
  // we are ready for next loop.
}

xColorSet and xColorClear are constants defined in xglcd_lib.

You should have a deep look at the last loop in the example project I gave with XGlcd Lib.

Regards
Octal
http://www.pocketmt.com

OldSpring
Posts: 134
Joined: 07 Feb 2007 00:01

#4 Post by OldSpring » 29 Dec 2007 17:53

Octal;

Thank you so much for you send this detail information to me.

I will look at your test code and XClcd Lib.

Thx again!

octal
Posts: 534
Joined: 09 Feb 2005 14:15
Location: France
Contact:

#5 Post by octal » 30 Dec 2007 00:49

You are welcome :o
Please, let me know if it worked for you or no.

Regards
octal
http://www.pocketmt.com

OldSpring
Posts: 134
Joined: 07 Feb 2007 00:01

#6 Post by OldSpring » 02 Jan 2008 20:08

Hi, Octal;

I have read your XGlcd information. I'm still confusing about your Lib. when same size fonts were displayed on screen with different color, they would show different size.

For example: when it use color = xColorSet, it is ok. But when it use color = xColorInvert, it would show totally different size.

Can you solve this problem for me?

Thanks.

Below is picture;
Image

octal
Posts: 534
Joined: 09 Feb 2005 14:15
Location: France
Contact:

#7 Post by octal » 02 Jan 2008 22:04

I do not think the fonts are of different sizes. The size is the same (height). In the screenshot you are showing, (I think that) your normal font is as height as the INVERTED font. the only thing is that the inverted font is drawn ON TOP of the low line of the normal font (overlapping chars). You cant see that because you are drawing only numbers, which are all drawn on top of the base line of the font.

Try to draw (in the normal font) a char like "g" or "p", you'll see that you are writing on top of it (overlap) with the inverted font.

Instead, try to use transparency, or,if you are using only numbers, try to keep only numbers in your font, and use "Optimize" option of GLCD font creator to remove all blank lines at the bottom of the font. This will make all fonts chars approximatively the same heigh, and will let you avoid the overlapping problem you have.

PS. Most users makes specific fonts containing only NUMBERS for things like counters and time showing, this makes proportional font looks nice.

Regards
octal
http://www.pocketmt.com

OldSpring
Posts: 134
Joined: 07 Feb 2007 00:01

#8 Post by OldSpring » 03 Jan 2008 00:46

Octal;

Thank you very much for you fast reply.

I will try to make a non blank line font when it is set xcolorinvert.

Thx again!

majerv
Posts: 26
Joined: 26 Sep 2008 00:54

#9 Post by majerv » 06 Nov 2008 22:37

Hi Octal!

When I invert the characters I can see black pixels under the characters, like on the above pictures. These unwanted pixels overwrite the texts displayed former too. Is it normal?

Thanx, majerv

fvgm
Posts: 96
Joined: 30 Oct 2007 16:16
Location: Brazil

Re: XGLCD Font Creator Problem

#10 Post by fvgm » 08 Dec 2011 20:51

octal

Thanks, i tried your solution, and it works fine!!
This trick solved my problem.

thanks.

Post Reply

Return to “mikroBasic General”