Using fonts which aren't "installed"

According to a Java2D book I have you can definitely load Type 1 fonts and TrueType fonts (and any other type that java supports) from some location other than the defaults by setting the java.awt.fonts command line option like so:
java -Djava.awt.fonts=<extraFontsDirectory> MyApplication
for example:
java -Djava.awt.fonts=/local/FontTest/res/fonts FontTest
Then supposedly you can just create a new font object with the font you want from your extra fonts directory like this:
Font font = new Font("Curlz MT", Font.PLAIN, 40);
where Curlz MT is the font name.
I'm having trouble getting this to work, but I'm thinking it's because I can't get the path to the extraFontsDirectory correct, or I'm getting the font name wrong...
I have the extra fonts directory in a folder called fonts with 2 true type font files, which is in the same place as the application class file... I run the application using:
java -Djava.awt.fonts=fonts myApplication
But I always get the default fonts instead of the ones I'm specifying... I tried to verify the font face names by actually adding them to Windows, so I think I have the font name correct.
Has anyone had any luck with this?
It seems like doing this works but it just doesn't seem as flexible as the above solution:
fileStream = new FileInputStream(fontPath);
font = Font.createFont(Font.TRUETYPE_FONT, fileStream);
Font scaledFont = font.deriveFont(Font.PLAIN, 12);

The first thing you have to do is to make your JVM to recognize your font.
This can be achieved by initializing your font in the first statement of your main method.
public static void main(String[] a)
   fileStream = new FileInputStream(fontPath);
   font = Font.createFont(Font.TRUETYPE_FONT, fileStream);
   Font scaledFont = font.deriveFont(Font.PLAIN, 12);
  //create your class instance here
}Hope this helps you.
Cheers!

