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

Similar Messages

  • 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"!

  • 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)

  • How to use solaris font in the java

    Hi all!
    I need to use the installed solaris fonts in a swing application. Do you know how to make the installed solaris fonts available in the java runtime environment?
    I have Solaris 8.
    Thanks
    eha

    Hi,
           import java.awt.EventQueue;
    import java.awt.Font;
    import java.awt.GraphicsEnvironment;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class Tamil {
         static void showGui(){
              JFrame frame = new JFrame();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JPanel panel = (JPanel) frame.getContentPane();
              JLabel label = new JLabel();
              Font f = new Font("Latha",Font.BOLD,12);
              label.setFont(f);
              label.setText("\u0B85\u0B95\u0BB0\u0BAE\u0BCD");
              panel.add(label);
              frame.setSize(300,300);          
              frame.setVisible(true);
          * @param args
         public static void main(String[] args) {          
              EventQueue.invokeLater(new Runnable()
                   @Override
                   public void run() {
                        showGui();
    }This is just a simple example . Please understand what other people said.
    Please read a tutorial about [i18n|http://java.sun.com/docs/books/tutorial/i18n/index.html]
    Thanks

  • 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

  • Configure java environment to automatically use a font set

    I am having trouble setting up my environment to use a font - like cyberbit. Specifically, I would like to be able to display Chinese/Japanese unicode data on my appliation - all I can view are boxes. I have installed the cyberbit font under ../jre/lib/fonts and have modified the file fontconfig.properties.src (dialog.x=Bitstream Cyberbit,DEFAULT_CHARSET and filename.Bitstream_Cyberbit=Cyberbit.ttf) and saved it as fontconfig.properties.

    iWeb doesn't remember your default choice like that
    unfortunately. Are you finding that you use the same
    template pages though? If so, you can just
    preconfigure one with your choice of fonts and text
    sizes. Then just keep it blank and use it as your
    "template" by 1) removing it from being displayed in
    the navigation menu and 2) by duplicating the page
    (select it in the organizer and right-click or
    control-click to select "duplicate").
    It's probably easier to just make the changes when
    you want.
    James, thanks, and hi. I will end up using the Photo Album and the Welcome templates the most. The Welcome templates I will use as top level theme hyperlinks to all of the examples of said theme.
    iWeb is a lot of fun.
    — Lorna in Southern California

  • Deprecation warning for getFontMetrics(java.awt.Font) in java.awt.Toolkit

    Hi all,
    When I use the following code
    JComponent c;
    FontMetrics metrics = getToolkit().getFontMetrics(c.getFont());
    I get this following warning during compilation:-
    warning: getFontMetrics(java.awt.Font) in java.awt.Toolkit has been deprecated
    JDK suggests to use getLineMetrics() of the Font class.
    But there's an issue with that: if I use getLineMetrics(), there is no API method that I can use to get the width of a string as opposed to FontMetrics which provides stringWidth(String str) method for that purpose. In fact all the methods in FontMetrics are not mapped into LineMetrics.
    Could anyone please help or provide me at least some pointers on how to tackle this issue so that I can get rid of the deprecated method along with the existing methods mapped to equivalent APIs? The bottomline is that I should be able to maintain the existing functinality of my application for those part of code that uses getToolkit().getFontMetrics().
    Thank you for your help in advance.
    -Sanjoy Das

    Use Graphics.getFontMetrics(font) instead.
    After creation your frame and calling frame.show();
    You can access it like that
    frame.show();
    frame.getGraphics().getFontMetrics(new Font("Arial",0,10));
    before showing graphics is null.
    Or just create a BufferedImage and ask it for graphics.
    BufferedImage img=new BufferedImage(...);
    img.getGraphics().getFontMetrics(font);
    regards
    Stas

  • Is there a way to define 2 different areas using boundaries in a Java app?

    Hi,
    Im tryig to create a game for kids were they can learn how to write! In one of the games there will be a template of a letter, for example A, the A wii be hollow inside so that the kids can folow the outline! But if they go over a line i want the program to display a message telling them this and having to restart drawing from the mouse!
    I know how to draw the lines fron the mouse i just dont kno if it is possible to define different areas according to the shape of a letter??
    Hope you can help
    RSH

    This code will get you a java.awt.Shape representing the outline of any String.
    import java.awt.Shape;
    import java.awt.Graphics2D;
    import java.awt.Font;
    import java.awt.font.FontRenderContext;
    //Whatever other code you need
    //Getting shape of text, put somewhere you can get a Graphics from
    FontRenderContext context = g2d.getFontRenderContext();        //where g2d is a Graphics2D
    Font anyFont = new Font("Arial", Font.BOLD, 20);
    String myText  = "ABCDEFG";
    TextLayout textShaper = new TextLayout(myText, anyFont, context);
    Shape outline = textShaper.getOutline(null);           
    //you can pass a AffineTransform to getOutline( ) if you want some kind of transformation, probably be best
    //if you used it to move (translate) the text outline so you can check to see if it contains the mouse pointer.With the Shape representing the outline of the text, you can call contains( ) on it, passing it a Point2D or the x and y locations of the mouse in double precision which returns true if the Shape contains the mouse.
    I'm pretty sure that it should work.

  • 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 ?

  • Fonts in java apps for win and linux

    Hi everyone.
    i need to build an application mult-plataform, to run in windows and linux...
    but i don�t know waht font i must use...the default font that java takes doesn�t exist in linux (dialog)...
    waht font should i use in my app??
    thanx

    For going multi-platform it is easiest to stick to the logical fonts: Fonts named "Serif", "SansSerif", "Monospaced", "Dialog", and "DialogInput".
    These fonts are guaranteed to exist on any platform, although their implementations may be different. If you use others then you'll have to figure out how to deal with cross platform issues.
    Jeff

  • Please,help with fonts in Java

    I have one problem, I would like, that I could see and Faroese islands fonts and cirilica (Russian fonts) at the same time in TextBox, List and TextArea (awt). How it is possible to do?
    Please write me to email: [email protected] or here in forum.

    Each of those objects can only use one font at a time. If you want an object that can use many fonts, then JTextPane is such an object. However it is a Swing object, so it requires Java 2, and it is quite complicated to use. If you are limited to AWT, your other possibility is to draw the text on a Canvas using the various fonts.

  • 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

  • Urgent :RKF restricted on a KF

    Hi, CAn somebody please tell me how can i get the following format in my report. __________________SALES >100+________SALES<100&>50__________SALES<50 ___________________no of docs  _________    no of docs_______________no of docs sales rep Here SALES

  • Issue viewing earlier messages on iPhone 4S?

    have had my 4S approx 1 month and am having a problem loading earlier messages on some msg threads. Sometimes I have a 'Load earlier messages' button at the top and other times I don't (but I know there are earlier msgs) - does anyone know why this i

  • Question sur Camera Raw

    Je n'arrive plus à ouvrir les fichiers ARW dans PE  "impossible d'ouvrir....car ce type de fichier est incorrect". J'ai téléchargé la version 6.5 de Camera Raw sur le site d'Adobe mais il semble que pour mon Sony Alpha 57 c'est la version 6.7 qu'il f

  • Bridge problem in CS6

    Bridge in CS6 is not recongizing my images from my new Canon Rebel T5i. I do not know what to do to remedy this. Bridge in CC does, but I want both working

  • Error while using Webservice.

    Hi All, we have one scenario SOAP to RFC ,where 3rd party using WEbservice to send the data using SOAP adapter to PI . But now when 3rd party trying to send the data through websevice they are getting error message ' javax.xml.ws.soap.SOAPFaultExcept