LoginLogin

Multifont

Root / Submissions / [.]

DevinF06Created:
Download:Q3QDEXGD
Version:Size:1.05MB
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

Your description "This project shortens text" doesn't really convey what your library does.

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!

Replying to:kevinfoley
Your description "This project shortens text" doesn't really convey what your library does.
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?

Replying to:kevinfoley
Your description "This project shortens text" doesn't really convey what your library does.
The description suggests that it's a variable-width font system.

I think it would be pretty simple to automatically generate the character width data.

Replying to:12Me21
I think it would be pretty simple to automatically generate the character width data.
Well... I don't really know how to do that. But look what happened when I used FILL FONTDLL%,9:

Replying to:Simeon
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!
Your welcome!

Replying to:12Me21
I think it would be pretty simple to automatically generate the character width data.
for each character: loop backwards (rtl) through the columns in the graphic definition: if the column is nonblank, set that as the character width.

Replying to:12Me21
I think it would be pretty simple to automatically generate the character width data.
I'm not that smart, but at least the array gives you a bit of creativity in what you want to do:

Replying to:12Me21
I think it would be pretty simple to automatically generate the character width data.
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?

Replying to:12Me21
I think it would be pretty simple to automatically generate the character width data.
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.

Replying to:12Me21
I think it would be pretty simple to automatically generate the character width data.
12Me21, I don't think it's working properly...

Replying to:12Me21
I think it would be pretty simple to automatically generate the character width data.

Replying to:12Me21
I think it would be pretty simple to automatically generate the character width data.
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...

Replying to:12Me21
I think it would be pretty simple to automatically generate the character width data.
Oh, I see what happened. Add EDIT_0 to the beginning of the program

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

Replying to:kevinfoley
Your description "This project shortens text" doesn't really convey what your library does.
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.

Replying to:DevinF06
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
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?)

Replying to:DevinF06
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
Please be aware that I can't tell wellSeeing 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.