473,805 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using local font file (.ttf) in asp.net GDI+ app.

Hi,

I am trying to use a special font in an GDI+ application. The font
file is located in my root folder.
The following code does not work but might explain what I am trying to
do...

Font f = new Font(Server.Map Path("somefont. ttf"), 200);

Thank you for your time.

Regards,

Hensson

Oct 20 '07 #1
5 3691
On Oct 20, 1:45 pm, deeh...@gmail.c om wrote:
Hi,

I am trying to use a special font in an GDI+ application. The font
file is located in my root folder.
The following code does not work but might explain what I am trying to
do...

Font f = new Font(Server.Map Path("somefont. ttf"), 200);

Thank you for your time.

Regards,

Hensson
Font.Font(Strin g, Single) Constructor has a family name as a first
parameter, not a file name
http://msdn2.microsoft.com/en-us/library/164w6x6z.aspx

Oct 20 '07 #2
On Oct 20, 1:54 pm, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On Oct 20, 1:45 pm, deeh...@gmail.c om wrote:
Hi,
I am trying to use a special font in an GDI+ application. The font
file is located in my root folder.
The following code does not work but might explain what I am trying to
do...
Font f = new Font(Server.Map Path("somefont. ttf"), 200);
Thank you for your time.
Regards,
Hensson

Font.Font(Strin g, Single) Constructor has a family name as a first
parameter, not a file namehttp://msdn2.microsoft .com/en-us/library/164w6x6z.aspx
P.S.

If you would need to load a font from the file, try following:

PrivateFontColl ection p = new PrivateFontColl ection();
p.AddFontFile(S erver.MapPath(" somefont.ttf")) ;
FontFamily ff= privateFontColl ection.Families[0];
Font f = new Font(ff, 200);

Oct 20 '07 #3
On Oct 20, 1:59 pm, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On Oct 20, 1:54 pm, Alexey Smirnov <alexey.smir... @gmail.comwrote :


On Oct 20, 1:45 pm, deeh...@gmail.c om wrote:
Hi,
I am trying to use a special font in an GDI+ application. The font
file is located in my root folder.
The following code does not work but might explain what I am trying to
do...
Font f = new Font(Server.Map Path("somefont. ttf"), 200);
Thank you for your time.
Regards,
Hensson
Font.Font(Strin g, Single) Constructor has a family name as a first
parameter, not a file namehttp://msdn2.microsoft .com/en-us/library/164w6x6z.aspx

P.S.

If you would need to load a font from the file, try following:

PrivateFontColl ection p = new PrivateFontColl ection();
p.AddFontFile(S erver.MapPath(" somefont.ttf")) ;
FontFamily ff= privateFontColl ection.Families[0];
Font f = new Font(ff, 200);- Hide quoted text -

- Show quoted text -
FontFamily ff= p.Families[0];

Oct 20 '07 #4
de*****@gmail.c om wrote:
Hi,

I am trying to use a special font in an GDI+ application. The font
file is located in my root folder.
The following code does not work but might explain what I am trying to
do...

Font f = new Font(Server.Map Path("somefont. ttf"), 200);

Thank you for your time.

Regards,

Hensson
Have a look at the PrivateFontColl ection class.

--
Göran Andersson
_____
http://www.guffa.com
Oct 20 '07 #5
JT
On Oct 20, 7:59 am, Göran Andersson <gu...@guffa.co mwrote:
deeh...@gmail.c om wrote:
Hi,
I am trying to use a special font in an GDI+ application. The font
file is located in my root folder.
The following code does not work but might explain what I am trying to
do...
Font f = new Font(Server.Map Path("somefont. ttf"), 200);
Thank you for your time.
Regards,
Hensson

Have a look at the PrivateFontColl ection class.

--
Göran Andersson
_____http://www.guffa.com- Hide quoted text -

- Show quoted text -
Any chance you can access this font if it resides in your resources?

JT

Oct 22 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
8152
by: alex | last post by:
Hi, I am looking for a way to populate an HTML table from an external local text file which looks like this: DATE/TIME LAT. LON. DEPTH. ML. -------------------- ---------- ---------- ------- ------- 21/03/2005-04:06:03 XX,XX XX,XX 171 3,42 21/03/2005-12:23:53 XX,XX XX,XX 500 5,4 21/03/2005-12:43:10 XX,XX XX,XX 553 5,38
2
1872
by: linearfusion | last post by:
Hello, I may not have worded the subject correctly, but what I am trying to do is pull the XML data from the following stream, http://www.360voice.com/api/blog-getentries.asp?tag=changeagent&num=5, into a webpage. What I would like to do, or think I need to do is create a webpage that will pull the XML data from the above URL and write it to a local XML file. I would then like to apply an XSL stylesheet to the local XML file and...
4
14229
by: Chuck Anderson | last post by:
My Web Host (Linux - Apache) recently upgraded to Php5. One thing lost in the upgrade was a global configuration that allowed me to place php.ini files in any directory and they would be read and used (I don't know if that was in addition to a global php.ini file or not). Prior to that (a couple of years ago) php directives were placed in the htaccess file in the site's root directory, but after an even earlier upgrade the htaccess...
5
3682
by: =?Utf-8?B?Qkw=?= | last post by:
Hello friends In c# 2005 I have written a function to access "font file name" by "Font name" and it is working fine in all the windows version other than vista, in vista it is throughing an error so please help me how can i access font file name by font name in windows vista or what change i have to do in following function to get the solution my function source code is givin below -
0
1075
by: ashokformac | last post by:
Hi to everybody, how to find the font file size...when i find the size of a font file using file.lengh() function , it returns 0 for font file . For other file it is returning the correct file size . If anybody knows the solution for findding correct file size for font file , please tell me. thans in advance
2
2281
by: Nesster13 | last post by:
Hi, I am building an application that will utilize the local resource file. Right now the application is separated into two part, the header and the content. One of the line at the top of the header is "<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">" When I generate a local resource file what I see at the top of the resource file is "<?xml version="1.0" encoding="utf-8"?>". Now this will create a problem when I...
2
1642
by: ashokformac | last post by:
I am developing a program in java on mac os .. when i try to find filesize it is giving me '0 long' on font file(actual size is some 2000 bytes ) but on other files it is working properly ... can any one know the answer ,, please help me.. thanks in advance ..
1
1524
by: sachinkale123 | last post by:
I m creating multilingual Website. I m using Local Resource file. Applaying culture runtime. I did applied it to 3 Pages, for them it is perfectly working but now It has stopped to apply culture to new files. I tried each and every thing but it is still not working so please help me in solving this problem.
0
1117
by: Andreas Tawn | last post by:
-----Original Message----- g] On Behalf Of Steve Holden Can't help with a recipe, but here's the formal spec if want to figure it out yourself. http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6.html Hope that helps.
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10366
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10105
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9185
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.