Article View: comp.lang.postscript
Article #3318Re: Variable characters
From: Kenneth Porter
Date: Thu, 11 Oct 1990 04:58
Date: Thu, 11 Oct 1990 04:58
16 lines
1085 bytes
1085 bytes
When I need to get characters to fit a pre-defined space (such as is the case on my business card), I always calculate the point size, sometimes with x and y computed independently. The x size can be calculated by using stringwidth after setting the font at 1 point. The y size can be calculated by iterating over the string and reading the metric info for each character. If you need to set x and y scale independently, use makefont instead of scalefont and provide a scale matrix. This allows me to substitute fonts ad hoc without digging out my calculator to recalculate all of the sizes. Just let the PS interpreter do the grunt work. Ken (shiva@well.sf.ca.us)
Technical Details
Message-ID:
<21131@well.sf.ca.us>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!apple!well!shivaReferences:
<1902@fcs280s.ncifcrf.gov>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!apple!well!shiva From: shiva@well.sf.ca.us (Kenneth Porter) Newsgroups: comp.lang.postscript Subject: Re: Variable characters Summary: Compute your string sizes! Keywords: font, character size Message-ID: <21131@well.sf.ca.us> Date: 11 Oct 90 04:58:35 GMT References: <1902@fcs280s.ncifcrf.gov> Lines: 16