Shop OBEX P1 Docs P2 Docs Learn Events
Any ideas on scaled Font smoothing — Parallax Forums

Any ideas on scaled Font smoothing

Peter JakackiPeter Jakacki Posts: 10,193
edited 2011-08-01 17:56 in Propeller 1
Hi everyone, I know I've been really quiet on the forum lately, haven't really had much of a chance to lurk either :frown:
Anyway, I'm not sure if I'm reinventing the wheel here but I wanted scaled VGA characters so I got stuck into some PASM tonight and although I'm really rusty I managed to get the basics of scaling the Prop font onto a VGA monitor. So far so good....

scaled font.png


What I'd like to do is smooth the font especially when it's scaled up. Any ideas (any code) anyone?

Cheers,
Peter
640 x 361 - 261K

Comments

  • AleAle Posts: 2,363
    edited 2011-08-01 07:28
    It just occurred to me that using a line algorithm between the "points" could do... but maybe just adding a triangle-shaped filling character may do:
     0
    00
    
    would be filled to
    
    /0
    00
    
    

    a small scanning algorithm could do these fillings
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-08-01 17:56
    Hi Ale,

    I'm looking at a pixel by pixel smoothing during rendering as this is a bit-mapped display and I am drawing the scaled characters straight from the Prop's ROM. I was thinking of an algorithm that worked a bit like molasses in that the stickiness of it would be determined by the scaling factor. You with me so far??? A bit like we smooth out waveforms with capacitors.

    If there is a lookahead to what the next non-repeat row of pixels are then we can (depending upon the scaling factor of course) make gradual adjustments in each repeat row of the old data.

    Take is un-smoothed sample for instance:
    ****
            ****
            ****
            ****
        ********
        ********
        ********
        ********
        ****
        ****
        ****
        ****
        ********
        ********
        ********
        ********
    
    
    Adding pixels (#) and subtracting pixels (.) to approach the next non-repeat row (every 4th here) will smooth out the shape.
    
            ****
           #****
          ##****
         ###****
        ********
        *******.
        ******..
        *****...
        ****
        ****#
        ****##
        ****###
        ********
        ********
        ********
        ********
    
    So we end up with:
    
            ****
           *****
          ******
         *******
        ********
        *******
        ******
        *****
        ****
        *****
        ******
        *******
        ********
        ********
        ********
        ********
    
    Okay, I'm probably talking more than doing at the moment but I did ask. I will have to try this out on the same display and compare the difference.

    Ale wrote: »
    It just occurred to me that using a line algorithm between the "points" could do... but maybe just adding a triangle-shaped filling character may do:
     0
    00
    
    would be filled to
    
    /0
    00
    
    
    a small scanning algorithm could do these fillings
Sign In or Register to comment.