Large fonts in text mode

DOS specific questions.
Gablea
Posts: 1049
Joined: Apr 06, 2010 0:05
Location: Northampton, United Kingdom
Contact:

Large fonts in text mode

Postby Gablea » Aug 06, 2013 13:09

Hi all,

I was just wondering is it possible to do large font sizes in screen 0?
I ask this as I have some pc's that will run a FreeBASIC dos app in screen 0
But will not display anything when using screenres settings

Basicly what I want to do is display the following


£0.00 0 (large)



Next customer please (standard size)

Any advise would be welcomed

Andy
DOS386
Posts: 798
Joined: Jul 02, 2005 20:55

Re: Large fonts in text mode

Postby DOS386 » Aug 07, 2013 5:28

Gablea wrote:I was just wondering is it possible to do large font sizes in screen 0?


FB itself definitely can't

> I ask this as I have some pc's that will run a FreeBASIC dos app in screen 0
> But will not display anything when using screenres settings

Bad VESA ?

> Basicly what I want to do is display the following
> £0.00 0 (large)

Code: Select all

Total co$t:

   ****   
  **  **
  **  **
  **  **
  **  **
   ****   


> Next customer please (standard size)

There is none :-D

> Any advise would be welcomed

1. See above ("ASCII-art")
2. Do your own VESA (test and report about the VESA)
3. You can plot pixels onto screen 0 too (???)
MichaelW
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

Re: Large fonts in text mode

Postby MichaelW » Aug 08, 2013 0:59

Gablea wrote:I was just wondering is it possible to do large font sizes in screen 0?

How large, and how many characters in the character set?
dodicat
Posts: 6017
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Large fonts in text mode

Postby dodicat » Aug 08, 2013 1:05

For Pentium:
On older computers, perhaps used for dos, I have found that processors without at least mmx cannot run graphics in the later fb versions.
I (THINK) fb 17 was about the last version which could handle non mmx.
For instance, Pentium Pro processors wont run graphics in these later fb versions.

I have tested (a while back) very low grade graphics cards, just one Mb memory with no hardware acceleration.
These were ok, so long as the processor had MMX.

(Just an observation)
RockTheSchock
Posts: 226
Joined: Mar 12, 2006 16:25

Re: Large fonts in text mode

Postby RockTheSchock » Aug 08, 2013 8:33

Propably the graphics library gfxlib2 is compiled with -march=i686 ? Perhaps you could try to compile it on your own with
-march=i486 -mtune=generic
MichaelW
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

Re: Large fonts in text mode

Postby MichaelW » Aug 11, 2013 6:03

