Changing the FONT in Drawtext

Started by Baggey, December 11, 2021, 21:38:15

Previous topic - Next topic

Baggey

Changing the Text in Drawtext?

The "Y" that's printed in Drawtext is distorted! "Can we Change it!?"

Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!

Derron

SetImageFont()

https://blitzmax.org/docs/en/api/brl/brl.max2d/#function-drawtext-txy-
> DrawText prints strings at position x,@y of the graphics display using the current image font specified by the SetImageFont command.

https://blitzmax.org/docs/en/api/brl/brl.max2d/#function-setimagefont-fonttimagefont-
> In order to DrawText in fonts other than the default system font use the SetImageFont command with a font handle returned by the LoadImageFont command.

... and so on


bye
Ron

Midimaster

#2
This show how to change Fonts in BlitzMax

****UPDATE****
I named one of my variables BoldFont, but this is already a INT constant BOLDFONT.

So this works:
Code (BlitzMax) Select
SuperStrict
Graphics 800,600
Global Font:TimageFont      = LoadImageFont("arial.ttf",50,SMOOTHFONT)
Global SmallFont:TimageFont = LoadImageFont("arial.ttf",16,SMOOTHFONT)
Global MyBoldFont:TimageFont  = LoadImageFont("arial.ttf",160,BOLDFONT+SMOOTHFONT)
Repeat
    Cls
    SetImageFont Font
    DrawText "Big Font" , 100,100

    SetImageFont SmallFont
    DrawText "Small Font" , 100,200

    SetImageFont MyBoldFont
    DrawText "BIG" , 100,300
    Flip
Until Appterminate()
...back from North Pole.

Baggey

I have an idea,

So if the Format is .ttf. I could open it and change the relevant bytes for the "Y". Then Save it and the "Y" will no longer be Distorted!

How do i know what text is being used as the Default in the Drawtext comand. I dont know what the "FILE_Name.ttf" is  ::)

Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!

Baggey

#4
So found a Command called:- GetImageFont:TImageFont()

This is supposedly the help system. So as it stands the command is unusable ??? I shall experiment further i suppose im looking for a string?

QuoteFunction GetImageFont:TImageFont()

Get current image font.
Returns

The current image font.

So, There's a little point here! I dont know how to use GetimageFont() and the "HELP dosent HELP!" So how dose one learn :o BY EXAMPLE'S of course!

The code below dosent work!?

Code (blitzmax) Select


SuperStrict

Graphics 800,600

' I think im looking for a string?

Global CurrentFont:String = GetImageFont()

While Not AppTerminate() Or KeyHit(key_escape)

    DrawText("FONT is "+CurrentFont,10,10)
    'Print font

Wend


Kind Regards Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!

Baggey

Quote from: Midimaster on December 12, 2021, 01:02:44
You can use any true type font you find in the Windows-System folders or in the internet. The correct ending needs to be  "*.ttf".

Copy the font-file into the source dir of your *.bmx and then...

Code (BlitzMax) Select
SuperStrict
Graphics 800,600
Global Font:TimageFont      = LoadImageFont("arial.ttf",50,SMOOTHFONT)
Global SmallFont:TimageFont = LoadImageFont("arial.ttf",16,SMOOTHFONT)
Global BoldFont:TimageFont  = LoadImageFont("arial.ttf",160,BOLDFONT+SMOOTHFONT)
Repeat
    Cls
    SetImageFont Font
    DrawText "Big Font" , 100,100

    SetImageFont SmallFont
    DrawText "Small Font" , 100,200

    SetImageFont BoldFont
    DrawText "BIG" , 100,300
    Flip
Until Appterminate()


To change font size or style like bold or italice you have to load different fonts first, the use them afterward by changing them with SetImageFont

I cannot use the following line? "Global BoldFont:TimageFont  = LoadImageFont("arial.ttf",160,BOLDFONT+SMOOTHFONT)" This is BlitzmaxNG?

Kind Regards Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!

Midimaster

#6
Sorry my mistake....

In the example I named one of my variable BoldFont, but this is already a const BOLDFONT!

So this works:

