How to inhibit printing top-row of fonts...

Anything QL Software or Programming Related.
martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

How to inhibit printing top-row of fonts...

Post by martyn_hill »

Hi everyone

As part of my Scalextric lap-counter/timer project, I've designed some simple font/fount characters for the 7-segment digit display. To get the larger sizes for the digits that I wanted, each segment is composed of several 'UDG' characters that need to be lined up adjacent to one-another ('fat-font' style).

This mostly works OK except that the standard QDOS/SMSQ/E print routines seem to insist on adding that blank row of pixels above each character, even with CSIZE 1,0 and CHAR_INC set to 8,9 (making-up each character-row to the standard 10 pixel height).

To overcome this, OVER -1 works, effectively masking-out the top-pixel row from blanking the last pixel-row of the character above when QDOS prints, but that is a nuisance as I sometimes want to over-write parts of the display without XORing everything.

I guess using proper Sprite routines would be more appropriate to this application, but I'm trying to keep the code simple (for my BBQL).

Can we suppress QDOS from trying to print that extra (10th) row of pixels when using the standard printing routines?

I'm sure there must be solution for this behaviour - any ideas, anyone?

I have Minerva 1.98, TK2 and Lightning on my BBQL (the ultimate host of the project).

Thanks in advance and Merry Christmas!


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: How to inhibit printing top-row of fonts...

Post by tofro »

Martyn,
not sure if that would work, but you could try printing into an overlay window that has exactly the amount of pixels you want to print. Position with CURSOR so that the top row of blank pixels would be off screen. Basically, cutting off the unwanted pixels by the window border.

Tobias
(Wishes a Merry Chrismas to all!)


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: How to inhibit printing top-row of fonts...

Post by martyn_hill »

Hi Tobias - thanks for the idea.

As it happens that approach wouldn't help much in this case as each new character row (or 9 pixels) exhibits the same behaviour and each of the

Seems odd to me that this extra row of pixels is ever printed at all, with CHAR_INC set to 9 tall - makes me wonder if its a bug in the standard display driver (even in SMSQ/E), or else my own mis-understanding.

I can make do with OVER -1 printing for now, but would still be interested to know if there is a more elegant solution.

M.


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: How to inhibit printing top-row of fonts...

Post by NormanDunbar »

I'm not 100% sure but I might have written some font handling code back in the old days of DJToolkit that might possibly Do what you want. But as I said, I'm not sure.

Head over to Dilwyn's Web site and download the toolkit and demos, there could well be something to help.

Good luck.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: How to inhibit printing top-row of fonts...

Post by NormanDunbar »

Re the above, it may have been something like SCR_XINC. Maybe SCR_YINC.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: How to inhibit printing top-row of fonts...

Post by dilwyn »

NormanDunbar wrote:Re the above, it may have been something like SCR_XINC. Maybe SCR_YINC.

Cheers,
Norm.
The manual for DJToolkit says SET_XINC and SET_YINC.

Regarding martin's problem, the only real way around it is to print twice, once with spaces and OVER 0 to delete what was there before and then print with OVER 1 to add the characters:

Code: Select all

def proc Print_At (channel,y,x,text$)
AT #channel,y.x : OVER #channel,0 : PRINT #channel,FILL$(' ',len(text$));
AT #channel,y,x : OVER #channel,1 : PRINT #channel,text$;
OVER #channel,0
end def Print_At
This will have a slight flicker if text is constantly being redrawn.

If erasing the previous text with a string of spaces also causes a 1 pixel line spacing problem, calculate the size of a BLOCK to use to erase instead. E.g. using CSIZE 0,0 with spacing 6 and 10 pixels, the second line might become:

BLOCK #channel,6*LEN(text$),10,6*x,10*y,paper_colour

CHAN_W% could be used to read the character spacing from the definition block for a channel:
xinc% = CHAN_W%(#channel,38)
yinc% = CHAN_W%(#channel,40)

A slightly better way perhaps is a to use a font enlarger routine such as that in the 'Fun With Fonts' series in QL Today. Download this from http://www.dilwyn.me.uk/docs/articles/funfonts.zip. This uses the CHAN_L function from the free DIY Toolkit series to locate the address of the font for a given channel, then examines the font pixel by pixel to draw the characters using a series of BLOCK commands. If using Norman's DJToolkit for the SET_XINC and SET_YINC commands, you could then also use the WHERE_FONTS function to locate the font addresses.


stevepoole
Super Gold Card
Posts: 712
Joined: Mon Nov 24, 2014 2:03 pm

Re: How to inhibit printing top-row of fonts...

Post by stevepoole »

Hi Martyn,
If you design your own font sizes, you have to handle your own spacing and line feeds etc., normally handled by the PRINT command.
DIY font handling is not straightforward to do in this case, but it can be rewarding.
Please bear this in mind,
Steve.


EmmBee
Trump Card
Posts: 240
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: How to inhibit printing top-row of fonts...

Post by EmmBee »

Hi Martyn,
Another idea you could try is to use CURSOR with four parameters. Do it like this: SCALE 100,0,0 : CURSOR 0,100,x,y : PRINT your text. This can be useful for avoiding out of range errors. I've no idea whether this will work in your case, but you could try it.
Kind regards
Michael


martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: How to inhibit printing top-row of fonts...

Post by martyn_hill »

Hi everyone - thanks for all your ideas!

Given that keeping the print routine simple and efficient is my main aim - ultimately to run on a BBQL - I'm thinking that the OVER -1 approach to overcome the unwanted blank pixel-line when printed, remains the most efficient. I'll just need to over-write the with OVER 0 set before printing the composite charcter...

Still curious as to why the print routines insist on adding that 10th pixel-line (above the row currently being printed) even with CHAR_INC (and Norman's SET_YINC) set to less than 10 rows.

I've been testing in SMSQ/E on QPC and haven't yet transferred the programme to my BBQL, so it may be that Minerva/TK2 behave differently - I'll test this later today and let you all know.

Happy Sunday!


User avatar
Mr_Navigator
QL Fanatic
Posts: 782
Joined: Mon Dec 13, 2010 11:17 pm
Location: UK, Essex
Contact:

Re: How to inhibit printing top-row of fonts...

Post by Mr_Navigator »

martyn_hill wrote:Hi everyone

As part of my Scalextric lap-counter/timer project, I've designed some simple font/fount characters for the 7-segment digit display. To get the larger sizes for the digits that I wanted, each segment is composed of several 'UDG' characters that need to be lined up adjacent to one-another ('fat-font' style).

This mostly works OK except that the standard QDOS/SMSQ/E print routines seem to insist on adding that blank row of pixels above each character, even with CSIZE 1,0 and CHAR_INC set to 8,9 (making-up each character-row to the standard 10 pixel height).

To overcome this, OVER -1 works, effectively masking-out the top-pixel row from blanking the last pixel-row of the character above when QDOS prints, but that is a nuisance as I sometimes want to over-write parts of the display without XORing everything.

I guess using proper Sprite routines would be more appropriate to this application, but I'm trying to keep the code simple (for my BBQL).

Can we suppress QDOS from trying to print that extra (10th) row of pixels when using the standard printing routines?

I'm sure there must be solution for this behaviour - any ideas, anyone?

I have Minerva 1.98, TK2 and Lightning on my BBQL (the ultimate host of the project).

Thanks in advance and Merry Christmas!

I think a more simple solution would be to use Toolkit II command

CHAR_INC #channel, x inc, y inc

It sets set the character x and y increments so both the top ans side gaps can be made to disappear, I recently used this on a program I am currently writing.


-----------------------------------------------------------------------------------
QLick here for the Back 2 the QL Blog http://backtotheql.blogspot.co.uk/
Post Reply