I want to use setcustomfontdata / setchar function to use a custom font in my program. How do I do this? The documentation said the data format for setcustomfontdata is "8 bytes horizontally aligned" but I'm not sure how that works.
ruan90 wrote:
I want to use setcustomfontdata / setchar function to use a custom font in my program. How do I do this? The documentation said the data format for setcustomfontdata is "8 bytes horizontally aligned" but I'm not sure how that works.

Each bit is one pixel.
Each byte is one row of 8 pixels.

Hope this helps Smile
beckadamtheinventor wrote:

Each bit is one pixel.
Each byte is one row of 8 pixels.

Hope this helps Smile


I see how that would work for each character but how do I set custom font for the entire alphabet?
ruan90 wrote:
beckadamtheinventor wrote:

Each bit is one pixel.
Each byte is one row of 8 pixels.

Hope this helps Smile


I see how that would work for each character but how do I set custom font for the entire alphabet?



Code:

det(92,FONTDATA


or if you just want to set some characters,

Code:

0->N
Repeat C=MAXCHAR
det(92,C,FONTDATA+N*8
N+1->N
C+1->C
End

MAXCHAR is the ascii code of the character after the last one you want
C is the ascii code of the character you want to start at
FONTDATA points to the data you want to set each character to. 8 bytes per character.
beckadamtheinventor wrote:



Code:

det(92,FONTDATA


or if you just want to set some characters,

Code:

0->N
Repeat C=MAXCHAR
det(92,C,FONTDATA+N*8
N+1->N
C+1->C
End

MAXCHAR is the ascii code of the character after the last one you want
C is the ascii code of the character you want to start at
FONTDATA points to the data you want to set each character to. 8 bytes per character.


det(92) is the setchardata function, which requires an index. I tried det(92, 97, "FFFFFFFFFFFFFFFF"
and printing char 97, but instead of being blacked out, the program still displayed the lowercase a character. I wonder what's wrong with my code?
ruan90 wrote:
det(92) is the setchardata function, which requires an index. I tried det(92, 97, "FFFFFFFFFFFFFFFF"
and printing char 97, but instead of being blacked out, the program still displayed the lowercase a character. I wonder what's wrong with my code?

Your code is wrong for 2 reasons (that I know of):
    1) The command must be given BINARY (1 or 0), not hexadecimal
    2) Each character is represented with 64 characters (8x8), not 16, as 16 characters would only set the first two pixel rows of the character (8x2)
calclover2514 wrote:
ruan90 wrote:
det(92) is the setchardata function, which requires an index. I tried det(92, 97, "FFFFFFFFFFFFFFFF"
and printing char 97, but instead of being blacked out, the program still displayed the lowercase a character. I wonder what's wrong with my code?

Your code is wrong for 2 reasons (that I know of):
    1) The command must be given BINARY (1 or 0), not hexadecimal
    2) Each character is represented with 64 characters (8x8), not 16, as 16 characters would only set the first two pixel rows of the character (8x2)


But when I write det(23, "FFFFFFFFFFFFFFFF") (set custom font data) and print char 0 it gives what I expected, which is a black 8*8 square. I believe the string gets squished by the compiler so I don't think it matters.
ruan90 wrote:
But when I write det(23, "FFFFFFFFFFFFFFFF") (set custom font data) and print char 0 it gives what I expected, which is a black 8*8 square.

0 is already an 8*8 black square.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement