Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pcl font width information

Status
Not open for further replies.

suvigy

Programmer
Nov 7, 2003
5
0
0
HU
Hi all,

I should determine font widths having variable widths. In my application I have to create a table with different cellwidths depending on the text in the cell. How can I determint the width of the fonts?
Thnx in advnace

George
 
If you have the display equivalent of the printer font on your PC, you can find out widths from that.

If the display font is TrueType, there will be a horizontal widths table; not sure about bitmap, Intellifont or Type1 fonts, but there should be something similar with these.

Most IDEs (e.g. C++ Builder, VC++, etc.) make life easier by providing methods to perform this interrogation on your behalf, for a specified text string using a specified font at a specified pointsize.
 
Thnx, Yes, I have no other choice I have to determine the widths with some ide (Visual C++).
I have other problem. I use fixed spacing fonts ( ESCs0P) and can't set the height for them, nothing happens, always the same height. Is there a solution for it.
Thnx

George
 
With fixed-pitch scalable fonts, you have to specify the pitch value, rather than the pointsize value, in the font selection sequence.

i.e. use Esc(s0p#h... for fixed-pitch fonts
use Esc(s1p#v... for proportionally-spaced fonts

The relationship between pitch and pointsize for fixed-pitch fonts varies from typeface to typeface:

for Courier, pitch(cpi) * pointsize(pts) = 120
LetterGothic, pitch*pointsize = 144

are rough guidelines.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top