The VGA BIOS provides support for user-defined character sets in alphanumeric mode. The character box for these characters can have a maximum size of 9x32, with 256 characters per set, and two sets active at one time (selected by bit 3 of the character's attribute). And it is possible to define characters that span more than one character box, but to reasonably make this work you would need to reduce the character box width to 8 pixels. The problem is that for the default 9x16 character box the ninth pixel is not specified in the character set but added by the VGA hardware, by displaying the ninth pixel in the background color, for most of the characters, or making it the same color as the eighth pixel. And for a character that spans more than one character box, and for at least some of the characters, this ninth pixel behavior would create a discontinuity.

Even though the above scheme is workable, IMO it would not be worth the effort because:

In going from a 9x16 character box to 8x16 the appearance of the characters M, T, V, W, X, Y, Z, m, v, w, and several others would suffer significantly (although the characters would have the same appearance as they do in a normal fbgfx app). The source code for an fbgfx app that will let you compare the two is here.

It would be difficult to make the large characters look like the same font as the normal characters, and without some sort of anti-aliasing the jagged edges on the larger font would be more visible than on the smaller font.
Laaca
Posts: 22
Joined: Dec 31, 2007 14:24

Re: Large fonts in text mode

Postby Laaca » Aug 12, 2013 13:22

You could try my pascal unit Mimoza. It allows many exotic things in DOS text mode; besides other things also changing the size of chars. Firstly try the included compiled example. The pascal source is self-explanatory and contains assembler parts. It is not difficult to translate it into basic.
http://www.laaca.borec.cz/soubory/mimoza.rar
dodicat
Posts: 6017
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Large fonts in text mode

Postby dodicat » Aug 13, 2013 0:30

You might be interested in The Draw, a Quickbasic type utility for DOS.
http://www.syaross.org/thedraw/

Here is a comparison between the 8 by 8 and 8 by 16 pixels.

Code: Select all

'8 by 8
Sub drawstring8(xpos As Integer,ypos As Integer,text As String,colour As Uinteger,size As Single,textangle As Single=0,charangle As Single=0,im As Any Pointer=0)
    Type point2d
        As Single x,y
        As Uinteger col
    End Type
    Dim As Integer flag,codenum=256
    if instr(text,"|") then flag=1
    Static As Integer runflag
    Static As point2d infoarray()
    Redim Preserve As point2d infoarray(64,codenum) '64 = 8 x 8 pixel size
    If runflag=0 Then   '                  'scan codenum of codepage once
        Dim As Uinteger background=0
        Screenres 10,10  '8 x 8 pixels on this screen
        Dim count As Integer
        For ch As Integer=1 To codenum
            Cls
            Draw String(1,1),Chr(ch)
            For x As Integer=1 To 8  'scan for characters
                For y As Integer=1 To 8
                    If Point(x,y)<>background Then
                        count=count+1
                        infoarray(count,ch)=Type<point2d>(x,y)'save pixel position
                    End If
                Next y
            Next x
            count=0
        Next ch
        runflag=1
    End If
    If size=0 Then Exit Sub
    Dim As point2d temp(1 To 64,codenum),np
    Dim As Single cr= 0.01745329 'degs to radians
    #macro rotate(p1,p2,a,d)
    np.col=p2.col
    np.x=d*(Cos(a*cr)*(p2.x-p1.x)-Sin(a*cr)*(p2.y-p1.y)) +p1.x
    np.y=d*(Sin(a*cr)*(p2.x-p1.x)+Cos(a*cr)*(p2.y-p1.y)) +p1.y
    #endmacro
   
    Dim As point2d cpt(1 To 64),c=Type<point2d>(xpos,ypos),c2
    Dim As Integer dx=xpos,dy=ypos
    For z6 As Integer=1 To Len(text)
        var asci=text[z6-1]
        If asci=124 Then
            if charangle<>0 then xpos=xpos+12*sin(charangle*cr)
            dx=xpos:dy=dy+12:Goto skip 'pipe | for new line
        End If
        For _x1 As Integer=1 To 64
            temp(_x1,asci).x=infoarray(_x1,asci).x+dx
            temp(_x1,asci).y=infoarray(_x1,asci).y+dy
            temp(_x1,asci).col=colour
            rotate(c,temp(_x1,asci),textangle,size)
            cpt(_x1)=np
            var copyy=np.y
            If charangle<>0 Then
                dim as integer p
              if flag then  p=1 else  p=(z6-1)
c2=Type<point2d>(xpos+(size*8)*p*(Cos(textangle*cr)),ypos+(size*8)*p*(Sin(textangle*cr)))
                rotate(c2,cpt(_x1),charangle,1)
               if flag then np.y=copyy
                cpt(_x1)=np
            End If
            If infoarray(_x1,asci).x<>0 Then 'paint only relevant points
                If Abs(size)>1 Then
                    line(cpt(_x1).x-size/2,cpt(_x1).y-size/2)-(cpt(_x1).x+size/2,cpt(_x1).y+size/2),cpt(_x1).col,bf
                Else
                    Pset im,(cpt(_x1).x,cpt(_x1).y),cpt(_x1).col
                End If
            End If
        Next _x1
        dx=dx+8+4*(sin(charangle*cr))*flag
        skip:
    Next z6
End Sub
'8 by 16
Sub drawstring16(xpos As Integer,ypos As Integer,text As String,colour As Uinteger,size As Single,textangle As Single=0,charangle As Single=0,im As Any Pointer=0)
    Type point2d
        As Single x,y
        As Uinteger col
    End Type
    Dim As Integer flag,codenum=256
    if instr(text,"|") then flag=1
    Static As Integer runflag
    Static As point2d infoarray()
    Redim Preserve As point2d infoarray(128,codenum) '64 = 8 x 8 pixel size
    If runflag=0 Then   '                  'scan codenum of codepage once
        Dim As Uinteger background=0
        screen 8
        width 640\8,200\16  'new setting to 8 by 16 pixels
        Dim count As Integer
        For ch As Integer=1 To codenum
            Cls
            Draw String(1,1),Chr(ch)
            For x As Integer=1 To 8  'scan for characters
                For y As Integer=1 To 16
                    If Point(x,y)<>background Then
                        count=count+1
                        infoarray(count,ch)=Type<point2d>(x,y)'save pixel position
                    End If
                Next y
            Next x
            count=0
        Next ch
        runflag=1
    End If
    If size=0 Then Exit Sub
    Dim As point2d temp(1 To 128,codenum),np
    Dim As Single cr= 0.01745329 'degs to radians
    #macro rotate(p1,p2,a,d)
    np.col=p2.col
    np.x=d*(Cos(a*cr)*(p2.x-p1.x)-Sin(a*cr)*(p2.y-p1.y)) +p1.x
    np.y=d*(Sin(a*cr)*(p2.x-p1.x)+Cos(a*cr)*(p2.y-p1.y)) +p1.y
    #endmacro
   
    Dim As point2d cpt(1 To 128),c=Type<point2d>(xpos,ypos),c2
    Dim As Integer dx=xpos,dy=ypos
    For z6 As Integer=1 To Len(text)
        var asci=text[z6-1]
        If asci=124 Then
            if charangle<>0 then xpos=xpos+12*sin(charangle*cr)
            dx=xpos:dy=dy+16:Goto skip 'pipe | for new line
        End If
        For _x1 As Integer=1 To 128
            temp(_x1,asci).x=infoarray(_x1,asci).x+dx
            temp(_x1,asci).y=infoarray(_x1,asci).y+dy
            temp(_x1,asci).col=colour
            rotate(c,temp(_x1,asci),textangle,size)
            cpt(_x1)=np
            var copyy=np.y
            If charangle<>0 Then
                dim as integer p
              if flag then  p=1 else  p=(z6-1)
c2=Type<point2d>(xpos+(size*8)*p*(Cos(textangle*cr)),ypos+(size*8)*p*(Sin(textangle*cr)))
                rotate(c2,cpt(_x1),charangle,1)
               if flag then np.y=copyy
                cpt(_x1)=np
            End If
            If infoarray(_x1,asci).x<>0 Then 'paint only relevant points
                If Abs(size)>1 Then
                    line(cpt(_x1).x-size/2,cpt(_x1).y-size/2)-(cpt(_x1).x+size/2,cpt(_x1).y+size/2),cpt(_x1).col,bf
                Else
                    Pset im,(cpt(_x1).x,cpt(_x1).y),cpt(_x1).col
                End If
            End If
        Next _x1
       
        dx=dx+8+4*(sin(charangle*cr))*flag
        skip:
    Next z6
End Sub
Sub init16 Constructor 'automatic loader
    drawstring16(0,0,"",0,0)
    Screen 0
End Sub
Sub init8 Constructor 'automatic loader
    drawstring8(0,0,"",0,0)
    Screen 0
End Sub

screen 20,32
drawstring8(100,80,"8 X 8",rgb(200,0,0),1)
drawstring8(100,100,"ABCDEFGHIJKLMNOPQ|abcdefg0123456789",rgb(200,200,200),5)

drawstring16(100,380,"8 X 16",rgb(200,0,0),1)
drawstring16(100,400,"ABCDEFGHIJKLMNOPQ|abcdefg0123456789",rgb(200,200,200),5)
sleep
 

Return to “DOS”

Who is online

Users browsing this forum: No registered users and 0 guests