Space Character

GLCD Font Creator software is the ultimate solution to create personalized fonts, symbols and icons for Graphic LCDs. It generates code compatible with All mikroElektronika compilers
Post Reply
Author
Message
rrsquez
Posts: 117
Joined: 23 Feb 2011 21:35

Space Character

#1 Post by rrsquez » 22 Mar 2016 21:32

Hello. I used the GLCD Font Creator program to create my large font characters on my LCD. The only problem that I am having is that my "space" character (0x20, or 32 in decimal) doesn't print as wide as it should.

My font is set to be 21 pixels wide. My Space character is set to be 21 pixels wide too. Please see my picture (attached). There is a space character between the "60.0" and "PPM", but as you can see the space is not very well pronounced. It seems that I can't control that spacing without adding in another character (which I cannot do for reasons too complicated to explain here).

Attached is the font resource that I generated, as well as a picture showing my LCD with the problem on-screen.
To re-create:
  • Choose to create a font from an existing system font; "Impact".
    Choose "20" as the size.
    Elect to let the software remove common empty columns and rows.
I did have to massage a few characters, but "space" is all empty. I did verify that it is indeed 21 wide by 28 tall. The result is a font that is 21x28.

As you can see, the space character is not nearly as wide as one of the other characters like it should be. Please ignore the name 20x25. That's just the name of the font used in my program, and I didn't want to change it just yet. Does the font name I give it affect anything? My guess is "no", so long as I'm consistent.

Can someone please tell me how I can make my "space" character print out like the way I designed it in Font Creator: 21 pixels wide by 28 pixels tall?

This is the code used to write that data:

Code: Select all

     
   T6963C_Set_Font_Adv(&Impact20x25, T6963C_PIXEL, _T6963C_HORIZONTAL);    // large Impact font.
   T6963C_waitReady();
   T6963C_Write_Text_Adv(Msg, Column, Row);  // Msg is an array with my text message.
Thank you, Richard V
Attachments
Space Character Issue.zip
(1.42 MiB) Downloaded 245 times

User avatar
uros.cvetinovic
mikroElektronika team
Posts: 803
Joined: 14 Dec 2015 09:24

Re: Space Character

#2 Post by uros.cvetinovic » 23 Mar 2016 14:13

Hello Richard,

Space character generated by the GLCD Font Creator is about one pixel wide.
You could work around this problem by adding sequence of few space characters.

Another work around wold be to use VisualGLCD to generate font resource array.
In VisualGLCD Project Settings (Advanced settings>General) there is a 'One Pixel Space With' checkbox that you can uncheck and generate font resource with wider space character.

Try with this attached font.
It is just for testing.

Best regards,

Uros
Attachments
LargeFontResource.rar
(2.56 KiB) Downloaded 261 times

nigelmercier
Posts: 316
Joined: 23 Oct 2008 09:36

Re: Space Character

#3 Post by nigelmercier » 23 Mar 2016 15:05

Am I missing something? Surely space is exactly the same as any other character, but has no bits set?

rrsquez
Posts: 117
Joined: 23 Feb 2011 21:35

Re: Space Character

#4 Post by rrsquez » 23 Mar 2016 17:19

Hello. I agree with Nigel. My "space" character is 21x28 like all the other characters. I thought of just dropping in a "pixel" in a corner to force the space to render. I'm not happy with this though as it will make my displayed character look ugly.

Thank you Uros. I tried your font. It looks a little smaller than the one I wanted, but the space is still 1 pixel wide, as before.

I gave Visual GLCD a try, but it didn't work for me. I created a dummy project based on an existing board, but couldn't save it because this software isn't free. So I wasn't able to generate any code, or array.

I didn't want to get into the details of it, but I can't just drop in spaces. Sometime this messages is displayed as simple text, and the "space" character is "one character" wide.

This is a really tough problem. Below is the line of code that creates the space character:

Code: Select all

//This is from your file's "Space" character:
   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, // Code for char num 32


//This is my old file's "Space" character:
   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, // Code for char num 32
As you can see, they are exactly the same. Visual GLCD didn't help. It generates the same data.

Can we try something else?

Thank you, Richard V

rrsquez
Posts: 117
Joined: 23 Feb 2011 21:35

Re: Space Character

#5 Post by rrsquez » 23 Mar 2016 19:13

Hello all. I found a simple solution to my problem that I'd like to share. I'll start with the fix, then explain what is going on:

In short, here's the fix:
1) When creating the font, place a single pixel that will define how wide the space character is.
2) Generate the font and import it into the resource file for that font.
3) Go to the line with the label "Code for char num 32".
4) Nearly every entry on that line will be "0x00". One entry will differ because of that 1 pixel added. Change it to "0x00".
done.

Restate the problem; I want a space character that prints as wide as I want (up to character in width). The problem my space character only prints 1 pixel wide no matter what size the glyph actually is. Using Visual GLCD didn't help.

Experiment 1:
I tried an experiment that I didn't like. I put a single pixel in the corner where I wanted my space character to end (half a character wide). The new font worked rather well. I did have that annoying pixel in the corner, but it was small; still, I did't like it.

Experiment 2:
I did a new experiment. Without re-creating the font all over again, I just went to the line where my space character is defined ("32" is the first character by the way). I changed that "4" into a "0".

Now I get my space character the way I wanted it! That is the fix.

Code: Select all

// this was the original line that only prints 1 pixel wide:   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,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,0x00,0x00,0x00,0x00,0x00,0x04, // Code for char num 32

// This now works. Notice only 1 small change is made:    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,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,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 32

Working Theory:
Looking at other character glyphs, I realize that my small pixel in the space character actually affected other glyphs. I theorize that the extra bits that changed tell the glyph how to hand a space character either before or after that character. What I do know for certain is that I fixed this problem and don't have to live with a stray pixel that I don't want.

I present this post with the hope that someone else can benefit from this tidbit of knowledge.

Thank you, Richard V

User avatar
uros.cvetinovic
mikroElektronika team
Posts: 803
Joined: 14 Dec 2015 09:24

Re: Space Character

#6 Post by uros.cvetinovic » 24 Mar 2016 16:23

Hello Richard,

Space character generated by the GLCD Font Creator is narrower than other characters.

Thank you for sharing this solution!

As I said one more work around, if space character like this is not suitable for you, is adding sequence of few space characters.

Best regards,

Uros

rrsquez
Posts: 117
Joined: 23 Feb 2011 21:35

Re: Space Character

#7 Post by rrsquez » 25 Mar 2016 00:21

Hello Uros. Thank you for your suggestion, but I already mentioned that I can't just pad my string with spaces. This message string has an option to display it as "regular text", in which case the space character is 1 character wide.

Padding extra spaces pushes my data off-screen when I'm in "Text" mode. In "Large font" mode those extra space help, but only a little since the space is printed at a single pixel width.

Luckily my solution is a workaround that avoids this problem. Enjoy!

Richard V

Post Reply

Return to “GLCD Font Creator Software”