Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Abhi Ahuja
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5126
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Abhi Ahuja
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for your reply Darryl, please let me know if anybody has any work around or anything...thank
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the application can only use the installed fonts then there is no workaround.
 
Darryl Burke
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic