Draw for scalable font?
#1
Anyone know of a good listing of draw commands for simple scalable fonts? Or a program that uses them I can yoink them from?
Reply
#2
I've never used DRAW for font rendering before; I've always just did a simple TextToImage routine and the scaled my image with _PUTIMAGE to whatever form/size I wanted. See a demo here: https://staging.qb64phoenix.com/showthread.php?tid=133
Reply
#3
Well I did draw my own scalable font but I did not use QB64 Draw commands, I used my own because it was originally done in SmallBASIC that did not load fonts or have independent image drawing areas (_NewImage, _Source, _Dest) but it translates OK into QB64.

That sounds like something that might have been done in earlier QB's did you scan through Sample Code?
b = b + ...
Reply
#4
(05-13-2022, 02:06 PM)bplus Wrote: Well I did draw my own scalable font but I did not use QB64 Draw commands, I used my own because it was originally done in SmallBASIC that did not load fonts or have independent image drawing areas (_NewImage, _Source, _Dest) but it translates OK into QB64.

That sounds like something that might have been done in earlier QB's did you scan through Sample Code?

I thought I'd seen something like that years ago but haven't found it yet.
Reply
#5
(05-13-2022, 01:36 PM)SMcNeill Wrote: I've never used DRAW for font rendering before; I've always just did a simple TextToImage routine and the scaled my image with _PUTIMAGE to whatever form/size I wanted.  See a demo here: https://staging.qb64phoenix.com/showthread.php?tid=133

I'm playing with different looks and methods.  I noticed that _putimage one and thanks for posting it. I just posted an option that uses point and pset.
https://staging.qb64phoenix.com/showthre...64#pid2164
Reply
#6
Searched for someone having used draw to make a display font, couldn't find any. Started hardcoding one and realized It would be easier to write and editor to create the font. Here it is so far: https://staging.qb64phoenix.com/showthre...27#pid2227
Reply
#7
I collected a few of these DRAW FONT things posted over the years.  Not sure where I got this -- maybe it was posted on an old qbasic forum long ago, or extracted from one of the ABC packets.  The demo code says UWLabs 1997, so I assume that's the original author.  Qbasic demo from 25 years ago lives again thanks to QB64!

- Dav


DRAWable Font SUB 'maybe' by UWLabs 1997...

Code: (Select All)
SCREEN 12
LINE (0, 0)-(640, 480), 15, BF

'using the "CALL" function...

'HOW...

CALL Font(1, 20, 1, "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.")
CALL Font(1, 40, 4, "Then he tripped and stumbled and fell.")

' or...

Font 50, 100, 2, "This is the FIRST font routine I created."


LINE (45, 110)-(400, 130), 7, BF
Font 51, 125, 15, "You can create embossed text like this."
Font 50, 124, 8, "You can create embossed text like this."

LINE (45, 140)-(400, 160), 7, BF
Font 51, 155, 8, "OR,  create raised text like this."
Font 50, 154, 15, "OR,  create raised text like this."

LINE (45, 180)-(250, 210), 7, BF
Font 54, 200, 8, "OR,  Shadows..."
Font 50, 197, 14, "OR,  Shadows..."

LINE (295, 180)-(400, 210), 12, BF
Font 305, 200, 4, "(Shadows.)"
Font 300, 197, 14, "(Shadows.)"

Font 51, 230, 0, "OR, BOLD Text,"
Font 50, 230, 0, "OR, BOLD Text,"

Font 201, 230, 0, "Double BOLD Text,"
Font 200, 230, 0, "Double BOLD Text,"
Font 201, 231, 0, "Double BOLD Text,"
Font 200, 231, 0, "Double BOLD Text,"

Font 381, 231, 4, "OR, 3-D Text."
Font 380, 231, 4, "OR, 3-D Text."
Font 381, 230, 5, "OR, 3-D Text."
Font 380, 230, 13, "OR, 3-D Text."

DRAW "s8" ' <---- SCALE doubled
Font 54, 270, 0, "OR, Double sized text!"
DRAW "s4" ' <---- SCALE restored