Similar Messages

  • Safari and Leopard seeing fonts which aren't installed?

    I'm having a problem in which Leopard seems to be seeing fonts which aren't installed.
    I like to have my web pages display in Helvetica, and I'm pretty obsessive about cleaning out all of the places OS X and the various Adobe and Microsoft apps stash fonts. With Tiger and earlier this wasn't a problem, but Leopard seems to be doing something new. Specifically, Safari--and only Safari--shows that Georgia, Verdana and Times are installed and renders web pages with them, even though I have removed all of those fonts from my system.
    I have double and triple checked to make sure none of those fonts are left on my drive. I searched for them, took all the instances I could find, zipped them, copied them onto a second hard drive and deleted the instances on my primary drive. Searching with Spotlight doesn't find them. I open Font Book and it doesn't see them. No other application shows the fonts as available. If I open up Fontexplorer it doesn't show those fonts as active or available, and I have used it to clear caches and restart. Yet if I go to Safari->Preferences->Appearance, the fonts show up as available, and only in Safari.
    Does anyone know if Apple has made some change in Webkit/Safar, or do I have some old cache file sitting around? I did a Archive and Install, and preserved my user settings. Could there be a file hanging around I don't know about?

    does it pre-load/pre-install fonts into your system you dont have or something???
    It can't add software to your system that is not there somewhere already, but it will activate fonts no matter where they are for use by an app if the app requests the font. You can set it to ask you first before it does this.

  • How to use Fonts which are not installed on the users computer?

    I need to use various fonts in an applet without forcing the user to install them. I have found this method
    createFont(int fontFormat, InputStream fontStream)
    Returns a new Font with the specified font type and input data.
    How can I use this or any other routines to catch the font placed somewhere on the internet?
    Sincerely,
    Trevor Hardcastle

    In java 1.3.1, the type parameter has to be Font.TRUE_TYPE, which just leaves you with the problem of determining the correct fontStream parameter. You can easily obtain an InputStream for a remote resource by creating a URL to the resource (which presumably must specify a .TTF font file), and then using the method URL.openStream().
    Be aware, however, that if you want to access URLs from within an applet, then there are security implications of trying to retrieve data from remote machines other that the one directly hosting the applet (read up on applets and security policies).

  • After installing Firefox I was prompted to update Adobe, but the instructions call for me to accomplish things by using tabs which aren't present.

    Firefox said that the Adobe instructions are outdated, but I still cannot locate the tab which I am told to use.

    Let's assume you start here:
    http://get.adobe.com/flashplayer/
    Then uncheck the McAfee box and click Agree and Install Now.
    Do you get a yellow infobar, just below the location bar, that requires you to approve the installation? If you allow that, you get an add-on from Adobe, which is an installer that then grabs the Flash player.
    Does that make sense?
    Edit: This is a direct download link I found some time back. Because you should always be very, very suspicious of direct links to EXE files on the web, make sure to scan any download before running it. In other words, do not choose OPEN, only SAVE, and then check it for safety.
    http://fpdownload.adobe.com/get/flashplayer/current/install_flash_player.exe

  • Hello. I am trying to self host Italia fonts (Book, Bold and Medium) on Adobe Muse. I purchased web fonts from Linotype that are "obfuscated" - which means the name is hidden. Apparently I also need to install system fonts. Can I install with code in muse

    Hello! I am trying to self host Italia fonts in muse. I purchased from Linotype the web fonts. But they sent obfuscated fonts and code. I need to also install as system fonts and those do not work for that. We already have different Italia fonts that we owned prior but they are not obfuscated... Is this a problem? Is there an easier way I can do this? TIA!

    Abhishek,
    Thank you for the reply. Wanted to comment on a few things.
    I reviewed the other post that you've referenced. Nothing unusual jumped out at me as something that I was not aware of. I'm running an older iMac that is in good working condition. 2.4 GHz Intel Core 2 Duo, 24" screen. I know this issue is fleeting, as I stated earlier typically can be corrected with a restart of the CC Desktop application (that I am always running at startup). I have not been able to determine that shutting down Muse corrects the issue. I would, at this time say it doesn't.
    I did open InDesign and see if the fonts in question, Open Sans and Open Sans Condensed, were present and usable. They were. The fonts are shown as being synched in my CC Desktop app window (even if they are not "installed" in Muse). That is expected but it may be a bug in how Muse brings in a font from those that are already synched to your CC account. I don't know enough about how that works to comment.
    And just to complicate matters, Muse seems to be working again, the fonts that is. I brought them back in and they are showing up in all locations (which there are actually three - see screen shots).
    First is primary text menu dropdown (to right of orange "Text").
    Second is if you click orange Text link. Another drop down menu appears.
    And lastly, the Text Panel to right of screen.
    I also wanted to add this extra bit of information, for what it is worth. When the issue arises and you do not get the sub-menu dropdown showing various styles of the font (italics, bold, etc.), one can use click on the missing font if you had used it previously and it is present in the "previously used font" list.
    Cheers!

  • My computer says I cannot use icloud because I have multiple versions of outlook installed. How do I find out which versions are installed and how do I decide which one to delete?

    My computer states that I have multiple versions of outlook installed and that i cannot use icloud. How d if find out which versions are installed and which ne to delete without interrupting the other?

    That's a Windows/Office problem. You should ask in the Microsoft support forums.

  • What is the difference between Safari 5.1.7 and 5.1.10? I can not log on to my website, so that their customer service has said that they are using Safari 5.1.7, and I use 5.1.10 (which I have installed on my computer, Mac)

    what is the difference between Safari 5.1.7 and 5.1.10?
    I can not log on to my website, so that their customer service has said that they are using Safari 5.1.7, and I use 5.1.10 (which I have installed on my computer, Mac)

    Might be the security fixes >  Safari 5.1.10 for Snow Leopard

  • I created a brochure in pages and exported it to a pdf format. The pdf looks and opens perfectly using preview but when opened in adobe reader (which my printer uses), fonts look odd, transparencies don't display...etc. Tells me error exists on page?

    I created a brochure in pages and exported it to a pdf format. The pdf looks and opens perfectly using preview but when opened in adobe reader (which my printer uses), fonts look odd, transparencies don't display...etc. Tells me error exists on page?

    Does this essentially mean there is no way to fix this problem on my end? It's a pity because the design and branding of my brochure will suffer if I remove transparencies and use different fonts. It also concerns me moving forward because it means the quality of print on my pieces will be significantly lower because most commercial printers use Adobe products.

  • SharePoint Databases - How to determine which ones are being used and which ones aren't

    I am not sure where to exactly post this question.  On the SQL Server side or on a SharePoint side.
    I am a SQL Server Database Administrator who is monitoring some SharePoint databases.  On a daily basis it seems that they are creating new databases but don't delete the databases that they are no longer using.  For example, they might be testing
    on a development server and if things aren't working properly instead of asking that the databases be deleted they just go ahead and create new databases to do what ever they need to do.  Is there a way on the SQL Server side to determine which SharePoint
    databases are being used and which ones aren't being used?  Or does one determine this information through the SharePoint Central Administration console?
    lcerni

    Hello,
    The following query gives you the databases now in use.
    SELECT
    DISTINCT d.name
    FROM
    sys.dm_tran_locks
    tl INNER
    JOIN sys.databases
    d
    ON
    tl.resource_database_id
    = d.database_id
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • "We want to use any one of a variety of digitizers: NI5102, NI5112, NI5122 and have the application determine which one is installed.

    "We want to use any one of a variety of digitizers: NI5102, NI5112, NI5122 and have the application determine which one is installed. Similar to the LabVIEW "niScope Init", using what Measurement Studio .NET call can one ascertain the model name of the digitizer using C# in .NET?

    Sorry, meant to post to "high speed digitizers".

  • I'm new to boot camp and have always used Parallels which was easier to install but now I can't get my hands on Windows 8 for boot camp?  What do i do?

    I'm new to boot camp and have always used Parallels which was easier to install but now I can't get my hands on Windows 8 for boot camp?  What do i do?

    There is no Windows for Boot Camp. just buy a copy of Windows.

  • I have got a lot of apps, which are not installed on any of my iDevices anymore. is there a possibility to remove all those apps from iTunes without searching which ones are, and which ones aren't installed on one of my iDevices?

    I have got a lot of apps, which are not installed on any of my iDevices anymore. is there a possibility to remove all those apps from iTunes without searching which ones are, and which ones aren't installed on one of my iDevices?

    Assuming all the device(s) have been synced to this computer as its Home computer. The easiest way would be to delete all the apps from iTunes. After which connect your device(s) to the computer (iTunes) and transfer purchases from the device(s) by right click (control click) the device name in the left sidebar and the click transfer purchases. When done only the apps on your device(s) will be in you iTunes library.
    Hope that helps

  • How can I access a wider variety of fonts that I can install on my computer? (Designer)

    I'm a junior Designer working for a Digital agency with 30+ developers.
    The company does not have a font library but a type kit account. I have used Google fonts a few times but the selection there is quite scarce.
    Type kit is great for web fonts however it does not allow you to download the font files and install them on to your computer and I want to be able to put them into the design and experiment with them before the designs are taken to the developers.
    I have not found a solution for this that is not extremely costly or legal.
    As I am the first and only designer in this company, there is no selection of fonts available apart from those that are already installed on the computers.
    Does anyone have any suggestions that could help me with my problem please?
    Thanks in advance, all feedback is greatly appreciated!

    Hi Lauren,
    We have been rolling out a new feature which allows you to use fonts from Typekit on the desktop for word publishing, print design, and more.  You can learn more from this blog post:
    http://blog.typekit.com/2013/08/08/sign-up-for-early-access-to-desktop-font-sync/
    The feature is currently still in early release, which means you would need to sign up for access, as explained in that blog post.  Font sync will be available to all users in the near future, though.
    Once you have signed up and been granted access, however, you will be able to sync Typekit fonts to your desktop.  There's more information available on our website:
    http://help.typekit.com/customer/portal/topics/514077-syncing-fonts-to-the-desktop/article s
    I hope that this helps; let me know if you have any other questions!  Best,
    -- liz

  • Using fonts when launching from JNLP

    Hello,
    I followed the directions in this link http://fxexperience.com/2010/05/how-to-embed-fonts/ and was able to add and use fonts in my javafx program when launched from Netbeans. But when I try to launch from JNLP, the fonts do not show up (the text shows up as Arial).
    Is there something special I need to do to access the fonts in the jar and utilize them?
    As the link directed I created a fonts folder in my src folder where I store all the .ttf file, and created a fonts.mf file in META-INF where I map a name to the font file. Works fine when launching from netbeans.
    thanks in advance for your help
    jose

    I've found the problem! It's the timestamp for the JNLP file. But unfortunately I can't figure out the workaround as yet.
    To explain the problem it would be best to start with my application's installation procedure:
    The applcation is installed by way of CD (using javaws -import) as downloading an 8mb jar file over dialup is unwieldy. Subsequent updates are retrieved from the server. Jardiffs are sent back to the webstart client so updates over dialup becomes manageble.
    The application jar file in the CD is version 1.0. Let's say the server is now at version 1.3 with the timestamp 2005-10-01 00:00:00.
    The user installs the application using the CD today which gives his JNLP file the timestamp of 2005-10-03 00:00:00.
    When the application is started, it calls the server to check for updates. Although the JNLP file returned from the server specifically states that the current version is at version 1.3 Java Web Start insists on using the timestamp to perform the comparison first.
    Since the timestamp of the JNLP file in the user's pc is dated later than the JNLP file in the server, Java Web Start ignores the version checking and assumes that the application in the server is the latest and greatest.
    Has anyone encountered a similiar situation? The only solution I can think of is to hack the JNLPDownloadServlet to return a date that's way in the future so that Java Web Start picks up the changes... sigh.
    Is it possible to disable the timestamp checking for the JNLP files? As again, help is mucho appreciated and there are 10 duke dollars at stake too :)

  • Fonts after a new install

    Hello Forum,
    Having completed a new install of arch, and sucessfully installed the Gnome Desktop Environment, I am having trouble printing legibly and viewing web pages properly, problems that I assume are to do with incorrectly/insufficiently installing fonts.
    I have tried to learn about what fonts can/should be installed as a basis for 'normal' web browsing and printing from reading the ArchWiki, but I have become somewhat confused, and seem to have got stuck at this point.
    I wondered if someone could give me some advice on the 'basics' to get me 'up and running' with printing and web browsing please?
    Many thanks everyone.
    Last edited by fitzyj (2015-01-07 13:12:15)

    fitzyj wrote:I have tried to learn about what fonts can/should be installed as a basis for 'normal' web browsing and printing from reading the ArchWiki, but I have become somewhat confused
    The first part of that is good.  The second part is understandable - but if we're to help we need to know which wiki pages you've followed, and what you've already done.
    There are many approaches.  It seems many archers use the infinality configurations (I tried it, but it didn't suit me).  But for a simple pragmatic approach, I'd suggest installing ttf-ms-fonts from the AUR.  For better or for worse, many websites rely on ms fonts.

Maybe you are looking for