[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Text Alignment
Todd,
With monospaced fonts, like Courier, I recommend that you just print
out an example, measure it in inches, and remember that there are
about 72 points per inch.
For proportional fonts, like Times Roman, I wish I had a better answer.
If it's extremely important to have centering/wrapping/truncating work
exactly, you might consider using our hp library, or some other similar
approach. Essentially, you can create a file which contains the widths
of each character and then call a routine to handle the calculations.
Take a look at:
http://www.ontko.com/sqr/hp.html
especially the hp_demo.sqr program.
Something similar can be done for PostScript fonts, but if you're
a PostScript programmer you might be able to use PRINT-DIRECT to
embed the PostScript commands necessary to do your own centering.
Ray
> Don,
>
> Is there a resource I can use to find the exact character width, in points,
> for the various SQR fonts? I came up with a method of calculating the size
> (I got 5.6667 for courier), but it would be much simpler, and probably more
> accurate if I had a more official source.
>
> Thanks,
>
> Todd Becker
>
> >Todd,
> >I don't recall seeing a response to your inquiry, and didn't find one
> >(subject-wise) in the archives, so...
> >
> >On Fri, 4 Jun 1999, Todd Becker wrote:
> >> I originally created a report using VisualSqribe. ...
> >> When I began editing the SQR file, I noticed that the text was centered
> >> using a calculated position rather than the CENTER attribute of the
> >> PRINT function. ...
> >> Has anyone encountered any difficulty using the CENTER attribute? Is it
> >> standard practice to always calculate text positions?
> >
> >In VisualSqribe, yes. VisualSqribe, by default, uses the "graphical"
> >method of declaring the line-height and char-width to be 1 point each.
> >This gives you a 1 point by 1 point grid for exact placement of objects.
> >The center option of the print command will then center the text as if
> >each character were 1 point wide (which of course, is not the case). If
> >you do not need the 1 x 1 grid, you can change VisualSqribe to use a
> >character based layout.
> >
> >> I would like to be able to create a standard header, with centered
> >> text, that can be used as an #include file, regardless of the
> >> orientation of the page.
> >
> >If you need the 1 x 1 grid for all of your reports you can use the
> >$sqr-max-columns pre-defined variable (as of 4.3.2) to calculate where to
> >print text for centering. If your char-width changes between reports,
> >you'll need to set a variable or #define a value to let the header
> >procedure know the current char-width that was used to set the
> >$sqr-max-columns value. And of course, if you change point-size within the
> >header, you'll have to figure in an adjustment for the width of the
> >different point sizes. I think the actual character width (in points) of
> >the default courier font is 0.6 times the point-size.
> >
> >HTH,
> >-----------------------------------------------------------------------
> >Donald Mellen | Ray Ontko & Co. - Richmond, IN - http://www.ontko.com/
> >donm@ontko.com | "In the beginning, there was nothing, which exploded"
>
----------------------------------------------------------------------
Ray Ontko | Ray Ontko & Co | "RO&C: data movers and shakers."
rayo@ontko.com | Richmond, In | See us at http://www.ontko.com/