![]() |
![]() |
![]() |
#1 |
Prototron
![]() Join Date: Mar 2015
Location: UK
Posts: 297
|
Creating fonts
Does anyone have any information about creating a font and a font file for use within AMOS?
The manual describes the various instructions to fetch and use fonts, but nothing on actually making the fonts or a font file. Even the font editor seems to assume that you have a ready made font which can be loaded and edited, but that initial "how to" for actually creating them seems to be missing. I have a lovely character set of 8x8 letters within a single .iff image file, but I've no clue what to do with it in order to turn it into a font for use with the Text instructions. Thanks. |
![]() |
![]() |
#2 |
Total Chaos forever!
![]() |
If it's colorful, you'd be better off converting it into icon banks because the text commands are monochrome, I think.
|
![]() |
![]() |
#3 |
Prototron
![]() Join Date: Mar 2015
Location: UK
Posts: 297
|
Ok that's easy enough to slice up and import. How would I go about using them with strings and the like though? Or is it just a case of writing custom code to assign a bank number to a letter?
|
![]() |
![]() |
#4 |
Total Chaos forever!
![]() |
Use the ASCII code to represent each letter in the icon bank minus 32 for all the non-printable characters.
|
![]() |
![]() |
#5 |
Registered User
Join Date: Nov 2004
Location: Germany
Posts: 543
|
Hi
here is a code,which converts a text string into positional numbers. Code:
A$=" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890" TXT$="A TesT853" For X=1 To Len(TXT$) Print Instr(A$,Mid$(TXT$,X,1)) Next But pre-rendering the text is maybe necessary for slower machines or to speed up the game. Last edited by Dan; 13 July 2020 at 14:24. |
![]() |
![]() |
#6 |
Prototron
![]() Join Date: Mar 2015
Location: UK
Posts: 297
|
Excellent! Thank you everyone.
![]() I had thought about just doing full words and sentences as icons or Bobs, but I wasn't sure. |
![]() |
![]() |
#7 |
Prototron
![]() Join Date: Mar 2015
Location: UK
Posts: 297
|
Ok just a little follow up question:
I used Dan's code and tweaked it a little, and it works great at fetching the Icons from the bank. I get a nice little typewriter effect if I put it in the loop as well. The problem is that by using Icons the text is underneath any Bobs I put on screen. I switched it so that the text is now Bobs too, but I can't seem to find any other instruction other than "Paste Bob" that works, and as far as I can see you can't set the Bob number for that (and hence can't set the priority). Using a new Bob for every single letter seems a bit bloated, so I was wondering of there was another way that I'm perhaps missing? Thanks once again for all the help! Here's what I'm doing in the code: Code:
Procedure FONT_TEXT[TX,TY] Shared WORDZ$ A$" ABCDEFGHIJKLMNOPQRSTUVWXYZ.,*........." TXT$=WORDZ$ For X=1 To Len(TXT$) TF=Instr(A$,Mid$(TXT$,X,1)) Paste Bob TX,TY,TF TX=TX+8 Next End Proc And this is in the main Loop Do If writetext =0 : Rem This just stops the text being written once it's done wordz$="Hello" proc TEXT_FONT[20,150] writetext=1 endif loop |
![]() |
![]() |
#8 |
Registered User
![]() Join Date: Feb 2017
Location: Oslo
Posts: 51
|
If you want moving objects behind the text, the most versatile option is to turn the text into Bobs. One Bob for each letter is indeed not a very good solution, it's better to group them into larger units.
I think the natural way to go about this from your current program is to have the FONT_TEXT-procedure convert the input string into a Bob-image, which it then reveals as a Bob at the given coordinates. Here is how I imagine the procedure could be implemented, in pseudocode: Procedure FONT_TEXT[TX,TY,LINE$] (<- An ideal procedure for having the LINE$ to be output included as a parameter) - Paste the font Icons into a hidden screen letter by letter according to LINE$ - Store the result as a (temporary) image in the bob bank. - Assign the image to an unused Bob, which is to be placed at coordinates TX,TY End Proc You should probably extend the list of parameters to also include the Bob number and image number you wish to use. Alternatively, it might be more convenient if the procedure could assign those values automatically.. To that end, I had an approach like this in mind: Code:
Global LINEBOBIMAGE,LINEBOBNUMBER Procedure FONT_TEXT_RESET LINEBOBIMAGE=200 : Rem Any image number beyond the end of the original bank will do LINEBOBNUMBER=32 : Rem Leave some lower Bob numbers for the objects behind the text End Proc Then if FONT_TEXT adds 1 to both variables right before reaching End Proc, the next time FONT_TEXT is called from the main program the incremented values will be used instead. One must with this method remember to call FONT_TEXT_RESET regularly in order to keep the used Bob- and image numbers within a reasonable range. |
![]() |
![]() |
#9 |
Registered User
Join Date: Nov 2004
Location: Germany
Posts: 543
|
To draw the text (pasted bobs) at top of the other bobs, draw them just before the end of the loop.
something like this: Code:
Do cls Proc KeyBD Proc GameLogic Proc Moveplayer Proc MoveEnemy Proc DrawPlayer Proc DrawEnemy Proc Do_FONT_TEXT screenswap Loop |
![]() |
![]() |
#10 |
Prototron
![]() Join Date: Mar 2015
Location: UK
Posts: 297
|
Thanks for all the great advice folks!
I used everyone's techniques, although my code is a bit clumsy and needs serious optimisation, but it does work and the text is displaying on top of everything now. ![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Amiga fonts to PC ? | abelthorne | support.Apps | 19 | 29 January 2018 21:35 |
Fonts | GordonM | support.WinUAE | 8 | 04 May 2016 19:20 |
Kara Fonts? | Photon | request.Apps | 23 | 15 November 2008 00:22 |
Digita fonts | MrZammler | request.Apps | 4 | 12 December 2005 11:21 |
Fonts | alkis21 | request.Apps | 2 | 23 August 2002 10:33 |
|
|