This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Use custom font and also make that font available for other applications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Use custom font and also make that font available for other applications" Watch "Use custom font and also make that font available for other applications" New topic
Author

Use custom font and also make that font available for other applications

Abhi Ahuja
Greenhorn

Joined: Oct 11, 2010
Posts: 7
Hi, I would like to use custom font (TTF), which I can do using Font.createFont(), but I would like other applications to be able to use that font which means I would like to install in my OS(my OS- windows 7) fonts directory. I tried to register to GraphicsEnvironment but other applications are not able to use that font.

Thanks in advance. please help.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

As far as I know this can't be done in Java, short of calling Runtime#exec(...) or ProcessBuilder#start() to launch a native application that can do it.


luck, db
There are no new questions, but there may be new answers.
Abhi Ahuja
Greenhorn

Joined: Oct 11, 2010
Posts: 7
Thanks a lot for your reply Darryl, please let me know if anybody has any work around or anything...thank
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

If the application can only use the installed fonts then there is no workaround.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

There's a big question here: if you want the font installed on your system, why do you want that to be done by a Java program?
Abhi Ahuja
Greenhorn

Joined: Oct 11, 2010
Posts: 7
Hi Darryl,

What I am trying to do is that use a custom font(not available in windows), which I am able to do using CreateFont() and I am using that font in my application. Now when I try to print the text using a Virtual PDF printer(PDFCreator), PDFCreator is printing as Shapes hence the text in the PDF is not selectable.

So just to test I tried to use a font(instead of a custom) which is available in windows font directory, and when I print the content now, the pdf text is selectable, i.e. the content is printed as text and not Shapes. I guess, because the font is not available in windows, PDFCreator is not able to use it.

So in order to deal with this problem, I think only way to achieve is to install in windows and then use the font.

Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use custom font and also make that font available for other applications
 
Similar Threads
Mac Fonts on Windows, need suggestions
JDK 7 is now feature complete
Displaying Unicode in AWT components
dynamic text color for radiobutton?
Tomcat 7 : change port number for manager app