[net.micro.amiga] OpenFont

dillon@CORY.BERKELEY.EDU (Matt Dillon) (10/31/86)

	I've been writing a little, incredibly fast, text-viewer program.
One of its features (and it only has a few.. it's meant not to take up much
room) is to allow you to specify the FONT.

	So, I set up the Text Attribute with the font name and font Ysize,
set everything else to 0, and call OpenFont().  If it fails I set the
flags field to FPF_DISKFONT, open the DISKFONT library, and call
OpenDiskFont().


-I open ruby.font w/Ysize = 8,	no problem, it works fine.  The program fails
on OpenFont() and works with OpenDiskFont().

-I open ruby.font w/Ysize = 12.  OpenFont() does NOT fail.. it gives me the
ruby.font/8 that I openned earlier.

	Is this a bug with OpenFont() or am I supposed to double check
fonts returned to me?
	
Note: OpenDiskFont() seems to work fine.

						-Matt

andy@amiga.UUCP (Andy Finkel) (11/01/86)

In article <8610311855.AA29341@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
>
>	So, I set up the Text Attribute with the font name and font Ysize,
>set everything else to 0, and call OpenFont().  If it fails I set the
>flags field to FPF_DISKFONT, open the DISKFONT library, and call
>OpenDiskFont().
>
>
>-I open ruby.font w/Ysize = 8,	no problem, it works fine.  The program fails
>on OpenFont() and works with OpenDiskFont().
>
>-I open ruby.font w/Ysize = 12.  OpenFont() does NOT fail.. it gives me the
>ruby.font/8 that I openned earlier.
>
>	Is this a bug with OpenFont() or am I supposed to double check
>fonts returned to me?
>	

>						-Matt

This is actually a feature.  OpenFont (and OpenDiskFont) attempt to give
you the font that is closest to what you asked for.  The first
time you asked for ruby 8, OpenFont checked the system font list.
Finding no ruby fonts of any kind, it immediately fails.

The second time you call it, OpenFont, on checking the system font list,
finds a ruby font.  It then tries to give you the closest size match
(it starts on the size you asked for, then steps down by 2 sizes for
every one it steps up; it other words, if you ask for size 12, sizes
11 and 10 are more acceptable than size 13.  This is why it returns
with ruby 8.  
(OpenDiskFont uses the same algorithm, by the way)

You need to check what font you got on return, because there may be
a more acceptable font on disk.  Keep the order you've got, though
(OpenFont, then OpenDiskFont)...it cuts down on disk accesses.

				andy finkel


-- 

			andy finkel
			Commodore(Amiga)
			{ihnp4|seismo|allegra}!cbmvax!andy
		or	 pyramid!amiga!andy

Any expressed opinions are mine; but feel free to share.

I disclaim all responsibilities, all shapes, all sizes, all colors.

"Remember, no matter where you grow, there you are." - Buckaroo Bonsai.