DRAW "a1" ' <---- ROTATION ANGLE 1  (90 degrees)
Font 70, 400, 0, "Vertical text."
DRAW "a0" ' <---- angle set back to zero

DRAW "a3" ' <---- ROTATION ANGLE 3  (270 degrees)
Font 85, 298, 0, "Vertical text."
DRAW "a0" ' <---- angle set back to zero

DRAW "ta15" ' <---- TURN ANGLE 15 degrees
Font 420, 475, 0, "And text at an angle!"
DRAW "ta0" ' <---- TURN ANGLE 0 degrees
DRAW "ta30" ' <---- TURN ANGLE 30 degrees
Font 418, 462, 0, "And text at an angle!"
DRAW "ta0" ' <---- TURN ANGLE 0 degrees
DRAW "ta45" ' <---- TURN ANGLE 45 degrees
Font 412, 450, 0, "And text at an angle!"
DRAW "ta0" ' <---- TURN ANGLE 0 degrees
DRAW "ta60" ' <---- TURN ANGLE 60 degrees
Font 402, 438, 0, "And text at an angle!"
DRAW "ta0" ' <---- TURN ANGLE 0 degrees
DRAW "ta75" ' <---- TURN ANGLE 75 degrees
Font 390, 430, 0, "And text at an angle!"
DRAW "ta0" ' <---- TURN ANGLE 0 degrees

DRAW "ta180" ' <---- TURN ANGLE 180 degrees
Font 225, 298, 0, "Upside down."
DRAW "ta0" ' <---- angle set back to zero

'Button-look UWL Logo...
PSET (10, 440), 0
DRAW "r130d30l130u30f1c15r128c8d28l128c15u28f1r126c8d26l126c15u26f1c7r124d24l124u24f2c3fp7,7"
Font 23, 462, 15, "UWLabs(c)1997"
Font 22, 461, 8, "UWLabs(c)1997"

'Smallest text DRAW will allow... (This is not in the SUB).

Font 185, 370, 0, "Using `DRAW' even..."
PSET (200, 384), 0
DRAW "u4f2e2d4br3u4br2br4l2gd2fr2br2u4r3fgnl3fdbr1beu2er2fd2gl2h"
DRAW "br6bfbu2r3bd2br4"
DRAW "u4l2r4br2nr3d2nr2d2r3br2e2h2br4g2f2br4u4l2r4bd4"
DRAW "br8u4br6l3gfr2fgl3br12b"
DRAW "u4r3fgl3bd1br6u2er2fd2gl2hbr10bu3l3gfr2fgl3br10bu4l3gfr2fgl3"
DRAW "br7u4br3nr3d2nr3d2r3ehehbr3d4r3br2nr3u2nr2u2nr3"

SLEEP

