FontMaker for BASCOM

Pytania, instrukcje - wszystko o fontach
Awatar użytkownika
pimowo
Posty: 392
Rejestracja: 28 maja 2016, 10:07

Re: FontMaker for BASCOM

Post autor: pimowo » 24 mar 2018, 10:56

Błędów w BASCOM już nie mam, ale nie chce to nadal działać-widzę jakąś sieczkę na wyświetlaczu :(

Bartek, patrzę w pliki fontów i teraz tak:
1. Przykładowa literka "A" w Twoim programie wygląda tak:
  1. .db 0,0,0,0,48,0,48,0,104,0,120,0,196,0,196,0,198,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;  A

2. Literka "A" w pliku gdzie wszystko działa wygląda tak:
  1. .db 0 , 126 , 17 , 17 , 17 , 126 , 0 , 0 ; A

Dlaczego jest taka różnica?
Awatar użytkownika
niveasoft
Posty: 1213
Rejestracja: 17 sie 2015, 12:13
Kontakt:

Re: FontMaker for BASCOM

Post autor: niveasoft » 24 mar 2018, 11:00

Plik który pokazałeś jako działający ma 8 Bajtów na jeden znak... chcesz mieć większy to sie licz z tym że bajtów na każdy znak jest więcej.
Zobacz co będzie jak nie wybierzesz COLOR. Wszystko zalezy od wyswietlacza bo sa przynajmniej dwie metody układania bajtów na wyswietlaczach.
Awatar użytkownika
pimowo
Posty: 392
Rejestracja: 28 maja 2016, 10:07

Re: FontMaker for BASCOM

Post autor: pimowo » 24 mar 2018, 11:08

Jeżeli zrobię tak:
.
Bez tytułu.png
.
to nie mam błędów w BASCOM, wyświetlacz wszystko pokazuje, ale literki są pozamieniane :(
Nie masz wymaganych uprawnień, aby zobaczyć pliki załączone do tego posta.
Awatar użytkownika
niveasoft
Posty: 1213
Rejestracja: 17 sie 2015, 12:13
Kontakt:

Re: FontMaker for BASCOM

Post autor: niveasoft » 24 mar 2018, 11:11

Ktoś mi tu kiedyś monitował że brakuje jednej literki. LINK Wtedy wszystkie się o jeden przesuną. By trzeba do tego spojrzeć. Pewnie znalazł się BUG ... :D
Awatar użytkownika
pimowo
Posty: 392
Rejestracja: 28 maja 2016, 10:07

Re: FontMaker for BASCOM

Post autor: pimowo » 24 mar 2018, 11:16

Na początku tego tematu, Kolega @mostach pisał o tym, o TUTAJ
Zrobiłem tak i rzeczywiście jest lepiej bo mniej zamienionych literek.
Awatar użytkownika
niveasoft
Posty: 1213
Rejestracja: 17 sie 2015, 12:13
Kontakt:

Re: FontMaker for BASCOM

Post autor: niveasoft » 24 mar 2018, 11:17

On napisał że wszystko jedno ile wstawisz a to nieprawda. Musisz wstawić tyle zer ile maja inne linie i na końcu średnik plus jakis znak.
Awatar użytkownika
pimowo
Posty: 392
Rejestracja: 28 maja 2016, 10:07

Re: FontMaker for BASCOM

Post autor: pimowo » 24 mar 2018, 11:25

Tak patrzę na wyświetlacz i duże literki są OK, ale przestawiają się literki małe. Do wygenerowanego pliku *.font dodałem:
  1. .db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; .
przed literką "a" i wygląda, że jest OK-w końcu coś zaczęło działać :)

EDYTA
Mała ciekawostka...
Gdy tworzę sobie czcionkę w FontMaker to rozjeżdżają się małe literki (duże są OK) Gdy plik *.font otworzę w BASCOMie i go zamknę to wszystko jest już dobrze, ale zwiększają się odstępy między literkami.
Awatar użytkownika
Henryk
Posty: 348
Rejestracja: 22 sty 2018, 17:20

Re: FontMaker for BASCOM

Post autor: Henryk » 25 mar 2018, 11:12

Witam :D
Mała ściąga do FontMaker .
fontmaker01.JPG
fontmaker02.JPG
Nie masz wymaganych uprawnień, aby zobaczyć pliki załączone do tego posta.
Ostatnio zmieniony 25 mar 2018, 12:38 przez Henryk, łącznie zmieniany 1 raz.
Awatar użytkownika
Henryk
Posty: 348
Rejestracja: 22 sty 2018, 17:20

Re: FontMaker for BASCOM

Post autor: Henryk » 25 mar 2018, 11:15

cd..
fontmaker03.JPG
fontmaker04.JPG
Może to coś pomoże w lepszym zrozumieniu programu .
Niektóre opcje pominąłem , sam muszę je przećwiczyć aby potwierdzić własne domysły ;)
Jeśli coś sknociłem poprawię ;) sorki .

