Hi guys,
been having a play with one of my programs, and as usual, ran out of space.
Had a look into and a play with the fonts.
I'm not sure that Albert would agree with me on this one but it seems to work as long as you stick to one rule.
That rule being that you DON'T use some fonts that will not exist, and that's it.
I wanted to use different fonts for different things in the screen, but using an 8535, limited me in a big way.
One of the fonts was the 16x16 which takes a huge amount of space on it's own, but the only characters I wanted out of the set was 0-9.
So I set about doing some experiments.
Took a copy of the 16x16 font so that I could modify it.
I deleted all the def's [b:cad2de4f7b]after[/b:cad2de4f7b] the numbers in the font table, it reduced the space required by a huge amount, and still worked.
I decided to see what would happen if I choose a character that now didn't exist in the table, like a capital "A". What I got was a weird pattern that
looked nothing like an "A" as expected,as I had deleted it, and I didn't care, as I wasn't going to use those characters anyway Right ?, Wrong.
I did actually want a [b:cad2de4f7b]capital "A" and a "V"[/b:cad2de4f7b]. "A" for amps, and "V" for volts.
What I did, was copy the "V" def from the original of the 16x16 Font, and placed it in the "#" location in my modified table.
Took the "A" from the original of the 16x16 Font, and placed it in the "!" location in my modified table.
Now hopefully I had the two Alpha characters and number that I wanted but not the rest. Of course, you cant delete the characters before the numbers
in the table, because that would put all the numbers (characters) way out of wack.
Gave it a try, in the 8535, and it all worked as I hoped it would. Doesn't seem to have any ill effects, other than the random shapes if you
select a non existent character.
Attached is a pic
In that pic, there are three different fonts 16x16, 8x8 & 8x5 and with all of them loaded, and the graphic code for the LCD, it came to 48%.
I assume that the funny characters are the font routine picking up some code that is in place of the missing font table and what if any consequences
that might have, [i:cad2de4f7b]maybe Albert could fill use in on that point[/i:cad2de4f7b].
But as mentioned, it all seems to work as it should even if I do intentionally put in a non existent character.
The graphic code and the unmodified 16x16 came to 44% code space used
The graphic code and the modified all characters after [b:cad2de4f7b]numbers [/b:cad2de4f7b] removed 16x16 came to 17% code space used
Now to use the "V" in the code, I type and "#", to use the "A" I use the "[size=18:cad2de4f7b]![/size:cad2de4f7b]" like the code below
This might help someone with their code space
Setfont Font8x5
Dim Char As Byte , L As Byte , C As Byte
Cls
Setfont Font16x16
Lcdat 1 , 1 , "12.5#" 'the # is a relocated upper case "V" in this font only
Lcdat 3 , 1 , "1.5!" 'the ! is a relocated upper case "A" in this font only
Setfont Font8x5
Lcdat 5 , 8 , "F1 5.5V! F2 3.3V"
Lcdat 6 , 8 , "F3 5.5V F4 -5.5V!" 'The ! has been redefined in the font list to a little ball
Setfont Font8x8
Lcdat 1 , 80 , "Temp"
Lcdat 2 , 80 , "53*C" 'the * is now actually a Degrees symbol in the font table
Lcdat 3 , 80 , "Power"
Lcdat 3 , 80 , "18.75W"
Do
Loop
End
$include "font8x5.font"
$include "font8x8.font"
$include "font16x16.font"
↧