Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 05-18-2012, 04:04 AM   #1
JoppyFurr
Coding fuzzball
JoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exercise
 
JoppyFurr's Avatar
 
Posts: 16
Karma: 38918
Join Date: May 2012
Device: Kindle Touch
[Kindle Touch] Text output demo

Hi,

I've started making the first steps towards the terminal emulator I'd like to write :3

This is a demo of text output, also showing the bitmap font I created for it.

The program shows some text, and counts the number of times you have touched the screen. You can do a full-refresh of the screen by releasing a touch in the top left, and you can exit the program by releasing a touch in the top right of the screen.

I have been compiling with: tccmake main -lpthread

Using the tcc package from Geekmaster's simple guide to tcc: https://www.mobileread.com/forums/sho...d.php?t=175834


Enjoy :3
Joppy Furr
Attached Files
File Type: gz Text.tar.gz (7.8 KB, 213 views)
JoppyFurr is offline   Reply With Quote
Old 05-18-2012, 09:48 AM   #2
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Interesting... I was working on my terminal emulator code again last night too... Competition is good because it stimulates improvement, then later we can borrow the best of each other's ideas for more improvements.

EDIT: I am a little curious though, why did you "create" your OWN bitmap font, when there are so many good public domain bitmap fonts that you can just copy/paste? And, for a table as large as a character map, why did you only store ONE BIT per byte? I am also curious just how you were able to create that many characters containing that many pixels, and type them all into a C program accurately in such a short amount of time... What tools did you use to create a font so quickly that is indeed completely your own with no credit to share with others? If you really wanted your font pixels packed just one bit per byte and you do not have problems with giving others credit for their work, couldn't you just write a quick little C program or script to unpack a public domain font and output your bit table to stick into your program?

Last edited by geekmaster; 05-18-2012 at 04:09 PM.
geekmaster is offline   Reply With Quote
Advert
Old 05-19-2012, 02:06 AM   #3
JoppyFurr
Coding fuzzball
JoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exerciseJoppyFurr juggles running chainsaws for a bit of light exercise
 
JoppyFurr's Avatar
 
Posts: 16
Karma: 38918
Join Date: May 2012
Device: Kindle Touch
Quote:
Originally Posted by geekmaster View Post

EDIT: I am a little curious though, why did you "create" your OWN bitmap font, when there are so many good public domain bitmap fonts that you can just copy/paste? And, for a table as large as a character map, why did you only store ONE BIT per byte? I am also curious just how you were able to create that many characters containing that many pixels, and type them all into a C program accurately in such a short amount of time... What tools did you use to create a font so quickly that is indeed completely your own with no credit to share with others? If you really wanted your font pixels packed just one bit per byte and you do not have problems with giving others credit for their work, couldn't you just write a quick little C program or script to unpack a public domain font and output your bit table to stick into your program?
I'm not sure about the licensing / rules around other fonts, so decided that the safest thing to do was to just make up my own and give it the same license as the rest of the program. I used GIMP to draw the font, which supports saving to a .h file, along with .jpg / .png, etc. From that .h file, I removed all code related to looking up colour values, leaving only the array of bytes that make up the image. With only the array of bytes remaining, I re-formatted the whitespace so that the characters line up when viewed in a text editor, and added a few #defines about character size.

As far as using only one bit per byte, I wasn't thinking of that at the time. Perhpas I'll get around to improving that eventually, but now that I have text showing, the next things I'd like to work on are a keyboard, which I've made a start on, and then implementing the terminal itself. Once I have the basics working, then I'll go through and tidy it up, adding extra features as I do.

I have a working font now, so will probably leave that alone until later. But once I've got the terminal working, I may eventually add support for opening a font file and UTF-8.
JoppyFurr is offline   Reply With Quote
Old 05-19-2012, 02:21 AM   #4
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by JoppyFurr View Post
I'm not sure about the licensing / rules around other fonts, so decided that the safest thing to do was to just make up my own and give it the same license as the rest of the program. I used GIMP to draw the font, which supports saving to a .h file, along with .jpg / .png, etc. From that .h file, I removed all code related to looking up colour values, leaving only the array of bytes that make up the image. With only the array of bytes remaining, I re-formatted the whitespace so that the characters line up when viewed in a text editor, and added a few #defines about character size.

As far as using only one bit per byte, I wasn't thinking of that at the time. Perhpas I'll get around to improving that eventually, but now that I have text showing, the next things I'd like to work on are a keyboard, which I've made a start on, and then implementing the terminal itself. Once I have the basics working, then I'll go through and tidy it up, adding extra features as I do.

I have a working font now, so will probably leave that alone until later. But once I've got the terminal working, I may eventually add support for opening a font file and UTF-8.
Thanks for publishing the unfinished code, so we can learn from it. I do the same myself, as you can see from a progression of versions of many of my apps.

The rules that I follow are 1) make it work, 2) make it small, 3) make it fast. Step 2 is where you pack your font bits.

For free liberally licensed fonts, check out the Vera fonts. For vector fonts, check out the Hershey fonts. Also, for C programs, a great simple GUI method is IMGUI: http://sol.gfxile.net/imgui/
Or, if you want a more "professional" GUI that is C compatible, but event driven (to save battery), check out IUP from the lua creators.

Last edited by geekmaster; 05-19-2012 at 02:24 AM.
geekmaster is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kindle Touch select text, copy paste? Zimmy Amazon Kindle 3 02-18-2012 08:45 AM
Kindle Touch - Using text-to-speech to pronounce individual words nosfera2 Kindle Developer's Corner 0 02-10-2012 11:59 AM
Kindle Touch Won't Share Text from Personal Documents? daletsteele Amazon Kindle 0 12-27-2011 11:53 PM
Demo: Jetbook mini official demo bookwarm Ectaco jetBook 36 09-21-2010 12:18 PM
Minority Report multi-touch screen demo Alexander Turcic Lounge 0 02-19-2006 09:06 AM


All times are GMT -4. The time now is 12:24 AM.


MobileRead.com is a privately owned, operated and funded community.