This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Wojbie's profile picture

BigFont API - Write bigger letters. v1.0

Started by Wojbie, 15 December 2015 - 11:07 AM
Wojbie #1
Posted 15 December 2015 - 12:07 PM
BigFont API - Write bigger letters. v1.1

Have you ever wanted to write something on computer screen in different font size? Now with magical 1.8 features you can!

Presenting: BigFont


BigFont is simple to use API for writing text using new drawing characters. It massively simplifies writing basic words using said characters. How to use explanation below.

Download Here: http://pastebin.com/3LfWxRWh
Or ingame by using command:
pastebin get 3LfWxRWh bigfont
(requires http-api to be active)

As it it api you need to os.loadAPI("bigfont") it. It contains functions explained below that allow you to do the magic!

Features List:
  • 4 Fast use functions: bigWrite bigPrint hugeWrite hugePrint that simpltfy writing to the max
  • 2 Moderate level function: bigBlit hugeBlit for all your blitting needs.
  • 2 Advanced level function writeOn and blitOn for all your unconventional writing needs.
  • 1 Extra function makeBlittleText that converts text into image formated according to Bomb Bloke Blitte API
Sizes Showcase:
SpoilerAll images were made on max size monitor scaled to 0.5 with writeOn function.

Normal font size


Using writeOn size 1


Using writeOn size 2


Using writeOn size 3


How to use:
SpoilerNote to this api:

The "\n" character is treated like normal character and does nothing. Same as in term.write()

All function use currently selected colors for the term they are wrote on. If you want to write red text on blue background simple change the colors to match that before calling functions.

Basic Usage:

Function bigWrite(sString) bigPrint(sString) hugeWrite(sString) hugePrint(sString) let you simply write in bigger font.
Simply do:

bigfont.bigPrint("Hello World")
And the "Hello World" will be printed. Beginings big and huge define font sizes (1 or 2), while write or printe define weather to move cursor to next line or leave it there.

Moderate Usage:

Functions bigBlit(sString,sFront,sBack) and hugeBlit(sString,sFront,sBack) work like the Basic ones exept they do it in blit fashion. For more details hot it works see term.blit function.


Advanced Usage:

Function writeOn(tTerminal,nSize,sString,nX,nY) allows you to write in more advanced way.
  • tTerminal refers to terminal object you want to write on.
  • nSize refers to size you want to write in (1-3)
  • sString refers to string you want to write
  • nX,nY refers to place you want to write from. If a value is skipped then writeOn generates one that centers text on screen. If you want to write from current position simply pass on tTerminal.getCursorPos() in this position.
Example

writeOn(term,1,"Ala",2,10)
will write Word Ala in fontsize 1 starting with position 2,10

Example

writeOn(peripheral.wrap("right"),2,"Ala")
will write Word Ala in fontsize 2 centered on right monitor

Example

writeOn(term,3,"Ala",term.getCursorPos())
will write Word Ala in fontsize 3 from current CursorPos

Function blitOn(tTerminal,nSize,sString,sFront,sBack,nX,nY) works exactly same as writeOn exept you provide all 3 blitting strings.

Tools:

Function makeBlittleText(nSize,sString,nTextColor,nBackgroundColor) is used to make text in set size(1-3) using selcted colors. It outputs table that is formatted acording to Bomb Bloke Blitte API

Change-log:
Spoilerv1.0 - First Relase
v1.1 - Added blit based functions and bugfix

Plans For Future:
Spoiler–bigfont.blit()
–Fix any bugs if found.
–Make/Find more fonts types?

Thanks to Bomb Bloke for his BLittle API and GIF API. They allowed to to easily translate termFont.png file into this api.

Any Comment and Suggestions how to improve Code are appreciated.
Edited on 17 February 2020 - 02:32 PM
Bomb Bloke #2
Posted 15 December 2015 - 12:34 PM
Word-wrap and proper escape character support for print? … bigfont.blit()? :D/>
Wojbie #3
Posted 15 December 2015 - 12:37 PM
Word-wrap and proper escape character support for print? … bigfont.blit()? :D/>

Well bigfont.blit() is planned for when i get some free time to make it :)/>

As for Word-wrap and proper escape character support I kinda forgot.
Edited on 15 December 2015 - 11:38 AM
Quartz101 #4
Posted 15 December 2015 - 08:33 PM
No SmallFont api? awww!
Wojbie #5
Posted 15 December 2015 - 08:36 PM
UPDATE! v1.1
  • Added 2 new moderate functions: bigBlit(sString,sFront,sBack) and hugeBlit(sString,sFront,sBack)
  • Added 1 new advanced function: blitOn(tTerminal,nSize,sString,sFront,sBack,nX,nY)
  • Fixed character "{" 1 pixel off bug (again).



Word-wrap and proper escape character support for print? … bigfont.blit()? :D/>
Well here's your blit ;D As for word-wrap and proper escape character support? I think i am gonna leave that for future advanced version. Don't want to go to far before the changes get set in stone. Beta will be beta after all.
LDDestroier #6
Posted 15 December 2015 - 08:52 PM
Bwahahaha, this is great! You seem to be a quick learner of the new pixel characters!
Wojbie #7
Posted 15 December 2015 - 09:00 PM
Bwahahaha, this is great! You seem to be a quick learner of the new pixel characters!
I have to admit i had this thing 80% made already.
I was working on making similiar APi using asci art based big characters to get this effect.
When i saw the new chars i just had to change direction.
Also without all of Bomb Bloke APIs i would never made this.
Edited on 15 December 2015 - 08:05 PM