? Multifont ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Multifont

Submitted
Updated
Author
DevinF06
Public Key
Q3QDEXGD
Min. Compat.
All
Size
1.05MB
Rating
2 votes
Description This project shortens text with an advanced library And if you want to add your own font... it's kinda difficult. Here's how you do it: 1. Align the text to the left in SBPAINT/SBGED (e.g. MYFONT.FON) 2. Assign the length in FONTDLL (e.g. FONTDLL%[ASC("!")]=2) 3. Save the FONTDLL (e.g. SAVE"DAT:MYFONT.DLL",FONTDLL%) Instructions How to use in your program: Just copy the files and put this in your program: (After ACLS) DIM FONTDLL%[65536] LOAD"GRPF:SBMULTI.FON",0 LOAD"DAT:SBMULTI.DLL",FONTDLL%,0 EXEC"PRG1:MFONT.LIB" P.S. If you want the MFONT2 library, just replace the MFONT.LIB with MFONT2.LIB Commands: MFONT TEXT$,X,Y,XI,YI,RGB,FONTDLL% XI/YI: The edge of X/Y (Basically a box) FONTDLL: Just put in the FONTDLL array above MLEN(TEXT$,FONTDLL%) This outputs the length of the text with the FONTDLL Multifont 2 library: MFONT2 TEXT$,X,Y,XI,YI,FONTDLL% Just like MFONT, but has more features. (The features are in the TEXT$ string) %B: Changes the bold feature (e.g. %B1) %C: Changes the color (e.g. %CFFFFFF) %S: Changes the character spacing (e.g. %S3) %X: Changes the width of the text %Y: Changes the height of the text %P: Changes the allocated length of a special command (Exept for %C) (e.g. %P2%S10) &: Specifies as an escape character
Categories
Keywords
19 Comment(s) DevinF06 DevinF06 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies This project was surprisingly simple, I made the first version of this in ~1-2 hours I can't really believe nobody already made this CyberYoshi64 CyberYoshi64 Night Person I like the quiet night and sleep late. Express Yourself Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength I actually did this much earlier than you but I never released it to everyone. (It was hidden in Windows 3DS's library for a while. I am unsure... 1 or 2 months?) HTV09 HTV09 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Video Games I like to play video games! Hobbies Seeing the release date of the last Win6Mix update, which was around a month ago and my backup SD card where we two stored each DEF in, it was edited around 2 months ago and can do more than this. As he said, we didn't release it like this. It was hidden and no one, since ~1 month ago didn't even knew about. 12Me21 12Me21 Head Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website I think it would be pretty simple to automatically generate the character width data. DevinF06 DevinF06 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies Well... I don't really know how to do that. But look what happened when I used FILL FONTDLL%,9: Y_ack Y_ack for each character: loop backwards (rtl) through the columns in the graphic definition: if the column is nonblank, set that as the character width. DevinF06 DevinF06 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies I'm not that smart, but at least the array gives you a bit of creativity in what you want to do: 12Me21 12Me21 Head Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website Here: RRENW3G4 A few other things: You can use STRING$[INDEX] rather than MID$(STRING$, INDEX, 1) The X/Y scale values in GPUTCHR are optional: GPUTCHR X, Y, STRING$, COLOR works too. Why are you using MLEN on single characters in _1? Y_ack Y_ack there should also be a letter-spacing parameter independent of the character width table this would allow you to change the universal spacing while respecting variable glyph widths And, this way you can use a standard table generated with FILL 8 to produce different monospaced widths instead of FILLing a new table for each. the other improvement for nice lettering you can have is kerning, which requires a table of character combinations with special adjustment values for them, which you would use as a look-behind. You can index this by the suffix character to make lookups efficient. DevinF06 DevinF06 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies 12Me21, I don't think it's working properly... 12Me21 12Me21 Head Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website but... [url=https://www.youtube.com/watch?v=jKJ5Xl6TA4c]https://www.youtube.com/watch?v=jKJ5Xl6TA4c[/url] DevinF06 DevinF06 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies The program broke on 0:16 And I tried to use the files it made in the project, and you can see in the last image, it didn't go very well... 12Me21 12Me21 Head Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website Oh, I see what happened. Add EDIT_0 to the beginning of the program Simeon Simeon Scholar Received for knowing a great deal about programming topics Achievements Amazing Page Hidden Achievements Drawing I like to draw! Hobbies Just what SmileBASIC was in desperate need of. Depending on the performance, I would love to use this in some future projects! Thanks for this! DevinF06 DevinF06 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies Your welcome! kevinfoley kevinfoley Your description "This project shortens text" doesn't really convey what your library does. kevinfoley kevinfoley To be more specific, what does "shortens text" mean? It reduces the number of characters in the text? It reduces the width or height of the font? Something else? Y_ack Y_ack The description suggests that it's a variable-width font system. HTV09 HTV09 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Video Games I like to play video games! Hobbies It uses custom width values for each character and "removes" unnecessary spaces in between them. It doesn't squish the text. (CHR$(32) is excluded of course.) If you use a custom font, then you'd need to redefine the values for your font as described above.