This works:
Code (BlitzMax) Select
SuperStrict
Graphics 800,600
Global Font:TimageFont      = LoadImageFont("arial.ttf",50,SMOOTHFONT)
Global SmallFont:TimageFont = LoadImageFont("arial.ttf",16,SMOOTHFONT)
Print "S=" + BOLDFONT
Global MyBoldFont:TimageFont  = LoadImageFont("arial.ttf",160, BOLDFONT+SMOOTHFONT)
Repeat
    Cls
    SetImageFont Font
    DrawText "Big Font" , 100,100

    SetImageFont SmallFont
    DrawText "Small Font" , 100,200

    SetImageFont MyBoldFont
    DrawText "BIG" , 100,300
    Flip
Until AppTerminate()



by the way... what is exact the problem you have with Y? is it with the character "Y" or with the y-coordinates? Can you send a screenshot of the probem?
...back from North Pole.

Baggey

#7
Its the Character "Y" it looks more like "y" when used in Drawtext on screen. I want to make it a Proper Capital "Y".

If i knew the .ttf file name and where it lives id alter the bit map for the character.  :-\

if you look at the "y"'s on screen there not correct CAPITOL "Y" Character?



Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!

Midimaster

#8
You are still using the BlitzMax-buildin-startup-font. This is only a compromise solution for people, who forget to load a font. Normally you should load at minimum one own font.

Yo have only a little chance to change the "Y" in the StartUp-Font, because it is attached as a bin-file. The function CreateDefault() builds from this a TPixMap and from this an array font._glyphs[] with 96 characters stored in an "TImage font._glyphs[]._image" See "imagefont.bmx".  The Y is member 89 of this array. The image is a 8x16pix image.

A better idea is to find a better looking font and load it with LoadImageFont(). Only 2 font in windows  are monospaced: "Courier" and "Lucidia", and both have a Y like you are searching it.

Or search here: https://www.1001freefonts.com/de/fixed-width-fonts.php
...back from North Pole.

Baggey

#9
Quote from: Midimaster on December 12, 2021, 17:17:28
You are still using the BlitzMax-buildin-startup-font. This is only a compromise solution for people, who forget to load a font. Normally you should load at minimum one own font.

Yo have only a little chance to change the "Y" in the StartUp-Font, because it is attached as a bin-file. The function CreateDefault() builds from this a TPixMap and from this an array font._glyphs[] with 96 characters stored in an "TImage font._glyphs[]._image" See "imagefont.bmx".  The Y is member 89 of this array. The image is a 8x16pix image.

A better idea is to find a better looking font and load it with LoadImageFont(). Only 2 font in windows  are monospaced: "Courier" and "Lucidia", and both have a Y like you are searching it.

Or search here: https://www.1001freefonts.com/de/fixed-width-fonts.php


Thanks for the INFO! You've got me thinking again! if it's a Binary file with 96 characters in a 8x16 pix/Bit map. Maybe i could make my own? C64 FONT!  8)  I searched on the start button and it fired! .o .incbin.o and many others!

I have the Character.rom of the C64 which is 8x8 so if i streched it! to repeat every row. I'd have 8x16 :-X

So, i need to open the CORRECT FILE, and Sort the bytes into a viewable pix Map, then load in my own characters! Then save as the original file and i have a Customized C64 Font for BlitzmaxNG IDE Drawtext() command! 

So id have my own cuztomised C64 FONT! :o

For my C64 Blitzmax Emulator IDE ::)

Kind Regards Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!

Midimaster

#10
Yes, you can add a font with a similar function like CreateDefault().

There are two ways:

Create a "C64.bin"-file

...and use the CreateDefault() as it is. The "*.bin"-format is something like a uncompressed 1bit PNG with size 1536Bytes = 96 Bytes per row x 16 rows. The bin file has no header and no image-information... only data. No compression.

The first 96 Bytes represent the 96 characters. The 8bits in each Byte represent the 8 x-pixels of the first row of the characters. After the first 96 bytes the next 96 bytes represent the second lines (of all 96 characters), and so on until the 16th row.

With this you use the complete CreateDefault() function, which will render you the 96 glyphs from the bin-file



second way:

Create a "C64.png"-file

...and use only the lower part of the CreateDefault(). The "*.png" needs to be a RGBA 32bit-png with 768x16pix. Each pixel is 4Bytes long and there are only two pixel types: $00000000 or $11111111. Load this as a TPixMap and use only the lower part of the CreateDefault() function


The CreateDefault() in "imagefont.bmx"

Your function would be similar to this and extends the type TImageFont

Code (BlitzMax) Select
Function CreateDefault:TImageFont()

