The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
proportional text writing
#6
nitrofurano Wrote:The code is really fast, but i didn't find the custom space there
On my code, i used a special area just for that (and i'm also thinking about using kernings there as well...)
And on my example i used 12 pixel lines instead of 8
spacing variables:
xgap: gap between letters in pixels.
spacesize: gap of space
The width of all letters is automaticaly recognised, so it is not possible to define larger gaps for some letters (as this is nonsense), and it works also with narrow fonts like 4x8.
But back to your code:
To speed it up, replace multiplications and divisions with bitshifting.
Replacing
Code:
x1=int(x/8)
with
Code:
x1=x>>3
speeds it already significantly up.
Edit:
Forget what I wrote. I'm stupid...
The biggest downslowing was
Code:
2^x2
And you repeated the same calculation over and over, so defining the x3 variable outside j-loop speeds it up dramaticaly. I even changed it and other calcs to bitshifting for further speedup:
Code:
dim i,j,adr,v,vq,vq2,c,xps,x1,x2,x3,x,y,c1 as uinteger border 6:paper 7:ink 1: bright 1:cls x=3:y=109 for c1=0 to 52 x1=x>>3 x2=7-(x mod 8) x3=1<<x2 if x3=0 then x3=1:end if for j=0 to 11 i= ((y+j)<<5)+x1 adr=(16384+((i band 31) bor ((i band 224)<<3) bor ((i band 1793)>>3) bor (i band 6144))) v=peek(uinteger, adr) vq2=(peek(@naftaregularcharmap+(12*c1)+j))*x3 vqbs= ((vq2 band 65280)>>8) bor ((vq2 band 255)<<8) poke uinteger adr,v bor vqbs next j x=x+peek(@naftaregularcharmapspacing+c1) next c1 pause 0
Hope, you like it.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)