Grafik-Font 3x5 & 5x5 Pixel

  • 1
  • 2
  • Page 1 of 2
Harry
Moderator
Avatar
Gender:
Location: zwischen Augsburg und Ulm
Age: 59
Posts: 2077
Registered: 03 / 2003
Subject:

Grafik-Font 3x5 & 5x5 Pixel

 · 
Posted: 21.12.2020 - 14:26  ·  #1
Hallo @ all,

habs doch getan .... einen 3x5 Pixel-Font mit einer (vorerst) einfachen Ausgaberoutine gemacht.
Die Zeichen #00 - #31 sind nicht definiert. Keine Drehung. Oben links ist die Koordinatenangabe.

Noch schnell was zum Aufbau des Arrays: Der erste Wert der 3er-Gruppe ist im Zeichen links, der 2. Mitte, der 3. rechts. Verwendet wird vom Byte 2^0 - 2^4, wobei 2^0 im Zeichen oben ist.

Beispiel '2' = $19,$15,$12
Code
$19 = %xxx11001 = . . . x x     x
$15 = %xxx10101 = . . . x   x   x
$12 = %xxx10010 = . . . x     x   

..... Kopf nach rechts neigen und schauen :D

Gruss
Harry

Code

Const
  SF3x5     : Array[0..383] of Byte =  ($00,$00,$00, $00,$00,$00, $00,$00,$00, $00,$00,$00,   //   0
                                        $00,$00,$00, $00,$00,$00, $00,$00,$00, $00,$00,$00,   //   4
                                        $00,$00,$00, $00,$00,$00, $00,$00,$00, $00,$00,$00,   //   8
                                        $00,$00,$00, $00,$00,$00, $00,$00,$00, $00,$00,$00,   //  12
                                        $00,$00,$00, $00,$00,$00, $00,$00,$00, $00,$00,$00,   //  16
                                        $00,$00,$00, $00,$00,$00, $00,$00,$00, $00,$00,$00,   //  20
                                        $00,$00,$00, $00,$00,$00, $00,$00,$00, $00,$00,$00,   //  24
                                        $00,$00,$00, $00,$00,$00, $00,$00,$00, $00,$00,$00,   //  28
                                        $00,$00,$00, $00,$17,$00, $03,$00,$03, $1F,$0A,$1F,   //  32 Space ! " #
                                        $16,$1F,$0D, $19,$04,$13, $0A,$15,$1A, $00,$03,$00,   //  36 $ % & '
                                        $00,$0E,$11, $11,$0E,$00, $0A,$04,$0A, $04,$0E,$04,   //  40 ( ) * +
                                        $10,$08,$00, $04,$04,$04, $00,$10,$00, $10,$0C,$03,   //  44 , - . /
                                        $1F,$11,$1F, $12,$1F,$10, $19,$15,$12, $15,$15,$0A,   //  48 0 1 2 3
                                        $07,$04,$1F, $17,$15,$09, $0E,$15,$09, $19,$05,$03,   //  52 4 5 6 7
                                        $1F,$15,$1F, $17,$15,$0F, $00,$0A,$00, $10,$0A,$00,   //  56 8 9 : ;
                                        $04,$0A,$11, $0A,$0A,$0A, $11,$0A,$04, $02,$19,$06,   //  60 < = > ?
                                        $0E,$15,$16, $1E,$05,$1E, $1F,$15,$0A, $0E,$11,$11,   //  64 @ A B C
                                        $1F,$11,$0E, $1F,$15,$11, $1F,$05,$01, $0E,$11,$1D,   //  68 D E F G
                                        $1F,$04,$1F, $00,$1F,$00, $10,$0F,$00, $1F,$04,$1B,   //  72 H I J K
                                        $1F,$10,$10, $1F,$06,$1F, $1F,$0E,$1F, $0E,$11,$0E,   //  76 L M N O
                                        $1F,$05,$02, $06,$09,$16, $1F,$05,$1A, $12,$15,$09,   //  80 P Q R S
                                        $01,$1F,$01, $0F,$10,$0F, $07,$18,$07, $1F,$0C,$1F,   //  84 T U V W
                                        $1B,$04,$1B, $03,$1C,$03, $19,$15,$13, $00,$1F,$11,   //  88 X Y Z [
                                        $03,$0C,$10, $11,$1F,$00, $02,$01,$02, $10,$10,$10,   //  92  ] ^ _
                                        $02,$05,$02, $0C,$12,$1C, $1F,$12,$0C, $0C,$12,$12,   //  96 ° a b c
                                        $0C,$12,$1F, $0C,$1A,$14, $04,$1F,$05, $14,$1A,$0C,   // 100 d e f g
                                        $1F,$02,$1C, $00,$1D,$00, $10,$0D,$00, $1F,$08,$14,   // 104 h i j k
                                        $00,$1F,$00, $1E,$06,$1E, $1C,$02,$1C, $0C,$12,$0C,   // 108 l m n o
                                        $1E,$0A,$04, $04,$0A,$1E, $1E,$04,$02, $14,$0A,$00,   // 112 p q r s
                                        $02,$1F,$02, $0E,$10,$0E, $06,$18,$06, $0E,$18,$0E,   // 116 t u v w
                                        $12,$0C,$12, $16,$08,$0E, $1A,$1E,$16, $04,$1F,$11,   // 120 x y z {
                                        $00,$1B,$00, $11,$1F,$04, $06,$02,$03, $1F,$1F,$1F);  // 124 | } ~ Block