Local font:TImageFont=New TImageFont
font._glyphs=New TImageGlyph[96]

Local pixmap:TPixmap=TPixmap.Create( 96*8,16,PF_RGBA8888 )

Local p:Byte Ptr=IncbinPtr( "blitzfont.bin" )

For Local y=0 Until 16
For Local x=0 Until 96
Local b=p[x]
For Local n=0 Until 8
If b & (1 Shl n)
pixmap.WritePixel x*8+n,y,~0
Else
pixmap.WritePixel x*8+n,y,0
EndIf
Next
Next
p:+96
Next

For Local n=0 Until 96
Local glyph:TImageGlyph=New TImageGlyph
font._glyphs[n]=glyph
glyph._advance=8
glyph._w=8
glyph._h=16
glyph._image=TImage.Load( pixmap.Window(n*8,0,8,16).Copy(),0,0,0,0 )
Next

Return font
End Function



If you need more help... let me know.
...back from North Pole.

Baggey

Thanks, I have just found where the File lives Now i can alter it  :P

Baggey

Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!

Baggey

#12
Quote from: Midimaster on December 13, 2021, 02:31:20
Yes, you can add a font with a similar function like CreateDefault().

There are two ways:

Create a "C64.bin"-file

...and use the CreateDefault() as it is. The "*.bin"-format is something like a uncompressed 1bit PNG with size 1536Bytes = 96 Bytes per row x 16 rows. The bin file has no header and no image-information... only data. No compression.

The first 96 Bytes represent the 96 characters. The 8bits in each Byte represent the 8 x-pixels of the first row of the characters. After the first 96 bytes the next 96 bytes represent the second lines (of all 96 characters), and so on until the 16th row.

With this you use the complete CreateDefault() function, which will render you the 96 glyphs from the bin-file



second way:

Create a "C64.png"-file

...and use only the lower part of the CreateDefault(). The "*.png" needs to be a RGBA 32bit-png with 768x16pix. Each pixel is 4Bytes long and there are only two pixel types: $00000000 or $11111111. Load this as a TPixMap and use only the lower part of the CreateDefault() function


The CreateDefault() in "imagefont.bmx"

Your function would be similar to this and extends the type TImageFont

Code (BlitzMax) Select
Function CreateDefault:TImageFont()

Local font:TImageFont=New TImageFont
font._glyphs=New TImageGlyph[96]

Local pixmap:TPixmap=TPixmap.Create( 96*8,16,PF_RGBA8888 )

Local p:Byte Ptr=IncbinPtr( "blitzfont.bin" )

For Local y=0 Until 16
For Local x=0 Until 96
Local b=p[x]
For Local n=0 Until 8
If b & (1 Shl n)
pixmap.WritePixel x*8+n,y,~0
Else
pixmap.WritePixel x*8+n,y,0
EndIf
Next
Next
p:+96
Next

For Local n=0 Until 96
Local glyph:TImageGlyph=New TImageGlyph
font._glyphs[n]=glyph
glyph._advance=8
glyph._w=8
glyph._h=16
glyph._image=TImage.Load( pixmap.Window(n*8,0,8,16).Copy(),0,0,0,0 )
Next

Return font
End Function



If you need more help... let me know.

Here's where im still learning Blitmax Code

Ive found where the file lives. Ive altered the code you given me and managed to drawpixmap making it a Global variable!

Reading the code :-

I understand we open the file "blitzfont.bin" with a Pointer

The for and next loops scan through the Font looking at the bytes and we then shift the pixels looking at individual bits to create an image which looks like its stored in an array of 96 images! Im missing the bit where it's passing the font back. Id like to access the individual images font._glyphs[57]=glyph Any ideas to save me doing it the hardway!

Code ive altered to see glyp[52]

Code (blitzmax) Select

'SuperStrict

Graphics 800,600
Global pixmap:TPixmap=TPixmap.Create( 96*8,16,PF_RGBA8888 )
Global glyph:TImageGlyph=New TImageGlyph
createdefault()


While Not AppTerminate() And Not KeyHit(KEY_ESCAPE)

  Cls

 
   DrawPixmap pixmap,0,0

   DrawPixmap glyph._glyphs[52]

  Flip(0)

