Results 1 to 4 of 4
  1. #1
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Font display of applets that are viewed on different platforms

    I created four font types to display some info text over an image slide show applet:
    smallFont = new Font("Serif", Font.PLAIN, 12);
    normalFont = new Font("Serif", Font.PLAIN, 16);
    largeFont = new Font("Serif", Font.PLAIN, 18);
    verylargeFont = new Font("Serif", Font.PLAIN, 24);
    Things look all right when I view my applet on my Mac computer (because I did the programming using a Mac). But when viewing the applet on a PC things change dramatically (e.g. accent signs etc. change totally).
    What to do to make fonts look the same on different platforms?

    willem

  2. #2
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default

    would this code do it (have no pc, so can´t see)

    smallFont = new Font("Times Unicode", Font.PLAIN, 12);
    normalFont = new Font("Times Unicode", Font.PLAIN, 16);
    largeFont = new Font("Times Unicode", Font.PLAIN, 18);
    verylargeFont = new Font("Times Unicode", Font.PLAIN, 24);

    willemjav

  3. #3
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    In the Font api comments section see the 5 paragraphs under the header Physical and Logical Fonts. Paragraph 3 mentions why this happens and the faq link in the last paragraph gives alternate solutions.

  4. #4
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default

    Hardwired I did visit the font-api (I always visit the api when using a new/ unknown class) and taught “jesus, do I need to read all this just to get some accents right?”.
    UTF-8 or UTF-16 is the magic key. I probably have to do sometime like: let the text of the JTextArea be in one of these two formats (because the text displaying of the applet happens in that component only).
    I am having a hard time to find out where to start, this is (again) an overwhelming issue. Is there something “simple” to say to JTextArea please use UTF-8 or UTF-16?

    Before I continue programming the photo-prepare-application I have to pay some attention to my website and its applet concerning the font display. I do have the positioning of the multi-textline working (still dragging outside the JTextArea because I have to start learning the glass pane fully),
    The web-page looks fine on my mac-book but on a pc it is a real mess. So I will start with the text of the JTextArea but I should look also into the HTML font and looks (the accents etc. do appear but font and size is different in each browser….. disasters see WILLEM DRAGSTRA WEB SITE from a pc).

    willemjav

Similar Threads

  1. Replies: 5
    Last Post: 04-25-2009, 09:00 PM
  2. how to set font size for a xml value
    By bala_kj in forum Advanced Java
    Replies: 3
    Last Post: 04-01-2008, 12:00 PM
  3. Login user name - for all platforms.
    By Eranga in forum Advanced Java
    Replies: 0
    Last Post: 03-17-2008, 06:45 AM
  4. JTable with Font
    By Rama Koti Reddy in forum AWT / Swing
    Replies: 1
    Last Post: 12-12-2007, 06:22 PM
  5. Font question
    By orchid in forum Java 2D
    Replies: 1
    Last Post: 08-01-2007, 03:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •