PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Apr 28, 2024 11:42 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: The Unit of Font
PostPosted: Mon Nov 17, 2008 9:46 am 
Offline

Joined: Mon Nov 03, 2008 4:18 pm
Posts: 8
Hi,

i'm tring to use the unit of font as Point but the systeme give me an error:

Must use "GraphicsUnit.World".

Why a can't use GraphicsUnit.Point???????



Thank you

Riccardo


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Nov 17, 2008 12:38 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Hi!

I don't know - that code is not executed in our application.
I'd expect font sizes to be in Points anyway.

You could replace the code (in XFont.cs)
Code:
if (font.Unit != GraphicsUnit.World)
  throw new ArgumentException("Font must use GraphicsUnit.World.");

with the following
Code:
if (font.Unit != GraphicsUnit.World && font.Unit != GraphicsUnit.Point)
  throw new ArgumentException("Font must use GraphicsUnit.World or GraphicsUnit.Point.");

and see what happens.
Maybe it'll work, maybe the line
Code:
this.size = font.Size;

requires some modification.

I think it'll work.
Please let us know whether it works or not (if it does, this change will be included with the next release).

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 17, 2008 2:59 pm 
Offline

Joined: Mon Nov 03, 2008 4:18 pm
Posts: 8
i was tolking about:

Dim fontArialNARROW8_BOLD As New System.Drawing.Font("Arial Narrow", ConvertiPuntiInMillimetri(8), FontStyle.Bold, GraphicsUnit.Point)



on it i get the error.
)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Nov 17, 2008 3:28 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Yep.
With a li'l change in XFont.cs (as described above) you won't get that error.

Or create the font as
Code:
Dim fontArialNARROW8_BOLD As New System.Drawing.Font("Arial Narrow", 8, FontStyle.Bold, GraphicsUnit.World)

and see if it works.

BTW: Why do you call "ConvertiPuntiInMillimetri" if you specify "GraphicsUnit.Point"?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: I use a function
PostPosted: Mon Nov 17, 2008 5:27 pm 
Offline

Joined: Mon Nov 03, 2008 4:18 pm
Posts: 8
I use the function ConvertiPuntiInMillimetri because of the unit in font!!!!!

Using GraficUnit.World the routine use millimetres because in the begin of routine i have setted page unit in Millimetres!!!
Dim gfx As XGraphics = XGraphics.FromPdfPage(page, XGraphicsUnit.Millimeter) as you suggest me!

I hope you understand, il you speack italian I could explain you, or in Deutche when my wife will be Here!


Thanks!

But:

Dim fontArial8 As New System.Drawing.Font("Arial", 8, FontStyle.Regular, GraphicsUnit.Point)
DOESN't WORK!!!!!

He said Must Use GraphicsUnit.World WHYYYYY!!!!!!!!!!


Top
 Profile  
Reply with quote  
 Post subject: Re: I use a function
PostPosted: Tue Nov 18, 2008 9:45 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
ridaria wrote:
Dim fontArial8 As New System.Drawing.Font("Arial", 8, FontStyle.Regular, GraphicsUnit.Point)
DOESN't WORK!!!!!

No need to shout!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

This is not the code snippet I suggested.

ConvertiPuntiInMillimetri sounds like "ConvertPointsToMillimetres" to me. Right?
If so, specifying "GraphicsUnit.Point" makes no sense!

Using GraphicsUnit.World you won't get an error.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 364 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group