BBC BASIC
Programming >> VDU Emulation >> Options for text without vertical separation
http://bbcbasic.conforums.com/index.cgi?board=vdu&action=display&num=1515790349

Options for text without vertical separation
Post by treehouse on Jan 12th, 2018, 7:52pm

Hi, it seems that all MODE settings give text with spaces between the lines, is that right? I was hoping to have text without this vertical separation. Is there another way besides printing at the graphics cursor? I was hoping to gain some speed advantage for a moving design that only needs to be fairly blocky (although small would be best) by using the text viewport.
Re: Options for text without vertical separation
Post by Richard Russell on Jan 12th, 2018, 10:02pm

on Jan 12th, 2018, 7:52pm, treehouse wrote:
Hi, it seems that all MODE settings give text with spaces between the lines, is that right?

I don't think it is, assuming that you are taking descenders into account. Try this (in BBCSDL), you should find that there is no gap at all between the descender of the 'g' and the top of the 'T':

Code:
      MODE 2
      PRINT "gggggg"
      PRINT "TTTTTT" 

Or the equivalent in BB4W (using user-defined characters):

Code:
      MODE 2
      VDU 23,103,0,0,124,204,204,124,12,120
      VDU 23,84,252,48,48,48,48,48,48,0
      PRINT "gggggg"
      PRINT "TTTTTT" 

Of course if you're using a non-bitmapped (e.g. TrueType or OpenType) font then it's largely out of your control because it will depend on details such as anti-aliassing, ClearType and the current DPI value. Even if you were to manage to tweak it to get precisely the results you want, the same program running on another PC might look different.

Richard.

Re: Options for text without vertical separation
Post by treehouse on Jan 12th, 2018, 11:39pm

Ah, you're nearly right. In BB4W the normal characters (I'm not using any font definitions at all) don't reach to the top or bottom, as far as I can tell, just with descenders and risers, so your first program shows clear space between the top of Ts and the bottom of the gs (or any characters, I think). However, using user defined characters, they can, except in those modes mentioned in the help, 3, 6, 20, 21, 28 and 29. So I can do what I was hoping, make a user defined character to use as a 'pixel' that will fit in all directions on a text 'picture'. Great stuff. I used to do that on the Electron. I forgot how the normal text was spaced, and then started to suspect it might be different in BB4W when I saw the space.
Thanks,
John
Re: Options for text without vertical separation
Post by Richard Russell on Jan 13th, 2018, 11:10am

on Jan 12th, 2018, 11:39pm, treehouse wrote:
Ah, you're nearly right.

Pah! "Nearly" indeed!

Quote:
In BB4W the normal characters (I'm not using any font definitions at all) don't reach to the top or bottom

I stated that the first code snippet was specifically for BBCSDL. If you run it in BB4W you won't get a bit-mapped font, so it's highly likely not to be 'full height'. You can run this code to discover what typeface Windows has actually chosen:

Code:
      MODE 2
      DIM face{name&(31)}
      SYS "GetTextFace", @memhdc%, DIM(face{}), face{}
      PRINT face.name&() 

Here it reports 'Courier New' which is a TrueType font.

BBCSDL uses a BBC Micro style 8x8 bit-mapped font by default, so the results are different.

Richard.

Re: Options for text without vertical separation
Post by treehouse on Jan 14th, 2018, 11:20am

Yep, my bad, you're completely right. I've installed BBCDSL on my Linux machine and tried it. I'm not often right, and I'm wrong again. grin I didn't think BBCDSL would be different on that sort of issue. That's an interesting default font, and quite unexpected, but I suppose that's what my Electron had, just 8*8. And IIRC, in several modes characters did touch vertically. I think it was that vague memory that contributed to my confusion when I couldn't find a mode in BB4W that did the same.

I don't know much about different font types, but I see what you're saying. I get confused between what my Electron did and what BB4W does (not an emulation, which is a great boon) - now DSL has thrown me a new curve-ball.

I like the additional editing options in Andy Parkes' editor - quick addition/subtraction of REMs, etc. - but I've not tried it much. The display has some odd quirks on that machine; I don't know if it's common. The menus disappear (the elements in them) if you open one of them from the menu bar and then mouse-over others in the bar, things like that.

Having said that, I've got a bit more used to the BB4W editor. If I only use line numbers for error reports or whatever (and in fact they're not essential since the cursor finds the ERL in the program), editing is easier with drag-n-drop without line numbers getting taking into the text. My top desire, if I was to dig into the code or write an editor myself, would be for the cursor to wrap at ends of lines (and beginnings of lines or line numbers), even if direct positioning of it with the mouse was unrestricted. They aren't big issues, and I could always write a macro to do some stuff.
Re: Options for text without vertical separation
Post by Richard Russell on Jan 14th, 2018, 4:26pm

on Jan 14th, 2018, 11:20am, treehouse wrote:
I didn't think BBCDSL would be different on that sort of issue.

Both BB4W and BBCSDL are implementations of the BBC BASIC programming language - they are most definitely not BBC Micro emulators; this is a most important distinction. Things like character fonts have nothing whatever to do with the language - they are features of the machine's hardware and operating system - and therefore you should not expect them to be similar (although SDL runs under Windows, it is effectively an independent 'virtual machine').

Indeed, if you look more broadly across the range of 30-plus platforms on which BBC BASIC has been implemented - like the old Amstrad Notepad computers (NC 100/150/200) or the Sinclair (Cambridge) Z88, or MS-DOS - you will not in general find that they have much in common when it comes to features like fonts or graphics.

If what you are looking for is a BBC Micro emulator - and from your remarks about the detailed characteristics of fonts and display attributes it sounds as though you may be - you are in completely the wrong place. There are excellent emulators like BeebEm and JSBeeb which perhaps you should be investigating.

I appreciate that I may well have added to some possible confusion by taking advantage of the power and flexibility of Windows on the one hand, and SDL 2.0 on the other, to make BB4W and BBCSDL more compatible with the BBC Micro (and Acorn Archimedes) than some of my other implementations. But you should consider that a bonus, not an expectation!

And it most definitely does not extend to fonts. Like every other version of BBC BASIC that I have been responsible for, the default font used by BB4W is the machine's native fixed-pitch font (in Windows it's called FixedSys). The only reason that BBCSDL, exceptionally, defaults to an 8x8 bitmapped font is that SDL is a 2D games engine and doesn't have any concept of 'native font'.

Additionally, although both BB4W and BBCSDL support changing the font (using the *FONT command) they are less compatible with each other in this respect than almost any other.

I don't know whether you've purchased the full version of BB4W, but if you have - under a misapprehension of what the product is all about - contact me privately and I will refund your payment.

Richard.

Re: Options for text without vertical separation
Post by treehouse on Jan 14th, 2018, 7:06pm

Thanks, Richard, but my last reply was just an explanation of why I'm confused, not a complaint at all, or intended to suggest that you had caused my confusion. As I said, the fact that it's not an emulator is "a great boon". I bought BB4W years ago and only wish I'd had time and the focus to use it more. I love it. I wanted the power and speed of modern computers but with a language I was familiar with. I soon realised that I wasn't completely familiar with it, and obviously couldn't be, since it had a modern computer to control with it. But, as above, it still trips me up. I've unconsciously made the assumption that the default font was a sort of 'emulation' unless you invoked specific ones on the system, I think, something like that.

I've got a perfect Acorn Electron emulator in the loft, complete with tape deck, Plus 1 and RGB monitor. grin

On the other hand, I'm curious now, so I've just downloaded Elkulator to have a mess with. Saves getting looks from the missus when I set up another computer in the study. wink