NSPrintInfo paperSize and NSFont advancementForGlyph problem
NSPrintInfo paperSize and NSFont advancementForGlyph problem
- Subject: NSPrintInfo paperSize and NSFont advancementForGlyph problem
- From: email@hidden
- Date: Wed, 13 Oct 2004 17:17:19 -0300
Hi,
I am trying to develop a Print Preview for my software, but in order for me to
know how many characters I can display in one row, I must know the paper size,
the margins and the width size of the Font character(using a fixed size Font
like Monaco).
I already have the values calculated using:
papersize = [printInfo paperSize];
leftmargin = [printInfo leftMargin];
rightmargin = [printInfo rightMargin];
characterWidth = [font advancementForGlyph:(NSGlyph)'1'].width
Using Letter paper and Monaco 14 Font, I get the following values:
papersize.width = 612
papersize.height = 792
leftmargin = 72
rightmargin = 72
characterWidth = 8.12
Well, if I do 612 / 8 (8.12 rounded down), that gives me 76 characters per row.
So I should display only 76 characters per row, right?
What I do not understand is that when I use TextEdit, I can create a text in
which I write 80 characters per row, select the whole text and set the font to
Monaco 14, send it to the printer and the rows are printed correctly, each row
with 80 characters. How can this be possible if according to the calculations
above only 76 characters per row should be printed? What am I missing here?
Thanks for any help.
Marcos
___________________________________________________________________________________
Acesse nosso portal www.click21.com.br
Porque internet grĂ¡tis, nem a Embratel pode fazer mais barato. Mas pode fazer melhor.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden