From: bcoleman@hayes.com (Bill Coleman)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Alg. for Detection of Monspaced Fonts
Date: 15 Dec 92 15:14:34 EDT
Followup-To: comp.sys.mac.programmer
Organization: Hayes Microcomputer Products, Norcross, GA

In article <de19-141292204941@mac06-pg2.umd.edu>, de19@umail.umd.edu (Dana S Emery) writes:
> In article <6534.2b28a410@hayes.com>, bcoleman@hayes.com (Bill Coleman)
> wrote:
>> 
>> In article <scott.724029618@phylo>, scott@phylo.life.uiuc.edu (Scott Howard) writes:
>> > My Application requires that all fonts it uses are monospaced
>> > and will allow the user to choose display fonts that meet that 
>> > requirement.
>> 
>> Perhaps your application needs to be rewritten to allow proportional fonts
>> 
>> I ran into this in 1984. Our solution was to create our own fonts. Today the
>> better solution is to support proportional fonts.
> 
> ??? This is an issue of UI, some user will want to specify monospaced fonts
> for certain situations.

True, but he was asking for a way for his program to only display 
monospaced fonts. That implies the user got only a selection of monospaced
fonts because the program can't support proportional fonts.

> Computer code, Email and plaintext documents often look best when rendered
> in a monospaced font, especially when they contain tabular material which
> was laid out using a monospaced font.  

True. And the selection of several fonts will often prove that the 
monospaced ones look "right." There's no need for the program to single
this out (mainly because they can't, really).

> The user is not always knowledgable as to what fonts are monospaced, and 
> program help is often considered welcome for this.  

Perhaps this type of information is better regulated to the "help" and 
documentation portions of the program, not the code?

> Anyway, to determine if a font is monospaced, one must decide/determine if
> international fonts are to be supported.  If not, then one has only to
> exclude symbolic fonts (by FOND ID range), and incomplete fonts (by
> inspection of the FontRec structure), and then compare selected characters
> (say "WWWMMMiii".

Why not just check all the characters for the same width? (At least for all
Roman scripted characters, the standard Apple 256 character set should do)
Why narrow the choices to merely W, M and i? After all, if you display
something with a punctuation character that is narrow or wider in your
fixed-pitch display, it is going to look funny, too.

> Short of a comitment from Apple, I hesitate to offer a strategy for
> international fonts, those which are discused in Apples literature are
> amenable to the test given above, but I suspect that some font will someday
> be invented which would fool it.
> 
> BTW, dont try to analyse the entirety of ALL fonts, some are rather a bit
> larger than you would think :-).

256 characters doesn't seem TOO bad.

-- 
Bill Coleman, AA4LR                ! CIS: 76067,2327    AppleLink: D1958
Principal Software Engineer        ! Packet Radio: AA4LR @ W4QO
Hayes Microcomputer Products, Inc. ! UUCP: uunet!hayes!bcoleman
POB 105203 Atlanta, GA 30348 USA   ! Internet: bcoleman%hayes@uunet.uu.net
Disclaimer: "My employer doesn't pay me to have opinions."
Quote: "The same light shines on vineyards that makes deserts." -Steve Hackett.