// Ausgabe Text als 3x5-Matrix; 0,0 ist immer oben, links
Procedure chDraw3x5(X,Y:Integer;Text:String[32]);
  Var XC   : Integer;
      CC   : Integer;
      PC   : Integer;
  Begin
    For XC:=1 to Length(Text) do
      PC:=Integer(Ord(Text[XC]));
      For CC:=0 to 2 do
        gDrawLine(X+((XC-1)*4)+CC,Y,X+((XC-1)*4)+CC,Y+4,Mirror8(SF3x5[PC*3+CC]));
        EndFor;
      EndFor;
  End chDraw3x5;

.
.
.

    chDraw3x5(105,111,' !"#$%&'+#39+'()*+,-./0123456789:;<=>?');
    chDraw3x5(105,117,'@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_');
    chDraw3x5(105,123,#96+'abcdefghijklmnopqrstuvwxyz{|}~'+#127);


[Edit]Hab das 'r' geändert, es hat mir nicht gefallen. Rechts oberhalb ist jetzt noch ein Punkt dazu gekommen.

[Edit]"f" hatte einen Fehler
You must be logged in or your permissions are to low to see this Attachment(s).
Harry
Moderator
Avatar
Gender:
Location: zwischen Augsburg und Ulm
Age: 59
Posts: 2077
Registered: 03 / 2003
Subject:

Re: Grafik-Font 3x5 Pixel

 · 
Posted: 22.12.2020 - 12:20  ·  #2
Fertig :) .... TxtRot0, 90, 180 und 270 funktionieren.
Was nicht geht und was ich auch nicht vor habe zu implementieren, ist gSetTextJustify, gSetTextMode und gSetTextBkGnd. Da die Ausgabe eigentlich kein Text ist, sondern Linien mit Mustern, wäre das auch nicht ganz so einfach .... ok gSetTextJustify könnte man evtl. mit einem Offset erschlagen.

[Edit]Das Thema hatte ich früher schon mal angesprochen: topic.php?t=3262

Code
Procedure chDraw3x5(X,Y:Integer;TRotation:TTxtRotate;Text:String[32]);
  Var XC          : Integer;
      X2,Y2       : Integer;
      CC          : Integer;
      PC          : Integer;
  Begin
    For XC:=1 to Length(Text) do
      PC:=Integer(Ord(Text[XC]));
      Case TRotation of
        TxtRot0  :X2:=X+((XC-1)*4);
                  Y2:=Y+4;
                  For CC:=0 to 2 do
                    gDrawLine(X2+CC,Y,X2+CC,Y2,Mirror8(SF3x5[PC*3+CC]));
                    EndFor;
                 |
        TxtRot90 :X2:=X+4;
                  Y2:=Y-((XC-1)*4);
                  For CC:=0 to 2 do
                    gDrawLine(X,Y2-CC,X2,Y2-CC,Mirror8(SF3x5[PC*3+CC]));
                    EndFor;
                 |
        TxtRot180:X2:=X-((XC-1)*4);
                  Y2:=Y-4;
                  For CC:=0 to 2 do
                    gDrawLine(X2-CC,Y,X2-CC,Y2,(SF3x5[PC*3+CC]) SHL 3);
                    EndFor;
                 |
        TxtRot270:X2:=X-4;
                  Y2:=Y+((XC-1)*4);
                  For CC:=0 to 2 do
                    gDrawLine(X,Y2+CC,X2,Y2+CC,(SF3x5[PC*3+CC]) SHL 3);
                    EndFor;
                 |
        EndCase;
      EndFor;
  End chDraw3x5;


Die an die Procedure übergebenen Koordinaten beziehen sich immer auf den oberen linken Punkt des Textes bzw. des ersten Zeichens, egal in welche Richtung man schreibt.

Die Ausgabe im Foto erfolgte so (das Display hat 240x128 Pixel):
Code
    chDraw3x5(  0,  0,TxtRot0,' !"#$%&'+#39+'()*+,-./0123456789:;<=>?');
    chDraw3x5(  0,  6,TxtRot0,'@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_');
    chDraw3x5(  0, 12,TxtRot0,#96+'abcdefghijklmnopqrstuvwxyz{|}~'+#127);
    gDrawString(84,18,1,1,TxtRot0,'TxtRot0');

    chDraw3x5(  0,127,TxtRot90,' !"#$%&'+#39+'()*+,-./0123456789:');
    chDraw3x5(  6,127,TxtRot90,'@ABCDEFGHIJKLMNOPQRSTUVWXYZ');
    chDraw3x5( 12,127,TxtRot90,#96+'abcdefghijklmnopqrstuvwxyz');
    chDraw3x5( 18,127,TxtRot90,';<=>?[]^_{|}~'+#127);
    gDrawString(25,129,1,1,TxtRot90,'TxtRot90');
    
    chDraw3x5(239,127,TxtRot180,' !"#$%&'+#39+'()*+,-./0123456789:;<=>?');
    chDraw3x5(239,121,TxtRot180,'@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_');
    chDraw3x5(239,115,TxtRot180,#96+'abcdefghijklmnopqrstuvwxyz{|}~'+#127);
    gDrawString(167,108,1,1,TxtRot180,'TxtRot180');
    
    chDraw3x5(239,  0,TxtRot270,' !"#$%&'+#39+'()*+,-./0123456789:');
    chDraw3x5(233,  0,TxtRot270,'@ABCDEFGHIJKLMNOPQRSTUVWXYZ');
    chDraw3x5(227,  0,TxtRot270,#96+'abcdefghijklmnopqrstuvwxyz');
    chDraw3x5(221,  0,TxtRot270,';<=>?[]^_{|}~'+#127);
    gDrawString(213,-2,1,1,TxtRot270,'TxtRot270');
    
    gDispRefresh;


Harry
You must be logged in or your permissions are to low to see this Attachment(s).
Harry
Moderator
Avatar
Gender:
Location: zwischen Augsburg und Ulm
Age: 59
Posts: 2077
Registered: 03 / 2003
Subject:

Re: Grafik-Font 3x5 Pixel

 · 
Posted: 08.01.2021 - 12:40  ·  #3
Ich hab noch einen Font mit 5x5 Pixel gefunden. Besteht Interesse?
Harry
Moderator
Avatar
Gender:
Location: zwischen Augsburg und Ulm
Age: 59
Posts: 2077
Registered: 03 / 2003
Subject:

Re: Grafik-Font 3x5 & 5x5 Pixel

 · 
Posted: 16.03.2021 - 10:10  ·  #4
Ich habs mal in eine Unit verpackt und zusätzlich einen 5x5-Pixel-Font integriert.

Harry
You must be logged in or your permissions are to low to see this Attachment(s).
pvs-deck
PowerUser
Avatar
Gender:
Age: 52
Homepage: pvs-deck.de
Posts: 1340
Registered: 02 / 2009
Subject:

Re: Grafik-Font 3x5 & 5x5 Pixel

 · 
Posted: 16.03.2021 - 10:49  ·  #5
Hallo Harry,

das schaue ich mir bei Gelegenheit mal auf meinen Display an, dann würde ich noch mehr platz haben um Informationen anzuzeigen.

Danke

Thorsten
Harry
Moderator
Avatar
Gender:
Location: zwischen Augsburg und Ulm
Age: 59
Posts: 2077
Registered: 03 / 2003
Subject:

Re: Grafik-Font 3x5 & 5x5 Pixel

 · 
Posted: 18.09.2023 - 12:52  ·  #6
Seltsamerweise kann ich diese Unit nicht mehr compilieren mit 6.00.03 .... ein komischer Fehler.
Mit der letzten Version von Rolf ( :( ) geht es.

Gruss
Harry

PS: In Zeile 236 steht "Begin" ;)
You must be logged in or your permissions are to low to see this Attachment(s).
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1362
Registered: 03 / 2005
Subject:

Re: Grafik-Font 3x5 & 5x5 Pixel

 · 
Posted: 20.09.2023 - 09:37  ·  #7
Can you please send me your project, Harry and I will look into it.
---------------------------------------------------------------------
Können Sie mir bitte Ihr Projekt schicken, Harry, und ich werde es mir ansehen.
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1362
Registered: 03 / 2005
Subject:

Re: Grafik-Font 3x5 & 5x5 Pixel

 · 
Posted: 20.09.2023 - 10:32  ·  #8
Hi Harry.

I can find no reference to updGraphicText.PCU. Is it ne you have written? Have you tried the LIB version?

------------------------------------------------------------------------------------------------------------------------------------

Ich kann keinen Hinweis auf updGraphicText.PCU finden. Haben Sie das geschrieben? Haben Sie die LIB-Version ausprobiert?
  • 1
  • 2
  • Page 1 of 2
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   134   148 · Page-Gen-Time: 0.02369s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI