Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 03:13 05 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : TFT Font tweaking program

     Page 4 of 4    
Author Message
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 02:50pm 12 Mar 2016
Copy link to clipboard 
Print this post

Just trying to get a handle on this font business. Is there a limit on the max horizontal and max vertical pixels for a "character", ie, could you define a whole 128 x 64 pixel "character" and call it using a font number?
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5913
Posted: 03:23pm 12 Mar 2016
Copy link to clipboard 
Print this post

  viscomjim said   Just trying to get a handle on this font business. Is there a limit on the max horizontal and max vertical pixels for a "character", ie, could you define a whole 128 x 64 pixel "character" and call it using a font number?


128 x 64 is certainly OK.
I don't know what the limit is in MMBasic.

In FontTweak, I don't allow you to double the size if it is already over 128 pixels wide.

I haven't put a limit when creating a new font. As long as the width X height is a multiple of 8.

Provided you don't have too many characters in the font, you should be able to have large characters.
An alternative might be to have smaller characters and use a font size of 2 (or 3) to display one character full screen.

VK7JH
MMedit   MMBasic Help
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 03:34pm 12 Mar 2016
Copy link to clipboard 
Print this post

That is awesome, time to try my first font!!!! Thanks for this program TassyJim!!!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5913
Posted: 06:57pm 13 Mar 2016
Copy link to clipboard 
Print this post

Still plugging away...


From the Edit menu - Character from Image opens a file selector to import a BMP, JPG or PNG image.

The size of the image is not important but its proportions is. If your font is 32 x 50, the image width to height should be in the same ratio. The image opens in a new window with the original one the left and a black and white version on the right.
There are two methods used for converting the image.
Threshold changes each pixel to white if it is brighter than the set value, black otherwise. This mode is best for line art or silhouettes.

Region threshold set the pixel white if it is brighter than the surrounding pixels.
This mode is usually best for true photos but you may need to experiment.

To switch between the two modes, press the space bar.
To adjust the threshold level, use the right and left arrow keys
To adjust the size of the region (only in Region threshold mode), use the up and down arrow keys.
To transfer the image to the current font character, press return or enter.
Once transferred, some touch-up is usually needed.
2016-03-14_045530_FontTweak.zip
The help file has been updated.

Enjoy.
Jim
VK7JH
MMedit   MMBasic Help
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 09:30pm 13 Mar 2016
Copy link to clipboard 
Print this post

Hi Jim,

Your 'app' has now become a very professional tool to use - this is absolutely excellent.

In the manual there are IMHO just two things 'missing' for completeness.
1> Double Size feature. Just add a sentence explaining what the 'limit' is.
2> For the 'photo import'; show a screenshot of the 'Regional' mode.

For anyone using TFTs, but has not yet tried this 'app', I strongly recommend you give it a play.
Simple animations are now very easy, as well as the ability to display just about anything you want in terms of fonts & characters.

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 11:14am 14 Mar 2016
Copy link to clipboard 
Print this post

@TassyJim,

Found one little bug (I think). Can be reproduced here if I follow these steps:

1> Created a new 128 x 128 font with two chrs(32 & 33). Saved, and worked just fine. Closed your app.
2> Re-Opened your app, and pulled in this BAS file just saved.
3> Added two 'empty' chrs(34 & 35) with Ctrl-N (twice)
4> Then deleted the last two chrs(34 & 35) with Ctrl-X. GET message do you wish to save.
5> Selected Yes, then File, Save BAS and in the 'file explorer' window I selected the same file name
6> File saved ok. BUT now I can't exit your app via File, Quit (or via the MS Windows 'X' button in top right corner of your app).

