Using Type 1 fonts in Java 1.5

I'm trying to use the Font.createFont() method to instantiate a Type 1 font. The second parameter to the createFont() method asks for a filename...but what kind of Type 1 file is needed? I've tried .pfa, .pfb, and .pfm files, and Java doesn't recognize any of them as proper Type 1 files.
Can anyone who knows something about Type 1 fonts help? (I only know just enough to be completely confused about the different Type 1 filetypes.)
Thanks.

The exception I'm getting looks like this:
java.awt.FontFormatException: Unrecognised Font Format
     at sun.font.FontManager.createFont2D(FontManager.java:1520)
     at java.awt.Font.<init>(Font.java:438)
     at java.awt.Font.createFont(Font.java:745)

Similar Messages

  • True Type Fonts in Java

    Hi all
    I searched through the forum and found some threads with the same problem but never a solution attached so here is my question:
    I'm currently trying to use a True Type Font in Java. I installed the font under windows and it works fine in e.g. Word, but when I try to use it in Java all I can see are "rectangles". I'm not sure if the problem lies in the font itself or if it is a problem of Java. The fonts are named "Fughetta" and "Toccata" and can be found here: http://www.efn.org/~bch/aboutfonts.html. He is a code snippet I'm using to test the font:
    public void setFonts(Graphics g)
            if (f != null) {
                return;
            f = new Font("Fughetta", Font.TRUETYPE_FONT, 26);
            System.out.println(f);
        public void paintComponent(Graphics g)
            super.paintComponent(g);
            setFonts(g);
            String s1 = "1234567890��!\"�$%&/(()=?`";
            String s2 = "qwertzuiop�+asdfghjkl��#yxcvbnm,.-<";
            String s3 = "QWERTZUIOP�*ASDFGHJKL��'YXCVBNM;:_>";
            String s4 = "1��{[]\\}@�~�|";
            g.setFont(f);
            g.drawString(s1, 10, 30);
            g.drawString(s2, 10, 70);
            g.drawString(s3, 10, 110);
            g.drawString(s4, 10, 150);
        }All help is appreciated ;)
    - marc

    Hy, Thanks for your sollution, but now I can't use this kind of approach.
    I need to show a Bar Code Font inside a JTable cell, so I created my CellRenderer, in which I tried to change the font to my "Code EAN13" True Type font.
    public Component getTableCellRendererComponent(JTable table,
                Object value, boolean isSelected, boolean hasFocus, int row, int column)  {
                 Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                 if (column == CollectInfoTableModel.CODBAREPRODUS_INDEX ) {
                         Font barCodeFont = new Font("Arial", Font.BOLD, 36);
                         c.setFont(barCodeFont);                 
    }This doesn't work, it just prints some strange characters.
    I tried your sollution, but when I make :
    Graphics2D g2D= (Graphics)c.getGraphics();i keep getting g2D = null.
    What can I do ?
    Is there a way to obtai a valid Grapics object on which to draw the glyphVector on ?

  • Using Troy font in Java

    Hi,
    I am using the Troy fonts which I had installed from MICR by TROY (EX).zip like Troy CMC7 ,Troy Auto-Protect (screen).ttf Troy OCR-A (screen).ttf etc.
    We are developing a java program to generate .ps output based on the font settings selected using an user interface developed using C#. I am able to generate the .ps files using all fonts in windows other than
    Troy. But in the C# user interface I am able to see the preview with the
    respective Troy fonts (working fine) , and the font selections are
    reaching my java program , but when java generates the .ps file what
    ever text is marked using Troy font is not getting displayed in the .ps file.
    I tried setting text with Troy fonts in a word file and generated a .ps
    file which is too generating proper output. To get output ,. I am not using any physical printer but just opening the .ps file using a GhostViewer (GSView) and see how it appears. (the .ps generated using OKI C7400 v1.7 for XP virual PostScript printer).
    Can you please confirm whether if there are any limitations in JDK 1.4
    processing Troy fonts?
    Thanks in advance
    Kind Regards
    -joshy

    Hi,
    Here's an example..
    The code has not been tested/compiled.
    public class Example implements Runnable {
        private List queue;
        public Example() {
            queue = new LinkedList();
        public void post(Object item) {
            synchronized (queue) {
                queue.add(item);
                queue.notify();
        public void run() {
            try {
                while (true) {
                    Object item = null;
                    synchronized (queue) {
                        if (queue.size() == 0) {
                            queue.wait();
                        item = queue.remove(0);
                    // Handle the item..
            } catch (Exception e) {
                e.printStackTrace();
    }/Kaj

  • How to use different fonts in java

    i want to use some other font,what should i do to use a different font??? thanks in advance

    Hi,
    Use the function below for the component you want to change the font.
    setFont
    public void setFont(Font f)
    Sets the Font of this object.
    Parameters:
    f - the new Font for the object
    Hope this helps
    Roopasri Vittal
    Developer Technical Support
    Sun Microsystems
    http://sun.com/developers/support

  • Using WingDing Fonts in Java

    I've seen this question asked before, but I haven't been
    able to find an answer! I'm having trouble displaying the
    WingDings font. I get a box rather than a symbol.
    setFont(new Font("WingDings", Font.BOLD, 16));
    I've looked at the Font properties file. Do I need to modify
    it in some way to get this to work?

    This thread was comfortably resting for the past few years. I don't think the original poster is going to answer you.
    I gave you an answer over [url http://forum.java.sun.com/thread.jsp?forum=31&thread=440873]on this other resurrected thread.
    It's OK to create a new thread.

  • Using device fonts for printing

    Hello,
    I was wondering how to use device fonts in Java. These are the fonts that are in the printer and not in the operating system.
    I'm writing some point of sale software that needs to use the Star TSP100 printer on Windows 7 64.
    I need to use the device font "control" in order to instruct the printer to open the cash drawer.
    I would also like to use the device font "3of9" for barcodes. I know there are alternatives to using this, but directly from the printer would be easier than trying to purchase and deploy a barcode font.
    I know that star micronics has a JPOS implementation, but not for windows 7 64. And the JPOS with the StarMicronics bin is cumbersome and unstable for the end user even in Windows XP 32 bit.
    If I specify the font "control" java replaces it with the default font. i.e. Font deviceFont = new Font ("control", Font.PLAIN, 8.5); is just the default font and not "control"

    I did find a solution to my problem, but I cannot use device fonts. You may also find this useful to address your issue. I opened the a print service and sent ASCII to it instead of creating and printing a graphic object. You'll need the [Command Emulator STAR Line Mode Command Specifications|http://www.star-micronics.co.jp/eng/service/usermanual/comemu_starline_pm.pdf] to know what the commands are for the TSP100 and TSP700. I've included a cheat sheet to find the HEX value of the ASCII command. Note that if you need to send several characters you'll need to use the space with it.
    e.g. The command to select font is ESC RS F you'll need to send: 1B201E2046
    My Chizzle:
    package recptpkg;
    import javax.print.PrintService;
    import java.awt.print.PrinterJob;
    import javax.print.DocPrintJob;
    import javax.print.Doc;
    import javax.print.DocFlavor;
    import javax.print.SimpleDoc;
    public class openCashDrawer {
        boolean showStatus;  // false if error
        public openCashDrawer() {
            showStatus = false;
            PrinterJob printerJob;
            PrintService psTSP100 = null;
            PrintService[] ps = PrinterJob.lookupPrintServices();
            for (int i = 0; i < ps.length; i++) {
                if (ps.getName().indexOf("Star TSP100 Cutter (TSP143)") >= 0) {
    psTSP100 = ps[i];
    if (psTSP100 == null) {
    System.out.println("Aw SNAP! I like, can't find a printer with "
    + "Star TSP100 Cutter (TSP143) in the name");
    showStatus = false;
    try {
    DocPrintJob job = psTSP100.createPrintJob();
    String openDrawer1Command = ((char) 0x07) + "";
    byte by[] = openDrawer1Command.getBytes();
    DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
    Doc doc = new SimpleDoc(by, flavor, null);
    job.print(doc, null);
    } catch (Exception e) {
    System.out.println("Whoa bro. The printer is balls. Check it:");
    e.printStackTrace();
    try {
    DocPrintJob job = psTSP100.createPrintJob();
    String openDrawer2Command = ((char) 0x1A) + "";
    byte by[] = openDrawer2Command.getBytes();
    DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
    Doc doc = new SimpleDoc(by, flavor, null);
    job.print(doc, null);
    showStatus = true;
    } catch (Exception e) {
    System.out.println("Whoa bro. The printer is balls. Check it:");
    e.printStackTrace();
    showStatus = false;
    public boolean getStatus() {
    return showStatus;
    //ASCII Cheat Sheet:
    /* 00 NUL | 01 SOH | 02 STX | 03 ETX | 04 EOT | 05 ENQ | 06 ACK | 07 BEL
    08 BS | 09 HT | 0A LF | 0B VT | 0C FF | 0D CR | 0E SO | 0F SI
    10 DLE | 11 DC1 | 12 DC2 | 13 DC3 | 14 DC4 | 15 NAK | 16 SYN | 17 ETB
    18 CAN | 19 EM | 1A SUB | 1B ESC | 1C FS | 1D GS | 1E RS | 1F US
    20 SP | 21 ! | 22 " | 23 # | 24 $ | 25 % | 26 & | 27 '
    28 ( | 29 ) | 2A * | 2B + | 2C , | 2D - | 2E . | 2F /
    30 0 | 31 1 | 32 2 | 33 3 | 34 4 | 35 5 | 36 6 | 37 7
    38 8 | 39 9 | 3A : | 3B ; | 3C < | 3D = | 3E > | 3F ?
    40 @ | 41 A | 42 B | 43 C | 44 D | 45 E | 46 F | 47 G
    48 H | 49 I | 4A J | 4B K | 4C L | 4D M | 4E N | 4F O
    50 P | 51 Q | 52 R | 53 S | 54 T | 55 U | 56 V | 57 W
    58 X | 59 Y | 5A Z | 5B [ | 5C   \ | 5D   ] | 5E ^ | 5F _
    60 ` | 61 a | 62 b | 63 c | 64 d | 65 e | 66 f | 67 g
    68 h | 69 i | 6A j | 6B k | 6C l | 6D m | 6E n | 6F o
    70 p | 71 q | 72 r | 73 s | 74 t | 75 u | 76 v | 77 w
    78 x | 79 y | 7A z | 7B { | 7C | | 7D } | 7E ~ | 7F DEL */
    {code}
    Edited by: StoneBrooks on Sep 10, 2010 11:24 AM

  • Showing bangla character in all types of java mobile using bitmap fonts

    i am a new user of j2me.but i cannot find any helps.
    i want to do english to bangla dictionary for all types of java mobile using bitmap
    fonts.
    initially how can i display bangla character using bitmap font in non unicode supported java mobile???
    but i cant do it.
    please send me source code or any helping resource.
    i am waiting for your reply.

    More info; installed mplayer2 which should work better with vdpau and this happened;
    VO: [vdpau] 800x468 => 800x468 Planar YV12
    [vdpau] Got display refresh rate 60.015 Hz.
    [vdpau] If that value looks wrong give the -vo vdpau:fps=X suboption manually.
    A: 6.3 V: 6.4 A-V: -0.000 ct: 0.000 0/ 0 1% 2% 0.2% 0 0
    [h264 @ 0xb6b41640]left block unavailable for requested intra mode at 0 23
    [h264 @ 0xb6b41640]error while decoding MB 0 23, bytestream (1111)
    [h264 @ 0xb6b41640]concealing 399 DC, 399 AC, 399 MV errors
    A: 6.5 V: 6.6 A-V: 0.000 ct: -0.000 0/ 0 1% 2% 0.2% 0 0
    Seek failed
    Seek failed
    Seek failed
    Seek failed
    Seek failed
    Seek failed
    Alot of those "Seek failed"!

  • How can i get & use java true type fonts in my applet

    Hi,
    I could get the System fonts in my Applet by making use of Toolkit.getFontList()
    I have used getGraphicsEnvironment to get fonts but my browser doesn't support it.I get ClassNotFoundException.
    How can I get & make use True Type Fonts in my Java Applet.
    Regards
    Siva

    To use getGraphicsEnvironment, you must convert your HTML with the HTMLConverter -- this will tell the browser not to use the native JVM to run your applet but to use a Java plugin to run the applet. If you cannot find HTMLConverter in your system, you may have to download it from Sun's web site.
    V.V.

  • How can get & use java true type fonts in my applets

    Hi
    I could get the System fonts in my Applet by making use of Toolkit.getFontList()
    I have used getGraphicsEnvironment to get fonts but my browser doesn't support it.I get ClassNotFoundException.
    How can I get & make use True Type Fonts in my Java Applet.
    any body knows reply immediate pls
    Siva

    similar problem:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=164516
    sorry, thats all i know.
    tobias

  • Displaying Windows True Type fonts using Java 1.1.x

    Can anyone shed some light on why I cant just use the name of the fon't I want to display? Here is the code I'm using:
    Font font1 = new Font(sFontName, iStyle, iSize);
    this.setFont(font1);
    sFontName is the name of the font, and it works with the font names that are garaunteed by Java (i.e. Dialog, DialogInput, Monospaced, Serif, SansSerif, or Symbol), but if I try to use a true type font name such as "Tahoma" it just loads the default font instead. Is there a different method required to load system dependant fonts?
    Any ideas would be greatly appreciated. Thanks.

    If your font is properly installed (i.e. in the fonts folder and you've performed a restart) then it should work. I have code in the splash screen for an open source project like this:
    subTitleLbl.setFont (new java.awt.Font ("Lucida Blackletter", 0, 18));Which works if the font is properly installed. Otherwise, it simply grabs the system font, as you indicated.
    I've done some searching, and haven't found a way to load a font into java. Java won't do it because it's not platform independent.
    Fortunately, this code works even if the font is not present--it just won't have the font you want.

  • Open type font "Myriad Pro" support in Java AWT

    Hi
    I have installed open type font "Myriad Pro" on my machine.
    When I use the following AWT APIs on jre 1.6, I dont get the open type font "Myriad Pro" in the font list.
    Code snippet
    java.awt.GraphicsEnvironment     ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (ge != null) {
         java.awt.Font[] fontList = ge.getAllFonts();
    The fontList variable doesnt have "Myriad Pro" font.
    My question is
    1) Is the open type font "Myriad Pro" supported by java AWT?
    2) Is there a workaround to get that particular font?
    Thanks
    Vikas

    When I print out the list of all the fonts java recognizes on my machine, all the otf fonts (about 70 of them) are missing including Myriad Pro. All the true type fonts show up. You might need to convert the Myriad Pro into a true type font to get it recognized in java.

  • How to use true type font in smartform with ECC6

    hi,expert:
    I want to use true type font "Comic Sans MS.ttf".
    I upload this font file by SE73 named ZTT2I.
    In SE73.. select the Radio button "Font Families" And click on the "True type Font Installation" button. click the font attribute ITALIC。
    Our print device is LP01 and driver is CNSAPWIN
    when I create a new style in smartform using the font ZTT, in preview window the font still like other font.
    Our system is ECC6, SAP_BASIS 700 level0017 packeg SAPKB70017
    how can I solve this problem?
    thaks a lot

    the ABAP forum administrator take this question to netweaver forum.
    Now when I create smartfrom in language EN,it can output correct style of that font.
    But if the smartform is base on language ZH, the output is not correct.
    why? How to solve it?
    thanks a lot

  • How can I use an Open Type Font in Dreamweaver?

    I bought some OTFs, Open Type Fonts.  I want to use them in Dreamweaver. I am on a Windows machine. When I look at the Edit Font List section in Dreamweaver, it has a tiny selection of fonts. I know I have more on my computer.
    How would I add these fonts for use in Dreamweaver ?   I have already installed them on my system.

    <I don't understand the whole world of font-licensing, so I thought I would be safe by using these fonts which I have purchased with a commercial license.>
    That doesn't mean the license extends to digital & web media though. 
    The fonts licensed by Kindle and included in the Fire are:
    Georgia
    Caecilia
    Trebuchet
    Verdana
    Arial
    Times New Roman
    Courier
    Lucida (of which there are several and the one in Kindle appears to be Sans Unicode)
    The new Kindle Paperwhite offers users the option to select:
    Caecilia
    Caecilia Condensed
    Baskerville
    Futura
    Helvetica
    Palantino
    Older Kindles and the Kindle DX uses Caecilia only. The Kindle computer and mobile apps display the same as the Fire.
    The prevailing opinion is that eBooks should not force fonts on people.  Let the user decide which body fonts are best for viewing on their particular device.
    Nancy O.

  • How to use MICR fonts in Adobe forms (webdynpro java

    Hi,
          We have a requirement where we need to print some MICR codes (for checks) through Adobe Forms.
    I have installed some true type MICR fonts in windows and Adobe Font Manager (in ADS) as well.
    It is visible in the Adobe Form design time (Font palette) and when I use the font for text, it is visible in preview too. But when I run the web dynpro application, in the online form it is converted into Standard font (Times new Roman).
    Is there anyway to handle this issue.
    Please let me know.
    I am using NWDS 7.0.1
    Adobe Live cycle designer 7.1
    SAP NW 2004s SP14
    Thank you,
    Vasu

    Check this forum post (though that is for 6i, it would be of helpful for you)
    How to use unicode fonts in Oracle forms 10g?
    -Arun

  • How to use OCR Font A type by the time of writing some text into Pdf fil

    Hi,
    I am generating one pdf file in java. How can I use OCR Font A for text of pdf file ..Please can any one help where can I get OCR Font A and how to use that one in java ... I want to write some text into pdf file and that text should use OCR Font A family ...
    Thanks.

    This document shows how to disable OCR during conversion; just do the opposite: https://forums.adobe.com/docs/DOC-3062

Maybe you are looking for

  • Maintaining date of death of a retired employee

    Hello, I wonder how to register the date of death of a retired employee. Leaving action has already been executed with a reason like "Retirement". We maintain some infotypes (0002 and 0006) in order to offer some services (e. g. sending the enterpris

  • Sales order with reference to sales order

    Hi,    I need to create a sales order with reference another sales order using bapi CreateFromDat2.  Please note, Sales Ord. Dist. channel, Div, sold-to to of the new order are different from original order.   I gave reference order in field order_he

  • Mimic "show data as percent of row parent" in non-pivot table

    Is it possible to implement or mimic the 'percentage of parent row' functionality, foreseen for pivot tables in obiee 11g, for a 'normal' table? We use a rather fixed table, in which no drilling is allowed - conditions are applied by means of prompts

  • What's the deal with the battery?

    I just bought a new video iPod a few days ago. I've loaded all of my songs onto it, and loaded a few videos on it also. I've FULLY charged it, and I watched about 15 minutes of video on it. After that video is done, it says the battery is at about 1/

  • Import Powepoint 2007 files

    Is there a way to import Powerpoint 2007 presentations in Keynote? This won't work, even if I save them als PP 2003/97 Thanks for the help! Wim