123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|718|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> finding font widths?

Sat, 02 Nov 2019, 05:11
spinal

finding font widths?


Here's a small bit of code, it takes an image of a character set, pops it into a new single character width image (not really needed) and attempts to find out how wide each character is. Thing is though, it doesn't work.
Weirdly inside the x loop, x doesn't seem to change, but even then, it's not detecting the outside edge of the image either.

Any ideas where I went wrong?

using this image




-=-=-
Check out my excellent homepage!
Sat, 02 Nov 2019, 05:52
Jayenkai
I think it's the "Step -1" bit.
I've avoided using minus steps for a LONG time, and it might've been B2D/3D that caused that habit.



Switching it to that seems to work. (Although I might've added too many -1's!

-=-=-
''Load, Next List!''
Sat, 02 Nov 2019, 07:15
spinal
Odd that it could outside of the loop though...

|edit| Nope, not working I'm still getting 0 for all of the widths

-=-=-
Check out my excellent homepage!
Sat, 02 Nov 2019, 08:22
Pakz
Been staring at it. I see nothing!

All I can say is to visualize the problem. Draw out what should be happening and see if things are happening. I spend a couple of hours on a bug a couple of days ago where I just used a variable in the wrong way.
Sat, 02 Nov 2019, 14:22
Dan
ok here it the corrected code:



and the code as whole:



with few changes.
Sun, 03 Nov 2019, 05:35
spinal
If width_found=0 And (red<>bgred or green<>bggreen or blue<>bgblue) Then


Dammit, 'I' strike again. I changed that from red>0 etc. forgot the background colour might not be black...

also, excellent addition, the zoomed characters really help the visualisation.

-=-=-
Check out my excellent homepage!
Sun, 03 Nov 2019, 09:48
Dan
The zoomed chars are, actually, your code, i have only placed the SetBuffer commands at the new place, and moved the little font preview to somewhere else.

Question, why does the space char needs a width of 2 ?
Sun, 03 Nov 2019, 10:13
spinal
because a space would leave zero width and all the words would run into each other.

-=-=-
Check out my excellent homepage!
Mon, 04 Nov 2019, 05:09
Dan
Yeah, sounds logical.