English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. AMOS

 
 
Thread Tools
Old 12 July 2020, 20:37   #1
Brick Nash
Prototron

Brick Nash's Avatar
 
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.
Brick Nash is offline  
Old 12 July 2020, 21:47   #2
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 46
Posts: 1,626
Send a message via Yahoo to Samurai_Crow
If it's colorful, you'd be better off converting it into icon banks because the text commands are monochrome, I think.
Samurai_Crow is offline  
Old 13 July 2020, 11:02   #3
Brick Nash
Prototron

Brick Nash's Avatar
 
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?
Brick Nash is offline  
Old 13 July 2020, 13:03   #4
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 46
Posts: 1,626
Send a message via Yahoo to Samurai_Crow
Use the ASCII code to represent each letter in the icon bank minus 32 for all the non-printable characters.
Samurai_Crow is offline  
Old 13 July 2020, 14:15   #5
Dan
Registered User
Dan's Avatar
 
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
You only need to create an icon/sprite/bob or whatever bank (or maybe to an extra screen ?), holding the images corresponding to the A$ string, then paste the images accordingly.

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.
Dan is offline  
Old 13 July 2020, 23:54   #6
Brick Nash
Prototron

Brick Nash's Avatar
 
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.
Brick Nash is offline  
Old 14 July 2020, 19:44   #7
Brick Nash
Prototron

Brick Nash's Avatar
 
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
Brick Nash is offline  
Old 15 July 2020, 03:23   #8
adrazar
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
These two variables can be used by FONT_TEXT to determine which Bob image and Bob number to use.
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.
adrazar is offline  
Old 15 July 2020, 09:47   #9
Dan
Registered User
Dan's Avatar
 
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
Dan is offline  
Old 16 July 2020, 11:12   #10
Brick Nash
Prototron

Brick Nash's Avatar
 
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.
Brick Nash is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:44.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.10415 seconds with 15 queries