Note: If I select File, New, (from the above scenario) then I am able to quit (otherwise it's the Task Manager needed!)

On Win10

Also: Can the 'X x Y' parameters printed on the screen have a space added between the X-dimension and the 'x' (times) character
e.g. Currently shows '128x 128' and suggesting here '128 x 128' is 'neater'

Let me know if you're able to recreate the 'lock out'!

WW


For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5913
Posted: 06:51pm 14 Mar 2016
Copy link to clipboard 
Print this post

Fixed WW's little bug.
2016-03-15_045101_FontTweak.zip
More than a little bug.
Thanks Phil

Jim
VK7JH
MMedit   MMBasic Help
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 01:22pm 14 Apr 2016
Copy link to clipboard 
Print this post

Hi Jim,
I love FontTweak.Opens up many possibilities which would have been previously too hard.

Would it be possible in the next version to preserve the font number currently used when opening up a BAS file for edit.
It seems to save them all as Font#8.


Thanks
Gerry


Latest F4 Latest H7
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5913
Posted: 12:41pm 15 Apr 2016
Copy link to clipboard 
Print this post

  disco4now said  
Would it be possible in the next version to preserve the font number currently used when opening up a BAS file for edit.
It seems to save them all as Font#8.


That should be easy to do and makes a lot of sense.
I might make it something that can be set by the user.

Jim
VK7JH
MMedit   MMBasic Help
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 12:52pm 15 Apr 2016
Copy link to clipboard 
Print this post

Hi Jim,
Thanks.
One more thing would be good. I wanted to modify a font to add the lower characters 1-31. I eventually managed to add the correct number of 0000s at the start of the file and adjust the header, but took a bit of fiddling.

The option to add a character before the current first character would be very useful as well.

Regards
Gerry
Edited by disco4now 2016-04-16
Latest F4 Latest H7
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 03:04am 05 May 2016
Copy link to clipboard 
Print this post

Hi Jim,
I have discovered a small issue with FontTweak when it saves a font which does not coincide with a neat set of 8 characters at the end.

The font works only if it is the last thing in the basic program and I have used it like that up until now, but I have also found it wont go with LIBRARY SAVE so have had to track it down. It looks like MMBasic and the SAVE LIBRARY want it padded out to a neat 8 characters. I have added 00 at the end of this font file and MMBASIC is happy. If I open with FontTweak and save it, FontTweak saves the correct number of bytes as need for the font, but we need to pad it out the make MMBasic happy.

Its not a big thing once you know, but a bit hard to find.

Regards
Gerry


' Font2_8x13_OSC_126.bas
' Font type : Full (127 characters)
' Font size : 8x13 pixels
' Memory usage : 1655 bytes
' Font adapted from: http://www.rinkydinkelectronics.com/r_fonts.php

DefineFont #8
7F010D08 D8F0E0C0 DEDFDE9C E0F0F88C F0E0C0C0 8FEEAC88 F0F88CBE 0F07C0E0
E0713B18 237BFBEA 07070F1F 7B231F0F 71E0EAFB 070F183B 00000000 44444400
407C4444 000000C0 00040000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 10100000 10101010 00100010 24000000 00002424 00000000 00000000
7E242400 24247E24 00000000 3C100000 78143850 00000010 52220000 10080824
00442A24 00000000 48483000 3A444A30 00000000 40303800 00000000 00000000
08080400 08101010 00000408 10200000 08080810 00201010 00000000 7E182400
00002418 00000000 10100000 0010107C 00000000 00000000 00000000 00403038
00000000 007E0000 00000000 00000000 00000000 38100000 00000010 08040202
80402010 00000080 42241800 42424242 00001824 30100000 10101050 007C1010
3C000000 04024242 7E402018 00000000 0804027E 4202021C 0000003C 140C0400
7E444424 00000404 407E0000 02625C40 003C4202 1C000000 5C404020 3C424262
00000000 0804027E 20101008 00000020 42423C00 42423C42 00003C42 423C0000
023A4642 00380402 00000000 10381000 38100000 00000010 38100000 38000010
00004030 08040200 08102010 00000204 00000000 00007E00 0000007E 40000000
04081020 40201008 00000000 0242423C 00080804 00000008 42423C00 4A56524E
00003C40 24180000 7E424242 00424242 FC000000 7C424242 FC424242 00000000
4040423C 42404040 0000003C 4242FC00 42424242 0000FC42 407E0000 40784040
007E4040 7E000000 78404040 40404040 00000000 4040423C 46424E40 0000003A
42424200 42427E42 00004242 107C0000 10101010 007C1010 1E000000 04040404
38440404 00000000 50484442 44485060 00000042 40404000 40404040 00007E40
82820000 9292AAC6 00828282 42000000 4A526242 42424246 00000000 4242423C
42424242 0000003C 42427C00 40407C42 00004040 423C0000 42424242 023C4A52
7C000000 7C424242 42444850 00000000 4040423C 4202023C 0000003C 1010FE00
10101010 00001010 42420000 42424242 003C4242 82000000 44444482 10282828
00000000 82828282 AA929292 00000044 44828200 44281028 00008282 82820000
10102844 00101010 7E000000 10080402 7E404020 00000000 2020203C 20202020
0000003C 40808000 04081020 00000202 08780000 08080808 00780808 10000000
00004428 00000000 00000000 00000000 00000000 0000FE00 04183800 00000000
00000000 00000000 3E023C00 003A4642 40000000 625C4040 5C624242 00000000
3C000000 42404042 0000003C 02020200 4242463A 00003A46 00000000 7E423C00
003C4240 1C000000 7C202022 20202020 00000000 3A000000 40384444 003C423C
40404000 4242625C 00004242 10000000 10103000 007C1010 00000000 040C0004
44040404 00003844 44404040 44487048 00000042 10103000 10101010 00007C10
00000000 9292EC00 00829292 00000000 625C0000 42424242 00000000 3C000000
42424242 0000003C 00000000 6242625C 4040405C 00000000 42463A00 02023A46
00000002 225C0000 20202020 00000000 3C000000 420C3042 0000003C 20200000
2020207C 00001C22 00000000 44444400 003A4444 00000000 44440000 10282844
00000000 82000000 AA929282 00000044 00000000 18182442 00004224 00000000
42424200 42023A46 0000003C 047E0000 7E201008 00000000 0810100E 10100830
0000000E 10101000 10101010 00001010 08700000 100C1008 00700808 24000000
00004854 00000000 00000000 00000000 00000000 000000
End DefineFont


Latest F4 Latest H7
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 11:52am 05 May 2016
Copy link to clipboard 
Print this post

Hey Font Tweaker's...

Probably a simple question... (newbe type)...

I have a complete 95 character set loaded, and want to save just the numbers...

Getting rid of the ending characters went OK (delete last command) but I can't seem to find a way to remove the proceeding ones... I am sure it's easy, but I can't seem to find the command to do it... Must have missed it somewhere...
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5913
Posted: 01:36pm 05 May 2016
Copy link to clipboard 
Print this post

Save your file as C type.
Open it in your preferred text editor.
In the C format, each character occupies one line so you can delete the character you don't want. Deleting from the start or end is OK. If you delete from the middle, the character ASCII values will get out of step.

Once you have deleted the unwanted characters, you need to edit the first line of the definition
  Quote  
fontdatatype Grotesk16x32[6084] PROGMEM={
0x10,0x20,0x20,0x5F,

The 4 HEX values are font width, font height, first character ASCII value, number of characters.
You will need to change the first character value and the number of characters.

Save the file and open it in FontTweak.
Save as BAS

Jim

VK7JH
MMedit   MMBasic Help
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 05:10pm 05 May 2016
Copy link to clipboard 
Print this post

Thanks Jim..!

I knew if I "messed" with the "C" code, those numbers would be different somehow and I figured the program generated them, so cutting stuff out would screw things up...

Will give it a go tomorrow after work..
 
     Page 4 of 4    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024