? GPUTCHR2 ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password
This website has been moved, please see this post

GPUTCHR2

Submitted
Updated
Author
MZ952
Public Key
BBRE7E4E
Min. Compat.
All
Version
Déjà vu
Rating
0 votes
Description A kind of replacement for GPUTCHR. Edit 05/04/2020: fixed bug in GPUTCHR2 function, can now draw char sizes other than 8 px. Included unantialiased SB4 font data in project folder. Instructions Call the function like you would its namesake. Keep in mind it's uh likely a bit slower than GPUTCHR. The test page of the main program generates in about 130 milliseconds. GPUTCHR2 OffsetX,OffsetY,TextString$,ScaleX#,ScaleY#,Color Code,Fill Flag Fill flag determines whether or not GPUTCHR searches for areas of the vectorised text to fill. For example, the period character, a 2x2 pixel square, will be filled should the flag be turned on, otherwise it will be a simple box. A similar logic applies to other characters which have "filled" spaces inside of them, for example the multiplication symbol. The project also contains "GPUTCHR2_FNTLD", which is the algorithm used to generate the data inside the GPUTCHR2 def block. You can generate your own font data by first loading in your font traditionally and peehaps changing some of the necessary parameters in the file (such as the slot into which to load the generated data, the square size of the character font (for use in SB BIG or SB4)).
Categories
Keywords
9 Comment(s) MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Reading I like to read books! Hobbies I'm looking for anyone willing to run this code in SB4 and share the export data. It would be neat to have the resolution of SB4 font in SB3 (I also really like the SB4 font I guess?). 12Me21 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself 4V348Q51S MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Reading I like to read books! Hobbies Whoa, many thanks! Did you encounter any issues running the code on SB4, does it draw okay on SB4 by any chance? Edit: nah it wouldn't have worked, discovered some problems in the code. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Reading I like to read books! Hobbies Awesome, it works! Question: does GPUTCHR on SB4 not draw chars at full 16x16 quality (I know there's some antialiasing in them, maybe that's why)? I seem to remember it that the chars were multiple pixels "thick" (although I've never used GPUTCHR on the SB4 font), while the data here seems to be all one-pixel wide, like 8x8 font scaled up. Edit: Perhaps GPUTCHR works differently in SB4? The data points you sent me are definitely a 16x16 font, it's just they're mostly 1-pixel thick (the alphanumerics at least), which the 16x16 font in SB4 isn't. I don't think there's anything wrong with my algorithm, at least SB3 side it renders multipixel thick font well. snail_ snail_ Power User QSP Contest 1 Contest Participant I participated in the first SmileBASIC Source QSP Contest! Helper Received for being very helpful around SmileBASIC Source Achievements Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements If your algorithm can't handle translucent pixels it will break on the 16x16 SB4 font. There's full alpha now, so the font uses antialiasing to look a lot smoother. 12Me21 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself oh yeah I used the alternate 16x16 font because I didn't think it would work with the antialiased version MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Reading I like to read books! Hobbies Right. My algorithm looks for non-zero pixels. There must be something wrong Edit: ah, yeah, that's it lol. It won't get the antialiasing right at all (it'll mark any non-zero pixel), but I was okay with that. Now I'm thinking about how to preserve the antialiasing, but I wonder if it's necessary. snail_ snail_ Power User QSP Contest 1 Contest Participant I participated in the first SmileBASIC Source QSP Contest! Helper Received for being very helpful around SmileBASIC Source Achievements Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements It probably isn't possible with this method, or not easy or straightforward to get decent results. This seems similar in principle to a PC outline font, and I couldn't generate an outline font for the SB4 16x because you can't replicate how it looks exactly with the antialiasing with the approach of tracing. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Reading I like to read books! Hobbies I don't think the antialiasing would be a major problem. The tracing can handle groups of pixels, and it should look okay redrawn with the fill flag ticked on. The translucent pixels would be converted into opaque pixels. The redraw may look a bit "bloated" because of this, but it shouldn't be so bad to make chars not legible.