Jako przykład wziąłem projekt Bartka " Demo "
  1. '--------------------------------------------------------------------
  2. '                           GRAPHIC FONT
  3. '     Use the Bascom font file's for all the graphic display's,
  4. '              include inverted and/or rotated text.
  5. '        By Evert Dekker 2007 GraphicFont@Evertdekker dotje com
  6. '                   Created with Bascom-Avr: 1.11.8.8
  7. '    Optimized by Mladen Bruck 2009, mladen.bruck@avrbit dotje com
  8. '--------------------------------------------------------------------
  9. $regfile = "m16def.dat"       ' specify the used micro
  10. $crystal = 16000000           ' used crystal frequency
  11. '$baud = 19200                                               ' use baud rate
  12. $hwstack = 100                ' default use 32 for the hardware stack
  13. $swstack = 120                ' default use 10 for the SW stack
  14. $framesize = 100              ' default use 40 for the frame space
  15.  
  16. '=== T6963 graphics module PIN's setup. Change this according to your hardware !
  17. Config Graphlcd = 240 * 128 , Dataport = Porta , Controlport = Portc , Ce = 4 , Cd = 7 , Wr = 5 , Rd = 6 , Reset = 3 , Fs = 2 , Mode = 8
  18. 'The dataport is the portname that is connected to the data lines of the LCD
  19. 'The controlport is the portname which pins are used to control the lcd
  20. 'CE, CD etc. are the pin number of the CONTROLPORT.
  21. ' For example CE =2 because it is connected to PORTC.2
  22. 'mode 8 gives 240 / 8 = 30 columns , mode=6 gives 240 / 6 = 40 columns
  23. Cursor Off
  24. Cls
  25. '=== Subprocedure declarations
  26. 'SYNTAX  Lcdtest String , Xoffset , Yoffset , Inverse , Rotation
  27. Declare Sub Lcdtext(byval S As String , Byval Xoffset As Byte , Byval Yoffset As Byte , Byval Inverse As Byte , Byval Rotation As Byte)
  28. '* Xoffset and Yoffset is in pixels, so you can place text on every spot on the display
  29.  
  30. 'SYNTAX  Set_font FontSet
  31. Declare Sub Set_font(byval Fontset As Byte)
  32. '* You determine yourself in the subroutine witch font belongs to the fontset
  33.  
  34. '=== Alias declarations
  35. Font8x8_font Alias 1
  36. Coop8x8_font Alias 2
  37. Font6x8_font Alias 3
  38. Font6x16_font Alias 4
  39. Font21x16_font Alias 5
  40. Font12x14_font Alias 6
  41. Font10x15_font Alias 7
  42. Font6_8_font Alias 8
  43. Font11x16_font Alias 9
  44. Font14x16_font Alias 10
  45. Font15x16_font Alias 11
  46. Font12x16_font Alias 12
  47. Font19x16_font Alias 13
  48. Font13x8_font Alias 14
  49.  
  50. Inverted Alias 1
  51. No_inverted Alias 0
  52.  
  53. Rotate_0 Alias 0
  54. Rotate_90 Alias 1
  55. Rotate_180 Alias 2
  56. Rotate_270 Alias 3
  57.  
  58. '=== Variables declarations
  59. Dim Row As Byte , Colums As Byte , Byteseach As Byte , Blocksize As Byte
  60. Dim Font_adress As Word
  61.  
  62. '-----
  63.  
  64. '=== Your main prog here ====
  65.  
  66.    Set_font Font8x8_font
  67.     Lcdtext "#,# $(*)'&) %&+" , 0 , 0 , No_inverted , Rotate_0
  68.    Set_font Coop8x8_font
  69.     Lcdtext "#)# $&&'%(" , 128 , 1 , No_inverted , Rotate_0
  70.    Set_font Font6x8_font
  71.     Lcdtext "#+$%)(*)'&*" , 2 , 10 , No_inverted , Rotate_0
  72.    Set_font Font6x16_font
  73.     Lcdtext "$,#$ %*)+(- '&" , 72 , 10 , No_inverted , Rotate_0
  74.    Set_font Font21x16_font
  75.     Lcdtext "#$'&%!" , 0 , 91 , No_inverted , Rotate_0
  76.    Set_font Font12x14_font
  77.     Lcdtext "$#'%#'&" , 2 , 25 , No_inverted , Rotate_0
  78.    Set_font Font10x15_font
  79.     Lcdtext "$&('#(%" , 160 , 12 , No_inverted , Rotate_0
  80.    Set_font Font6_8_font
  81.     Lcdtext "#$%&'()*+, -/01.! )2+" , 100 , 30 , No_inverted , Rotate_0
  82.    Set_font Font11x16_font
  83.     Lcdtext "&/.1 '*-+0 ,/0 $#)%('" , 3 , 42 , No_inverted , Rotate_0
  84.    Set_font Font14x16_font
  85.     Lcdtext "$#%&'(" , 5 , 55 , No_inverted , Rotate_0
  86.    Set_font Font15x16_font
  87.     Lcdtext "#-+,)( %'$*$%,&*" , 0 , 110 , No_inverted , Rotate_0
  88.    Set_font Font12x16_font
  89.     Lcdtext ",&*+')( $#%!" , 98 , 55 , No_inverted , Rotate_0
  90.    Set_font Font19x16_font
  91.     Lcdtext "#$%&'()*+,!" , 15 , 73 , No_inverted , Rotate_0
  92.    Set_font Font13x8_font
  93.     Lcdtext "%&)$'($#" , 125 , 95 , No_inverted , Rotate_0
  94.  
  95. End
  96.  
  97. '=== Sub Routines ===
  98. Sub Set_font(byval Fontset As Byte)
  99. Local Dummy_word As Word
  100.    'Add or remove here fontset's that you need or not,
  101.    'This is the name that you gave to the font, NOT the filename
  102.    'If you dont know the name, open the font file in wordpad, and there it is,
  103.    'right on top.
  104.    Select Case Fontset        ' You may use case 1, case 2 etc insted of alias names
  105.        Case Font8x8_font : Font_adress = Loadlabel(font8x8)       'This is the name that you gave to the font, NOT the filename
  106.        Case Coop8x8_font : Font_adress = Loadlabel(coop8x8)
  107.        Case Font6x8_font : Font_adress = Loadlabel(font6x8)
  108.        Case Font6x16_font : Font_adress = Loadlabel(font6x16)
  109.        Case Font21x16_font : Font_adress = Loadlabel(font21x16)
  110.        Case Font12x14_font : Font_adress = Loadlabel(font12x16)
  111.        Case Font10x15_font : Font_adress = Loadlabel(font10x16)
  112.        Case Font6_8_font : Font_adress = Loadlabel(forte6x8)
  113.        Case Font11x16_font : Font_adress = Loadlabel(font11x16)
  114.        Case Font14x16_font : Font_adress = Loadlabel(comic14x16)
  115.        Case Font15x16_font : Font_adress = Loadlabel(font15x16)
  116.        Case Font12x16_font : Font_adress = Loadlabel(temp12x16)
  117.        Case Font19x16_font : Font_adress = Loadlabel(font19x16)
  118.        Case Font13x8_font : Font_adress = Loadlabel(font13x8)
  119.    End Select
  120.    ' --- Load font info needed for Lcdtext subroutine calculations ---
  121.    Dummy_word = Font_adress : Row = Cpeek(dummy_word)
  122.    Incr Dummy_word : Byteseach = Cpeek(dummy_word)
  123.    Incr Dummy_word : Blocksize = Cpeek(dummy_word)
  124.    ' -----
  125.    Colums = Blocksize / Row   'Calculate the numbers of colums
  126.    Row = Row * 8              'Row is always 8 pixels high = 1 byte, so working with row in steps of 8.
  127.    Row = Row - 1              'Want to start with row=0 instead of 1
  128.    Colums = Colums - 1        'Same for the colums
  129.    Font_adress = Font_adress + 4       'Skip first 4 bytes in fontfile
  130. End Sub
  131.  
  132. Sub Lcdtext(byval S As String , Xoffset As Byte , Yoffset As Byte , Inverse As Byte , Rotation As Byte)
  133.    Local Tempstring As String * 1 , Temp As Byte       'Dim local the variables
  134.    Local A As Byte , Pixels As Byte , Pixels_adress As Word , Carcount As Byte
  135.    Local Columcount As Byte , Rowcount As Byte , Stringsize As Byte
  136.    Local Xpos As Byte , Ypos As Byte , Pixel As Byte , Pixelcount As Byte
  137.    Local Dummy_word As Word
  138.  
  139.    If Inverse > 1 Then Inverse = 0       'Inverse can't be greater then 1
  140.    If Rotation > 3 Then Rotation = 0       'There are only 4 rotation's
  141.    Stringsize = Len(s) - 1    'Size of the text string -1 because we must start with 0
  142.  
  143.    For Carcount = 0 To Stringsize       'Loop for the numbers of caracters that must be displayed
  144.       Temp = Carcount + 1     'Cut the text string in seperate caracters
  145.       Tempstring = Mid(s , Temp , 1)
  146.       Temp = Asc(tempstring) - 32       'Font files start with caracter 32
  147.       Dummy_word = Blocksize * Temp
  148.       Pixels_adress = Font_adress + Dummy_word       'Do dummie read to point to the correct line in the fontfile
  149.       Temp = Carcount * Byteseach       'Do first part of calculation to get the character on the correct X or Y position
  150.       Select Case Rotation
  151.           Case 0              '0 degrees rotation
  152.                   Temp = Temp + Xoffset
  153.                   For Rowcount = 0 To Row Step 8       'Loop for numbers of Row
  154.                         A = Rowcount + Yoffset
  155.                         For Columcount = 0 To Colums       'Loop for numbers of Colums
  156.                             Pixels = Cpeek(pixels_adress)
  157.                             Incr Pixels_adress
  158.                             If Inverse = 1 Then Toggle Pixels       'Read the byte from the file and if inverse = true then invert de byte
  159.                             Xpos = Columcount
  160.                             Xpos = Xpos + Temp       'Do rest of calculation to get the character on the correct X position
  161.                             For Pixelcount = 0 To 7       'Loop for 8 pixels to be set or not
  162.                               Ypos = A + Pixelcount       'Each pixel on his own spot
  163.                               Pixel = Pixels.pixelcount       'Set the pixel (or not)
  164.                               Pset Xpos , Ypos , Pixel       'Finaly we can set the pixel
  165.                             Next Pixel
  166.                         Next Columcount
  167.                   Next Rowcount
  168.           Case 1              '90 degrees rotation
  169.                   For Rowcount = Row To 0 Step -8       'Loop is now counting down
  170.                         A = Rowcount + Xoffset
  171.                         A = A - 15       'Correction to set Xpos on Xoffset with rotation
  172.                         For Columcount = 0 To Colums
  173.                             Pixels = Cpeek(pixels_adress)
  174.                             Incr Pixels_adress
  175.                             If Inverse = 1 Then Toggle Pixels
  176.                             Xpos = Columcount
  177.                             Xpos = Xpos + Yoffset
  178.                             Xpos = Xpos + Temp       'We want that Xoffset is still Xoffset, so we need here the change from x to y
  179.                             For Pixelcount = 7 To 0 Step -1
  180.                               Ypos = A + Pixelcount
  181.                               Pixel = Pixels.0
  182.                               Pset Ypos , Xpos , Pixel
  183.                               Shift Pixels , Right
  184.                             Next Pixel
  185.                         Next Columcount
  186.                   Next Rowcount
  187.           Case 2              '180 degrees rotation
  188.                   For Rowcount = Row To 0 Step -8
  189.                         A = Rowcount + Yoffset
  190.                         A = A - 7       'Correction to set Xpos on Xoffset with rotation
  191.                         For Columcount = Colums To 0 Step -1
  192.                             Pixels = Cpeek(pixels_adress)
  193.                             Incr Pixels_adress
  194.                             If Inverse = 1 Then Toggle Pixels
  195.                             Xpos = Columcount
  196.                             Xpos = Xpos - Temp
  197.                             Xpos = Xpos - 8       'Correction to set Xpos on Xoffset with rotation
  198.                             Xpos = Xpos + Xoffset
  199.                             For Pixelcount = 7 To 0 Step -1
  200.                                 Ypos = A + Pixelcount
  201.                                 Pixel = Pixels.0
  202.                                 Pset Xpos , Ypos , Pixel
  203.                                 Shift Pixels , Right
  204.                             Next Pixel
  205.                         Next Columcount
  206.                   Next Rowcount
  207.           Case 3              '270 degrees rotation
  208.                   For Rowcount = 0 To Row Step 8
  209.                         A = Rowcount + Xoffset
  210.                           For Columcount = Colums To 0 Step -1
  211.                             Pixels = Cpeek(pixels_adress)
  212.                             Incr Pixels_adress
  213.                             If Inverse = 1 Then Toggle Pixels
  214.                             Xpos = Columcount
  215.                             Xpos = Xpos - Temp
  216.                             Xpos = Xpos - 8       'Correction to set Xpos on Xoffset with rotation
  217.                             Xpos = Xpos + Yoffset
  218.                             For Pixelcount = 0 To 7
  219.                                 Ypos = A + Pixelcount
  220.                                 Pixel = Pixels.pixelcount
  221.                                 Pset Ypos , Xpos , Pixel
  222.                             Next Pixel
  223.                         Next Columcount
  224.                   Next Rowcount
  225.       End Select
  226.    Next Carcount
  227. End Sub
  228. 'End of this amazing subroutine
  229.  
  230. '=== Includes ===
  231. $include "project8x8_Courier New.font"
  232. $include "project8x8_Cooper Black.font"
  233. $include "project6x8_Consolas.font"
  234. $include "project6x16_Agency FB.font"
  235. $include "project21x16_Ravie.font"
  236. $include "project12x14_Bauhaus 93.font"
  237. $include "project10x15_Bernard.font"
  238. $include "project6x8_Forte.font"
  239. $include "project11x10_Stencil.font"
  240. $include "project14x16_Comic.font"
  241. $include "project15x16_Viner Hand.font"
  242. $include "project12x16_Tempus.font"
  243. $include "project19x16_Snap.font"
  244. $include "project13x8_Goudy.font"
Nie masz wymaganych uprawnień, aby zobaczyć pliki załączone do tego posta.
Ostatnio zmieniony 25 mar 2018, 12:37 przez Henryk, łącznie zmieniany 2 razy.
Awatar użytkownika
Jacek
Posty: 384
Rejestracja: 25 kwie 2016, 19:14

Re: FontMaker for BASCOM

Post autor: Jacek » 25 mar 2018, 11:53

Witam - dziękuje Henryku za tutorial obrazkowy - jak skończę naświetlać pcb i ją wytrawie - to poćwiczę - mam nadzieję że będzie ok - właśnie o kolejność mi chodziło.
pozdrawiam Jacek.
ODPOWIEDZ