Wend


    Function CreateDefault:TImageFont()
     
                    Local font:TImageFont=New TImageFont
                    font._glyphs=New TImageGlyph[96]
                   
                   
                   
                    Local p:Byte Ptr=IncbinPtr( "blitzfont.bin" )
           
                    For Local y=0 Until 16
                            For Local x=0 Until 96
                                    Local b=p[x]
                                    For Local n=0 Until 8
                                            If b & (1 Shl n)
                                                    pixmap.WritePixel x*8+n,y,~0
                                            Else
                                                    pixmap.WritePixel x*8+n,y,0
                                            EndIf
                                    Next
                            Next
                            p:+96
                    Next
     
                    For Local n=0 Until 96
                           
                            font._glyphs[n]=glyph
                            glyph._advance=8
                            glyph._w=8
                            glyph._h=16
                            glyph._image=TImage.Load( pixmap.Window(n*8,0,8,16).Copy(),0,0,0,0 )
                    Next
           
                    Return font

           
            End Function


Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!

Midimaster

#13
See a short example how Types and classes wort at the end of the post...

This all happens inside two classes (types). so you cannot simply use the variables without this classes. A lot of variables are defined in the type, f.e. the array _glyphs[]

' imagefont.bmx
Type TImageGlyph
Field _image:TImage
Field _advance#,_x,_y,_w,_h
....


Type TImageFont
Field _src_font:TFont
Field _glyphs:TImageGlyph[]
Field _imageFlags
...


Please let us rename your current CreateDefault() to CreateMyDefault(). This CreateMyDefault() returns a TImageFont. If you want to call the glyphs inside it you have to call them as field of  the returned font. The glyphs are no pixmaps nor images, they are again a type. And inside this type there is the field _image, which is the TImage of the character. We can call this:
Global MyFont:TImageFont=CreateMyDefault()
....
   DrawImage MyFont._glyphs[52]._image, 10,10
....



The function CreateMyDefault() creates a new TImageFont. One of the fields of it is a array _glyphes[96]. This 96 members of the array are 96 TImageGlyph's. Each TImageGlyph has again 6 fields, one of them is the field _image, which is a real TImage


This is not allowed:
                   For Local n=0 Until 96
                           
                            font._glyphs[n]=glyph  'WRONG all 96 would point to the same global glyph
                            glyph._advance=8
                            glyph._w=8
                            glyph._h=16
                            glyph._image=TImage.Load( pixmap.Window(n*8,0,8,16).Copy(),0,0,0,0 )
                    Next


This woud be better (not tested):
                   For Local n=0 Until 96
                           font._glyphs[n]= New TImageGlyph
                           font._glyphs[n]._advance=8
                            font._glyphs[n]._w=8
                            font._glyphs[n]._h=16
                            font._glyphs[n]._image=TImage.Load( pixmap.Window(n*8,0,8,16).Copy(),0,0,0,0 )
                    Next


or keep it as it formerly was:
Function CreateDefault:TImageFont()

Local font:TImageFont=New TImageFont
font._glyphs=New TImageGlyph[96]
...
For Local n=0 Until 96
Local glyph:TImageGlyph=New TImageGlyph
glyph._advance=8
glyph._w=8
glyph._h=16
glyph._image=TImage.Load( pixmap.Window(n*8,0,8,16).Copy(),0,0,0,0 )

font._glyphs[n]=glyph
Next

Return font
End Function



Easy to understand example of nested Types
There are restaurants. The restaurant have several properties (fields). One of them is the "list of meals" they offer: Meals[99]. This meals are organized in a separate type with some proerties, that descripe that meal: Name of the food, weight and price.

A code would look like this:

Code (BlitzMax) Select
Type TMeal
Field Weight:Int
Field Name$
Field Price#
End Type


Type TRestaurant
Field Meals:TMeal[99]
Field Name$
End Type


MyBar:TRestaurant= New TRestaurant
MyBar.Name="Peter's Bar"

MyBar.Meal[1]        = New TMeal
MyBar.Meal[1].Name   = "Big Buger"
MyBar.Meal[1].Weight = 240
...

' how to show (call) one propery of one meal:
DrawText MyBar.Meal[14].Price, 100,100
...back from North Pole.

Baggey

#14
Thankyou for that.

I can only use the data if i make it global! I some how think that the function returns data to be used in some way? But im not sure how!? ONLY if i make it global.

Ive altered the "Y" , Now i can Drawimage font.glyp_[57] Which is the "Y" Character.

Now, Somehow i need to save this back to original file? ie, "blitzfont.bin"  :-X

