469,935 Members | 1,983 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,935 developers. It's quick & easy.

graphics alternative to GDI+ in c#?

Hi:

I need to render text graphics using custome font.

I am running into issues where PrivateFontCollection will hang sometimes
when I instantiate it.

PrivateFontCollection fc = new PrivateFontCollection();

The annoying part is that it hangs IIS, but does not through any error so
there is nothing to try / catch.

Any thoughts?

Are there 3rd party libraries available to render text to graphics using my
own provided ttfs?

Thanks
Aug 25 '06 #1
7 4380
What on earth do fonts have to do with IIS?

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

It takes a tough man to make a tender chicken salad.
"Tarren" <no***********@thankyou.comwrote in message
news:O1**************@TK2MSFTNGP02.phx.gbl...
Hi:

I need to render text graphics using custome font.

I am running into issues where PrivateFontCollection will hang sometimes
when I instantiate it.

PrivateFontCollection fc = new PrivateFontCollection();

The annoying part is that it hangs IIS, but does not through any error so
there is nothing to try / catch.

Any thoughts?

Are there 3rd party libraries available to render text to graphics using
my own provided ttfs?

Thanks


Aug 25 '06 #2
This sounds vaguely to me as if you may be attempting to do something that is
windows-forms specific in a web application, and that could be the cause of
your issue.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Tarren" wrote:
Hi:

I need to render text graphics using custome font.

I am running into issues where PrivateFontCollection will hang sometimes
when I instantiate it.

PrivateFontCollection fc = new PrivateFontCollection();

The annoying part is that it hangs IIS, but does not through any error so
there is nothing to try / catch.

Any thoughts?

Are there 3rd party libraries available to render text to graphics using my
own provided ttfs?

Thanks
Aug 25 '06 #3
Just in support of the OP; Kevin and Peter seem to imply that it would
be unreasonable to do anything with GDI in a web app; to me it seems
perfectly reasonable to be e.g. creating real-time graphics (e.g. a
charting app) and then (for instance) streaming the image to the
client. I have no idea why PrivateFontCollection may cause
difficulties; it is in the System.Drawing assembly (and namespace), so
it should be completely independent of Forms code.

My advice would probably be look at the System.Drawing assembly via
Roeder's Reflector (perhaps with the FileDisassembler plugin), to see
exactly what this class does at the point when it hangs (the default
ctor?). It may be trying to access some random mutex, registry, file
system, or something freaky.

http://www.aisto.com/roeder/dotnet/

Marc

Aug 26 '06 #4


"Marc Gravell" <ma**********@gmail.comwrote in message
news:11**********************@75g2000cwc.googlegro ups.com...
| Just in support of the OP; Kevin and Peter seem to imply that it would
| be unreasonable to do anything with GDI in a web app; to me it seems
| perfectly reasonable to be e.g. creating real-time graphics (e.g. a
| charting app) and then (for instance) streaming the image to the
| client. I have no idea why PrivateFontCollection may cause
| difficulties; it is in the System.Drawing assembly (and namespace), so
| it should be completely independent of Forms code.
|
| My advice would probably be look at the System.Drawing assembly via
| Roeder's Reflector (perhaps with the FileDisassembler plugin), to see
| exactly what this class does at the point when it hangs (the default
| ctor?). It may be trying to access some random mutex, registry, file
| system, or something freaky.
|
| http://www.aisto.com/roeder/dotnet/
|
| Marc

Marc , IMO its' best to start reading the documentation on this namespace
http://msdn2.microsoft.com/en-us/lib...m.drawing.aspx (see :
caution)before you dive into this, The System.Drawing class is not supported
in service based applications like ASP.NET for the simple reason that it
encapsulates GDI/GDI+ and as such, uses Window handles (HWND), these handles
have thread affinity which is really hard to get right in a multi-threaded
environment like ASP.NET, where you are (mostly) out-of-control of the
threads your code is running on.
There are other problems to expect when using this namespace in a service,
(depending on the class), without going into these, it should be clear that
GDI/GDI+ wasn't designed to be used in a service application, reason enough
to stay away from it.

Willy.
Aug 26 '06 #5
Marc,
Not really, I've used GDI+ to create stock charts for display on web pages.
What I meant was that I got the sense that the OP may have been attempting to
do something windows forms specific that might not be possible in an Page
class lifecycle. But since we haven't any sample code to go on, we can only
guess.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Marc Gravell" wrote:
Just in support of the OP; Kevin and Peter seem to imply that it would
be unreasonable to do anything with GDI in a web app; to me it seems
perfectly reasonable to be e.g. creating real-time graphics (e.g. a
charting app) and then (for instance) streaming the image to the
client. I have no idea why PrivateFontCollection may cause
difficulties; it is in the System.Drawing assembly (and namespace), so
it should be completely independent of Forms code.

My advice would probably be look at the System.Drawing assembly via
Roeder's Reflector (perhaps with the FileDisassembler plugin), to see
exactly what this class does at the point when it hangs (the default
ctor?). It may be trying to access some random mutex, registry, file
system, or something freaky.

http://www.aisto.com/roeder/dotnet/

Marc

Aug 26 '06 #6
Thank you Willy; a clear answer with good supporting documentation. I
have learned something, and I happily concede that you are entirely
right. Apologies to all for my adding confusion.

Marc

Aug 26 '06 #7
Fair enough; see also my reply to Willy.

Marc

Aug 26 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by John Bailo | last post: by
3 posts views Thread by Mathieu | last post: by
3 posts views Thread by Daniel | last post: by
1 post views Thread by Daniel | last post: by
7 posts views Thread by Brian Ward | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.