[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: SQR and Courier New Fixed Font Code Example
- Subject: Re: SQR and Courier New Fixed Font Code Example
- From: Ray Ontko <rayo@ONTKO.COM>
- Date: Sat, 20 Apr 2002 15:40:03 -0500
- In-reply-to: <scc045b9.092@upstate.edu> from Dietrich Schmitz at "Apr 19, 2002 04:28:38 pm"
Dietrich, SQR enthusiasts,
Thanks for the kind words and for posting your solution
for the benefit of others. To this I add an explanation
about the calculations.
How I calculate pitch, point-size, line-height, and char-width
for Courier fonts:
Courier font characters have an "aspect ratio" of 3:5 = 0.6.
This is the ratio of the width to the height of the character
cell.
"pitch" is the number of character cells per inch, horizontally.
"font-size" is the height of each character cell.
There are 72 points per inch. The abbreviation for "point" is
"pt".
So, if I want 10 courier characters per inch (10 pitch),
then each character cell is 72/10 = 7.2 pt wide. If I
divide this width by the aspect ratio, I get 7.2/0.6 = 12 pt
tall. Thus, Courier 12 (font-size=12) is a 10-pitch font
with a char-width of 7.2 pt (1/10 inch) and a line-height of
12 pt (1/6 inch).
If I want approximately 17 characters per inch, I notice
that 72 / 17 / 0.6 is approximately 7 pt. So I work
from 7pt as the font-size. I _multiply_ the font-size by
the aspect ratio to get the width: 7 * 0.6 = 4.2 pt.
To calculate the pitch, I divide 72 / 4.2 = 17.142853...
charcters per inch.
Ray
> Hello Fellow SQR Enthusiasts:
>
> Using Courier New 'fixed' font has made life easier for me because printing
> becomes a matter of deciding which 'column' to pass in your print statement
> vs. doing the math to compute 'offsets' across a page with 'proportional'
> space fonts based on points.
>
> Ray Ontko (aka and hereinafter referred to as 'Mr. SQR') was good enough to
> supply a short code snippet for which I am appreciative. So, in the spirit
> of 'sharing the knowledge', I am forwarding it to you as it helped me in why
> I couldn't escape into 17 pitch.
>
> If your organization doesn't have a policy on which fonts you must use, then
> PLEASE, spare yourselves.
>
> Avoid the tedium/agony of messing with proportional space fonts 'like the
> proverbial plague' and use 'Courier New'.
>
> Somewhere in the archives there is mention that a formula applies: 120/Pitch
> = Point Size.
>
> This does not appear to be the case where 17 pitch is concerned, as per the
> code example sent to me by Mr. SQR. (Perhaps Mr. SQR will elaborate on the
> relationship between the Declare-Layout and Alter-Printer statments as they
> need to tie out.)
>
> Mr. SQR's code snippet:
> [SQR codes begins here]
> #define pitch_17
>
> begin-setup
> declare-layout default
> #ifdef pitch_10
> ! 10 pitch
> line-height = 12 pt
> char-width = 7.2 pt
> #end-if
> #ifdef pitch_12
> ! 12 pitch
> line-height = 10 pt
> char-width = 6 pt
> #end-if
> #ifdef pitch_13
> ! 13.[3...] pitch
> line-height = 9 pt
> char-width = 5.4 pt
> #end-if
> #ifdef pitch_15
> ! 15 pitch
> line-height = 8 pt
> char-width = 4.8 pt
> #end-if
> #ifdef pitch_17
> ! 17.[142857...] pitch
> line-height = 7 pt
> char-width = 4.2 pt
> #end-if
> end-declare
> end-setup
>
> begin-program
> do main
> end-program
>
> begin-procedure main
> #ifdef pitch_10
> alter-printer font=3 point-size=12 pitch=10
> print '10 pitch' (1,1)
> #end-if
> #ifdef pitch_12
> alter-printer font=3 point-size=10 pitch=12
> print '12 pitch' (1,1)
> #end-if
> #ifdef pitch_13
> alter-printer font=3 point-size=9 pitch=13.333333
> print '13 pitch' (1,1)
> #end-if
> #ifdef pitch_15
> alter-printer font=3 point-size=8 pitch=15
> print '15 pitch' (1,1)
> #end-if
> #ifdef pitch_17
> alter-printer font=3 point-size=7 pitch=17.142857
> print '17 pitch' (1,1)
> #end-if
>
> next-listing skiplines=1
>
> print 'Hello. ' (1,1)
> print 'I love you.' ()
> print 'Won''t you tell me ' (2,1)
> print 'your name?' ()
> end-procedure
> [SQR codes ends here]
>
> Apparently, Mr. SQR is a 'Doors' fan.
>
> Anywho..., I hope this/his example helps everyone out who may have wanted to
> use 'Courier New', but thought they couldn't.
>
> Regards to everyone and thanks again to Mr. SQR
> Dietrich
>
----------------------------------------------------------------------
Ray Ontko rayo@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788
Ray Ontko & Co. Software Consulting Services http://www.ontko.com/