I suppose the same code but backwards so to speak.

This then would have effect on the Drawtext command! if saved to the original directory.

My code which is Runable in BlitzmaxNG. you need to paste the "Blitzfont.bin" file in the folder as well! to use it.

Code (blitzmax) Select

'
SuperStrict
'
' Vesion_1.01
'
AppTitle = "Drawtext() Character Designer"
'   
Graphics 800,600
'
Global FontPixMap1:TPixmap=TPixmap.Create(96*8,16,PF_RGBA8888)
Global FontPixmap2:TPixmap=TPixmap.Create(96*8,16,PF_RGBA8888)
Global GlyphImage:TImage[96]
Global Character:Byte=57
Global Time:Int=MilliSecs() , Flash:Byte=0 , BlinkRate:Int=700

Global DebugMsg:String="Nothing to say!"
'
CreateGlyphPixmap()
Create96GlyphImages()
'
While Not AppTerminate() And Not KeyHit(KEY_ESCAPE)
   '   
   Cls
   '
   DrawPixmap FontPixMap1,0,14
   SetColor 0,0,255
   DrawPixmap FontPixMap2,0,28
   '
   FlashCursor()
   '
   Checkeys()
   DrawMousePosition()
   '
   SetColor 220,0,0
   DrawText("CHARACTER "+Character+"   ASCII "+(Character+32),8,56)
   '
   SetColor 255,255,255
   DrawGlyph(Character)
 
   DrawBigChar(Character,8,70,8,8)'SetScale(8,8) ; DrawText(Chr(Character+32),100,56) ;  SetScale(1,1)

   '
   'Print ~0 ' What is this?
   '
   '
   ' CODE HERE READY TO TURN INTO FUNCTION
   '
       If MouseHit(1) Then
       '
       Local xpos:Int=MouseX(), ypos:Int=MouseY()
            '
            If xpos>=176 And xpos<=199 Then
              '
              Select True
                 '
                 Case ypos>=82 And ypos<=89  ; DebugMsg = "first row"
                 Case ypos>=95 And ypos<=102 ; DebugMsg = "Second row"
                 '
                  Default DebugMsg="Nothing To say!"
              End Select
              '
           End If   
           '
       End If
   '
   '             
   'SetColor 255,100,200 ' Pink
   SetColor 255,100,200  ' Magenta
   DrawText ("Debug Messaging ... "+DebugMsg,8,580)
   Flip(0)
   '
Wend
'
'
Function DrawMousePosition()
   '
   DrawText("USE X,Y Feedback to SETMOUSE Position  X="+MouseX()+"  Y="+MouseY(),8,318)
   '
End Function
'
'
Function DrawBigChar(character:Int,PosX:Int,PosY:Int,scaleX:Int,scaleY:Int)
'
    SetColor 200,50,255
    SetScale(scaleX,scaleY) ; DrawText(Chr(Character+32),PosX,PosY) ;  SetScale(1,1)
'
End Function
'
'
Function FlashCursor()
'
   ' Time is a difficult thing!
   '
   If MilliSecs() > (Time + BlinkRate) Then
       Flash = 1
       Time = MilliSecs()
     Else If (MilliSecs() > (Time + (BlinkRate/4))) And (MilliSecs() < (Time + (BlinkRate/2))) Then
       Flash = 2
     Else If (MilliSecs() > (Time + (BlinkRate/2))) And (MilliSecs() < (Time + BlinkRate)) Then
       Flash = 3
   End If
   '
   Select Flash
          Case 1 ; SetColor 150,0,0
          Case 2 ; SetColor 190,0,0
          Case 3 ; SetColor 255,0,0
   End Select
   '
   DrawImage GlyphImage[Character],(8*Character),42
   '
End Function
'
'
Function Checkeys()
   '
   Local keyed:Int=GetChar()
   Print keyed
   If Keyed=(46) And (Character<=95) Then Character:+1 ' Hmm? period is a fullstop!?
   If (Character=96) Then Character=0
   If Keyed=(44) And (Character>=0) Then Character:-1
   If (Character=(255)) Then Character=95
   '
End Function
'
'
Function Create96GlyphImages()
   '
   For Local n:Byte=0 Until 96
      '
      ' .Window is like a [Viewport 8*16]
      GlyphImage[n]=TImage.Load(FontPixMap1.Window(n*8,0,8,16).Copy(),0,0,0,0)
      '
   Next
   '
End Function
'
'
Function DrawGlyph(Character:Byte)
   '
   Local p:Byte Ptr=IncbinPtr( "blitzfont.bin" )
   '
   For Local y:Byte=0 Until 16
     '
     Local bits:Byte=swapBits(p[Character])
     '
     DrawText(RSet(Bin(bits),8).Replace("0",".").Replace("1","#")+" = "+(RSet(bits, 3).Replace(" ", "0")),88,(y+6)*14-4)
     '
     p:+96
     '
    Next
    '
End Function
'
'
Function CreateGlyphPixmap()
   '
   Local p:Byte Ptr=IncbinPtr( "blitzfont.bin" )
   '
   For Local y:Byte=0 Until 16
      '
      For Local x:Byte=0 Until 96
         '
         Local b:Byte=p[x], b2:Byte=p[x]       
         Local bits:Byte=swapBits(p[x])
         '
            Select True
               '
               Case y=2  And x=57 b2=102
               Case y=3  And x=57 b2=102
               Case y=4  And x=57 b2=102
               Case y=5  And x=57 b2=102
               Case Y=6  And x=57 b2=36
               Case Y=7  And x=57 b2=24
               Case Y=8  And x=57 b2=24
               Case Y=9  And x=57 b2=24
               Case Y=10 And x=57 b2=24
               '
            End Select
         '
         DrawText(Right(Bin(bits),8)+" = "+(RSet(bits, 3).Replace(" ", "0")),20,(y+5)*14)
         'Print "P is "+p+" ... "+Right(Bin(b),8)+"  "+b
         For Local n:Byte=0 Until 8
           '
           If b & (1 Shl n)
                  FontPixMap1.WritePixel x*8+n,y,(-1)
              Else
                  FontPixMap1.WritePixel x*8+n,y,0
           EndIf
           '
           If b2 & (1 Shl n)
                  FontPixMap2.WritePixel x*8+n,y,(-1)
              Else
                  FontPixMap2.WritePixel x*8+n,y,0
           EndIf
           '
         Next
         '
      Next
      '
      p:+96
      '
Next
'
End Function
'
'
Function SwapBits:Byte(ByteIn:Byte)
   '
   Local LeftBit:Byte=7, RightBit:Byte=0
   '
   For Local loop:Byte=1 To 4
       '
       Select loop
       '
           Case 1 ' Swap Bits 7 And 0
                  LeftBit=(ByteIn & 128) <> 0
                  RightBit=(ByteIn & 1) <> 0
                  '
                  ' Now Exchange Bit's
                  If RightBit=1 Then ByteIn=(ByteIn|128) Else ByteIn=(ByteIn&127)
                  If LeftBit=1 Then ByteIn=(ByteIn | 1) Else ByteIn=(ByteIn & 254)
                  '
           Case 2 ' Swap Bits 6 And 1
                  LeftBit=(ByteIn & 64) <> 0
                  RightBit=(ByteIn & 2) <> 0
                  '
                  ' Now Exchange Bit's
                  If RightBit=1 Then ByteIn=(ByteIn | 64) Else ByteIn=(ByteIn & 191)
                  If LeftBit=1 Then ByteIn=(ByteIn | 2) Else ByteIn=(ByteIn & 253)
                  ' 
           Case 3 ' Swap Bits 5 And 2
                  LeftBit=(ByteIn & 32) <> 0
                  RightBit=(ByteIn & 4) <> 0
                  '
                  ' Now Exchange Bit's
                  If RightBit=1 Then ByteIn=(ByteIn | 32) Else ByteIn=(ByteIn & 223)
                  If LeftBit=1 Then ByteIn=(ByteIn | 4) Else ByteIn=(ByteIn & 251)
                  '
           Case 4 ' Swap Bits 4 And 3
                  LeftBit=(ByteIn & 16) <> 0
                  RightBit=(ByteIn & 8) <> 0
                  '
                  ' Now Exchange Bit's
                  If RightBit=1 Then ByteIn=(ByteIn | 16) Else ByteIn=(ByteIn & 239)
                  If LeftBit=1 Then ByteIn=(ByteIn | 8) Else ByteIn=(ByteIn & 247)
                  '
        End Select
        '
    Next
    '
    Return ByteIn
    '
End Function


Anyone learning or has any idea's to alter or perfect my code in anyway please do! Speed is the KEY!  ;)

Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!