SUB Font (x, y, c, Text$)
    '  Font(x,y,c,Text$)
    '       where:
    '       x = starting x coordinate
    '       y = starting y coordinate
    '       c = text color
    '       Text$ = the string to display
    '
    '       on 320 width screens, use less than 37 chars.
    '       on 640 width screens, use less than 74 chars.
    '
    d = POINT(x, y)
    PSET (x, y), d
    color$ = STR$(c)
    DRAW "c" + color$ + "bl3"

    FOR h = 1 TO LEN(Text$)
        char$ = MID$(Text$, h, 1)
        GOSUB ReadChar
    NEXT h

    GOTO SubsEnd

    ReadChar:
    DRAW "br3"
    SELECT CASE char$
        CASE "A": DRAW "u4m+3,-8m+3,+8l6r6d4"
        CASE "B": DRAW "u12r4f2d2g2l4r4f2d2g2l4r4br2"
        CASE "C": DRAW "br6bu2g2l2h2u8e2r2f2bd10"
        CASE "D": DRAW "u12r4f2d8g2l4br6"
        CASE "E": DRAW "br6l6u6r4l4u6r6bd12"
        CASE "F": DRAW "u6r4l4u6r6bd12"
        CASE "G": DRAW "br3bu5r3d3g2l2h2u8e2r2f2bd10"
        CASE "H": DRAW "u12d6r6u6d12"
        CASE "I": DRAW "brru12lr2ld12r"
        CASE "J": DRAW "bu4d2f2r2e2u10bd12"
        CASE "K": DRAW "u12d6r2m+4,-6m-4,+6m+4,+6"
        CASE "L": DRAW "u12d12r6"
        CASE "M": DRAW "u12m+3,+6m+3,-6d12"
        CASE "N": DRAW "u12m+6,+12u12bd12"
        CASE "O": DRAW "br2h2u8e2r2f2d8g2l2br4"
        CASE "P": DRAW "u12r4f2d2g2l4d6br6"
        CASE "Q": DRAW "br2h2u8e2r2f2d8g2l2bu4f4"
        CASE "R": DRAW "u12r4f2d2g2l4r3m+3,+6"
        CASE "S": DRAW "bu2f2r2e2u2h2l2h2u2e2r2f2bd10"
        CASE "T": DRAW "br3u12l3r6l3d12br3"
        CASE "U": DRAW "bu12d10f2r2e2u10bd12"
        CASE "V": DRAW "bu12m+4,+12m+4,-12bd12"
        CASE "W": DRAW "br2h2u10bd12br2e2u6d6f2e2u10bd12"
        CASE "X": DRAW "m+6,-12bl6m+6,+12"
        CASE "Y": DRAW "bu12d3f3e3u3bd3bg3d6br3"
        CASE "Z": DRAW "bu12r6m-6,+12r6"
        CASE "1": DRAW "bu8m+2,-4d12"
        CASE "2": DRAW "bu10e2r2f2d2g6d2r6"
        CASE "3": DRAW "bu10e2r2f2d2g2l2r2f2d2g2l2h2br6bd2"
        CASE "4": DRAW "bu4m+5,-8d8r2l7r5d4br2"
        CASE "5": DRAW "bm+6,-12l6d4r4f2d4g2l2h2bm+6,+2"
        CASE "6": DRAW "bu6e2r2f2d4g2l2h2u8e2r2f2bd10"
        CASE "7": DRAW "bu12r6m-3,+8d4br3"
        CASE "8": DRAW "br2h2u2e2r2l2h2u2e2r2f2d2g2f2d2g2l2br4"
        CASE "9": DRAW "be6bu2g2l2h2u2e2r2f2d8g2l2h2bm+6,+2"
        CASE "0": DRAW "bu2u8e2r2f2d8g2l2h2m+6,-8bd10"
        CASE ".": DRAW "ud"
        CASE ",": DRAW "brudge"
        CASE "!": DRAW "brubu3u8bd12"
        CASE "?": DRAW "bu8u2e2r2f2d2g3dbd3dbr3"
        CASE "'": DRAW "bu10u2bd12"
        CASE "*": DRAW "bu6bee4bebl6bff4bfbu3l6bd9br6"
        CASE "\": DRAW "bu12m+6,+12"
        CASE "/": DRAW "m+6,-12bd12"
        CASE "(": DRAW "br3rlh2u8e2rbd12"
        CASE ")": DRAW "bu12rf2d8g2lbr3"
        CASE "$": DRAW "bu4f2r2e2h2l2h2e2r2f2bu2bl3u2bd12u2bd2br3"
        CASE " ": DRAW "br6"
        CASE "a": DRAW "br2h2u2e2r2f2u2d6u2g2l2br4"
        CASE "b": DRAW "u12d8e2r2f2d2g2l2h2bf2br4"
        CASE "c": DRAW "br6bugl3h2u2e2r3fbd5"
        CASE "d": DRAW "br6u2g2l2h2u2e2r2f2u8d12"
        CASE "e": DRAW "br6bugl3h2u2e2r2f2dl6bd3br6"
        CASE "f": DRAW "br2u10e2f2bl2bd4l4br5bd6"
        CASE "g": DRAW "be6d2h2l2g2d2f2r2e2u2d6g2l2h2bu2br6"
        CASE "h": DRAW "u12d8e2r2f2d4"
        CASE "i": DRAW "bru5bu2ubd8"
        CASE "j": DRAW "brbu8dbd2d8glhbe3"
        CASE "k": DRAW "u12d10e4g2f4"
        CASE "l": DRAW "bru12d12"
        CASE "m": DRAW "u6d2e2f2d4u4e2f2d4"
        CASE "n": DRAW "u6d2e2r2f2d4"
        CASE "o": DRAW "br2h2u2e2r2f2d2g2l2br4"
        CASE "p": DRAW "d4u10d2e2r2f2d2g2l2h2f2br4"
        CASE "q": DRAW "br6u6d2h2l2g2d2f2r2e2d6u4"
        CASE "r": DRAW "u6d2e2r3fbd5"
        CASE "s": DRAW "bufr4euhl4huer4fbd5"
        CASE "t": DRAW "bu8r2lu4d11frebd"
        CASE "u": DRAW "bu6d4f2r2e2u4d6"
        CASE "v": DRAW "bu6m+3,+6m+3,-6bd6"
        CASE "w": DRAW "bu6d4f2e2u2d2f2e2u4bd6"
        CASE "x": DRAW "e6bl6f6"
        CASE "y": DRAW "bu6m+3,+6m+3,-6m-3,+6m-2,+4bu4br5"
        CASE "z": DRAW "bu6r6g6r6"
        CASE "#": DRAW "bubr2u2l2r2u6d2l2r4u2d2r2l2d4r2l4r2d2br2bd"
        CASE "@": DRAW "br6l4h2u4e2r2f2d2g2l2u4r2d4br2bd2"
        CASE "%": DRAW "m+6,-12bl5fghebr4bd12hefgbr"
        CASE "^": DRAW "bu9e3f3bd9"
        CASE "&": DRAW "br6m-5,-8u2erfd2g4d2f2r2m+2,-4bd4"
        CASE ">": DRAW "e6h6bf6bd6"
        CASE "<": DRAW "br6h6e6bd12"
        CASE "-": DRAW "bu5r6bd5"
        CASE "=": DRAW "bu6r6bd2l6bd4br6"
        CASE "+": DRAW "br3bu2u6bg3r6bd5"
        CASE ":": DRAW "brubu3ubd5"
        CASE "`": DRAW "bu10u2bd12"
        CASE "~": DRAW "bu11er2fr2ebd12"
        CASE "_": DRAW "r6"
        CASE "{": DRAW "br5h2u2ehlrehu2e2bd12"
        CASE "}": DRAW "br2e2u2herlheu2h2bd12br3"
        CASE "[": DRAW "r2l2u12r2bd12"
        CASE "]": DRAW "r2u12l2r2d12"
        CASE ";": DRAW "brudgeubu3ubd5"
        CASE CHR$(34): DRAW "brbu10u2br2d2bd10"
        CASE "|": DRAW "bru5bu2u5bd12"
        CASE CHR$(9): x = x + 120: PSET (x, y), 0
            DRAW "c" + color$

    END SELECT
    RETURN
    SubsEnd:
END SUB

Find my programs here in Dav's QB64 Corner
Reply
#8
This almost exactly what I recall seeing somewhere over the past couple decades, thank you.
Reply
#9
Yeah that font is nice work, thickness by print over and over will work from small numbers, "printing" the same thing 2 or 4 times, for 3 you need 9 loops, 4 needs 16?
b = b + ...
Reply
#10
(05-17-2022, 03:51 PM)bplus Wrote: Yeah that font is nice work, thickness by print over and over will work from small numbers, "printing" the same thing 2 or 4 times, for 3 you need 9 loops, 4 needs 16?

Sure looks that way. It's a limitation of drawing with lines that have no thickness beyond 1 pixel.
Reply




Users browsing this thread: 5 Guest(s)