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: 346
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: 47
Posts: 1,852
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: 346
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: 47
Posts: 1,852
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: 555
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: 346
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: 346
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: 62
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: 555
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: 346
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  
Old 17 June 2021, 19:37   #11
Arne
Hobby/Indie gamedev

Arne's Avatar
 
Join Date: Jan 2015
Location: Southern Sweden
Posts: 48
For 1-bit fonts I use the excellent FED 1.3 on the Workbench 1.3 Extras disk. It can be copied to a WB 3.1 install (into Tools folder preferably). It supports both fixed width and proportional (variable width) fonts. It saves directly in the OS Font dir. I usually save with incremental names for each version because there is some kind of cache issue when going back and forth between AMOS to print out Quick Fox test strings.

In AMOS:
Get Disc Fonts
' This generates a Font$() name array which you can search.
If Left$(Font$(F_IND),8)="MyOwnFon" ...
' To set:
Set Font F_IND
' To render:
Text 100,100,"Wheee!"

As for FED, you need to experiment a bit to learn what Kern, Space, Width etc all do. Also, FED doesn't quite update WYSIWYG as it's quite ancient. Still, certainly one of the better WB1.3 tools.
Arne is offline  
Old 29 June 2021, 21:03   #12
davideo
Amiga Tomcat

davideo's Avatar
 
Join Date: Sep 2007
Location: Boston Lincs
Posts: 1,378
Quote:
Originally Posted by Arne View Post
In AMOS:
Get Disc Fonts
' This generates a Font$() name array which you can search.
If Left$(Font$(F_IND),8)="MyOwnFon" ...
' To set:
Set Font F_IND
' To render:
Text 100,100,"Wheee!"
When trying this with Amos my system hangs and eventually Guru`s

Tried with Amos, AmosPro and AmosProAGA

Any hints on what may be missing on my set up to cause this?

Otherwise anybody got a 6 point font bank?

Thanks
davideo is offline  
Old 29 June 2021, 21:23   #13
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 47
Posts: 1,852
Amos fonts are not AmigaOS fonts. They're all 8x8. If you want to use AmigaOS fonts, the AMCAF extension has support for them.
Samurai_Crow is offline  
Old 29 June 2021, 21:35   #14
davideo
Amiga Tomcat

davideo's Avatar
 
Join Date: Sep 2007
Location: Boston Lincs
Posts: 1,378
Perhaps I've not been clear in my post.

I would like to open an AmigaOS font with a 6 point size, i.e. aavd 6

But when I use Get Fonts and set the font to the one I want my system crashes.

Even the examples within Amos do the same!!
davideo is offline  
Old 29 June 2021, 21:42   #15
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 47
Posts: 1,852
Perhaps I was unclear in MY post. Amos doesn't support AmigaOS fonts except using the AMCAF extension.
Samurai_Crow is offline  
Old 29 June 2021, 23:49   #16
davideo
Amiga Tomcat

davideo's Avatar
 
Join Date: Sep 2007
Location: Boston Lincs
Posts: 1,378
Quote:
Originally Posted by Samurai_Crow View Post
Perhaps I was unclear in MY post. Amos doesn't support AmigaOS fonts except using the AMCAF extension.
I must have had this at sometime because one of my old programs allowed me to change the font on screen to an AmigaOS font!!

Any idea where I can grab this along with some instructions on it's use please?

Update - located it on Aminet

Last edited by davideo; 29 June 2021 at 23:51. Reason: Update
davideo is offline  
Old 04 December 2021, 01:12   #17
Arne
Hobby/Indie gamedev

Arne's Avatar
 
Join Date: Jan 2015
Location: Southern Sweden
Posts: 48
My install is vanilla, and I was using FED/Workbench (=<3.1) fonts for my AMOS projects back in the day, from floppies, harddrive, and compiled, friends' machines, and more recently in many emulator setups. No modern thirdparty add-on thingy should be needed for rendering old (variable) pixel fonts at least (intellifont was some different vector thing which I never looked into). Not sure why it might be crashing for you. Could be a bad Amos install, or maybe the FONTS: assign is missing making Get Disc Fonts go haywire. Or you tried my code as written setting font to "0", though that doesn't cause problems for me. I omitted the for loop and error checking.

Edit: Tested it on Amos 1.3, and it seems to load and render all the wonky old WB fonts, like Ruby, Emerald, Sapphire, etc. Big fonts render slowly. Small fonts are faster. Kerning and such works properly.

Last edited by Arne; 04 December 2021 at 01:53. Reason: Note
Arne is offline  
Old 21 December 2021, 21:48   #18
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,069
Quote:
Originally Posted by Samurai_Crow View Post
Perhaps I was unclear in MY post. Amos doesn't support AmigaOS fonts except using the AMCAF extension.
It does using the Get Fonts, Set Font and Text commands.
idrougge is offline  
Old 21 December 2021, 21:51   #19
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 47
Posts: 1,852
Ok. I'd never gotten them to work except 8×8 fonts without AMCAF. Maybe it was just the font bank feature of that extension.
Samurai_Crow 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 06:10.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Page generated in 0.11386 seconds with 13 queries