Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / October 2007

Tip: Looking for answers? Try searching our database.

Problem with non-existent font

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Thielen - 27 Sep 2007 21:43 GMT
Hi;

When a user gives us a font not installed on the system (from a Word
document created on another system that does have the font) we get:

System.Drawing.Font fnt = new System.Drawing.Font("'Berlin Sans FB Demi",
11.0, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);

java.lang.IllegalArgumentException: Font 'Berlin Sans FB Demi' does not
support
style 'Regular'.
  at System.Drawing.Font.CreateNativeFont()
  at System.Drawing.Font.Initialize(FontFamily family, Single emSize,
FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
  at System.Drawing.Font.<init>(String familyName, Single emSize, FontStyle
style, GraphicsUnit unit)

How should we handle this? We need to get font metrics that are at least
close - we can't throw an exception and give up.

Signature

thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

Walter Wang [MSFT] - 28 Sep 2007 05:55 GMT
Hi Dave,

In your other post about CultureInfo, I've just made a reply and posted
some C++ code to check if a font is installed.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
David Thielen - 28 Sep 2007 17:34 GMT
Hi;

Any suggestions on how to pick a substitute font in this case? Or is there
no way to know and I should just use Times New Roman?

Signature

thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

> Hi Dave,
>
[quoted text clipped - 11 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
Walter Wang [MSFT] - 03 Oct 2007 03:28 GMT
Hi Dave,

Sorry for late reply.

My suggestion would be just first check if the font is installed or not, if
not, then fall back to the default dialog font (which should handle font
substitution correctly).

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
David Thielen - 03 Oct 2007 16:48 GMT
Good suggestion - will do.

Signature

thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

> Hi Dave,
>
[quoted text clipped - 14 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.