Fonts in Java and Windows, TextOut vs drawString

Hi everyone,
I need to render documents (standard format, that uses LOGFONT Windows struct.) in my Java App exactly like my Windows App. shows.
There are several issues:
1. Font sizes. (I almost resolved the problem)
2. Font styles. I noted that Java does not work properly with native fonts. Sometimes, it ignores font styles. I did apply workarounds recommended in the bug tracking db. It helps only for some fonts, not for all.
3. Mapping character sets.
4. Positioning. TextOut uses left topmost corner. drawString uses the baseline. Also, Windows displays some extra space at the top. I could not calculate its size from FontMetrics. Also, there are issues horizontal positioning when I use Italic.
5. StrikeOut and Underline - also different look.
6. Also, I noted when I use some rare font Java draws some garbage along with text.
If anywone was working on that, your help would be really appreciated.
Thanks in advance,
Alex

Thank you. I did read that. I was not talking about drawing text in 'Hello World' alike applets/programs.
I should give an example:
I would like to print 'H' in Tahoma, 72, Bold (Windows format) at (100, 200).
Font sizes:
In Windows font size is 72 pixels.
In Java this is equal to 96 points (72 px * 96 (scr resolution for Toolkit) / 72 (pixels per point).
Real height in Windows and Java will be 64 px.
That's fine. For some fonts this does not work.
Positioning. See example above.
According to the article you refer to in java we should use y-coordinate 200 + 72 (font size) = 272.
In fact we have :
Java text 14 pixels below than expected.
Similar things happen to other parameters Weight, Styles, etc.
I do use AttributedString and TextAttribute classes to render text
Thanks in advance.
Alex

Similar Messages

  • Persian font in MAC and WINDOWS.

    Hi
    I am using persian font (X-series) on my mac and I haven't any problem with these fonts.
    *:X series font are for pupular persian font like the B series.
    When i want to save my power point with a type that windows can read/write it the X-series persian font are missing and all of my ducument has a bad clutter!!
    I know that i can save my document as .PDF files but when I should do some changes on wndows office I need have good and famous persian fonts that are common between win and mac.
    thanks for your helps..........

    If you want to open the Powerpoint file in Windows, you should also install those fonts at Windows machine too.
    They won't show as nice as the Mac due to lack of text anti-aliasing on Windows, but they will work on Windows too.

  • PC Font Management, CS4 and Windows 7

    I have a new PC.
    Starting from scratch I had Windows Vista 64 installed as this was just before the Microsnot launch of Windows 7. I bought CS4 Design Premium and had this pre-loaded. I downloaded Extensis Font Fusion 2 and loaded that. After loading this I had issues with Illustrator crashing and also Indesign and Flash. Also Photoshop 64 pretty much wouldn't work at all. I removed Font Fusion2 and found the Adobe products were less flakey but still not solid. I then upgraded Windows to V7 64bit. This also improved matters though PS64 still wasn't 100% stable.I called extensis and they said that they had released a version that answered this issue, but since loading the latest version of Suitcase Fusion 2 Illustrator has become very much less stable and also PS64 is now unusable, which is a bit of a shag as I have paid to have 12 gB of ram in this machine which is only used by the 64bit apps.
    I have called Adobe technical who were pretty unhelpful.
    Has anyone found a good type manager for under £100 that actually works with Adobe CS4?

    If you're working on a stand-alone machine, why not trying to work without font management?
    I worked with suitcase 11,  and all went fine. (running on xp64).
    Since we're in a network, we opted for universal type server and client, both working well. I'm sure that on the web the're several free managers can be found

  • Problem with Java and Windows (Mainly Vista and UAC)

    Hi all,
    I am having a problem with a program that I've devoloped. The program itself is packaged as a jar and I plan to deploy it across multiple platforms eventually however right now i am only concerned about windows based systems. I have made an installer for a windows baised systems using NSIS to install the software files. I made the installer as I need several java packages to be installed so the program would work (JAI, J3D, JAI ImageIO) and I also require the program to have fileassociations on windows.
    I know that this is not what java is about, however the majority of the users will be on windows baised systems so I've decided that OS specific installers is the best option.
    During the process I have noticed that there are several key problem with java for this type of application!
    The first issue that I have come across is getting file associations to work on java. As a .jar is not an excutable it is not possible to directly associate a filetype with it in java so to overcome this I currently run the program from a .bat files and also the program requires large memory so this also allows me to run the program with -xmx. The batch file that I use is :
    <code>
    cd PATH TO PROGRAM
    start javaw -Dsun.java2d.noddraw=true -Xmn100M -Xms500M -Xmx1000M -jar "PATH TO PROGRAM\program.jar" %1 -vram 134217728
    pause;
    </code>
    Ok so all this appears to work fine and allows windows to have file associations and start the program and thats all works perfectly but this is a non-ideal solution. Has anyone got any advice on improving this?
    The next problem that I have appears to be a problem with Vista and UAC (user access control). When a user installs the program and installs the program into the program files directory I found that the program did not work and kept saying that I did not have access to the files in the current directory. This is a problem as I read and write settings files during program execution.
    On a Vista system UAC prevents file write operations into the Program Files directory unless the program has requested elevated status even if the user is a full administrator. The probem is that there appears to be no real way to achieve this under java that I'm aware of...
    Has anyone else had this probem and has a suitable solution?
    Any advice on these issues would realy be appricated.
    Regards
    Joey

    Ok so i've kinda found a solution, its not ideal but its very good. I found this program called Elevate
    A link to the site I got it was
    http://www.wintellect.com/cs/blogs/jrobbins/archive/2007/03/27/elevate-a-process-at-the-command-line-in-vista.aspx
    This program allows you start java with a UAC dialog for high access using
    Elevate java -jar myjar.jar
    This then allows you to have full access using java... I guess it could be dangerous but it does the job.

  • Sound problem with java and windows (volume)

    Hello,
    Just wondering if there is any way that java can manipulate the sound volume
    in windows...I've searched through the forums here and ive noticed that this question has come up a number of times, but nothing definitive has really been posted.
    My program is a 'server' side portion of a mobile phone app ive written, that im trying to use as a remote to turn up the volume, skip tracks, etc. on my pc via bluetooth. Basically what im doing is sending a string from the mobile phone app to the pc telling it to increment the volume/decrement the volume by a certain amount. Can java do this natively or am i going to need to use a C++ library through JNI (which i have never done before)
    Any help appreciated!
    Thanks,
    Craig

    Victor,
    I've tried your suggestions and found that the first one only alters the volume of the midi file that is being played through java. I want to be able to alter the volume of the sound that I already have coming out of my speakers, through windows master volume control.
    Your second suggestion I also tried but to no luck...i always get the following exception message:
    "Failed trying to find LINE_IN VOLUME control: exception = java.lang.IllegalArgumentException: Line unsupported: LINE_IN source port"This exception occurs no matter what I change LINE_IN to in this segment of code (I want to control sound output so i assume it should be either SPEAKER or LINE_OUT):
    lineOut = (Port)mixer.getLine(Port.Info.LINE_IN);Any other suggestions?
    I noticed on the j2se sound guide site, they mention a way to get a list of supported mixers and/or lines, but im not exactly sure how to go about doing that (maybe it will be helpful?)
    Thanks for your time,
    Craig

  • Java and windows NT permission

    hi,
    i work in the IT department of medium business and we have recently created a database of assets in teh company.
    i plan to develope a small application that can be used to track the movements of assets through the company.
    i would like to have the user login, however i would like that they use their windows domain username and passwords that they use to login.
    i am curious about whether java supports a class that allow for such functionality.
    my company is using windows 2000 advanced servers with active directory.
    please get back to me soon.

    The class is java.lang.System. Have a close look at getProperties().

  • Java and windows authentication

    I've written a little sql server client in java. The thing that
    i really dont like about it is that i have to use sql username
    and password to get into a database and, of course i have to make sure that my username has the proper rights. I really would like to
    rework it to login through the windows login and not have to deal with it. Is that possible?
    If so how do i go about it?
    Thanks for any hints/advice.

    Search the forum, I have seen this before.

  • Linux java and windows oracle

    Hi
    I have a linux server with apache tomcat installed. I want to connect to oracle which is installed in windows 2000 server. Can any one help me how to coonect to the oracle server from the java applicaton or plese tell me what other third party is needed.
    .

    Hi
    Just substitute the hostname (and port if necessary) that you would put in your connection URL for the host/port of the Windows 2000 server.
    I haven't used Oracle for ages now, but I think when you download the driver, it comes with a couple of examples of what the connection URL should look like (and indeed examples of making the connection itself). Make sure the relevant firewall ports are open though or you'll never get them talking ;-)
    Rgds

  • Java and Window Media Player

    How can I put the Window Media Player or other media player (apart from JMF player) which can play the video into JFrame or applet using Java Program.Do anyone know any link for teaching such kind of knowledge or post some knowledge so that I can follow it.Thank you all of you!!!

    How can I put the Window Media Player or other media player (apart from JMF player) which can play the video into JFrame or applet using Java Program.Do anyone know any link for teaching such kind of knowledge or post some knowledge so that I can follow it.Thank you all of you!!!This not easy, integrating native players in swing i.e. JFrame. But yes I know of an open source project DJ Native Swing, try its demo, and then use the api.
    [http://djproject.sourceforge.net/ns/]
    Thanks!

  • Java and Windows XP

    Can someone please tell me why my Java applications written with JDK1.2.1 on my previous Win98 machine don't work on my WinXP machine, using the same JDK1.2.1 ? ( Something about NoClassDefFoundError )

    ( Something about NoClassDefFoundError )
    This error is usually becos of CLASSPATH errors.
    Make sure that your class path is set properly and that your current directory is included( . for current directory).
    cheers

  • Java and Window Task Manager

    Hello,
    Please how can one run java application but will be invisible in the Windows task manager.
    Which method can I use to make this possible.
    Thanks

    bezgodo wrote:
    Hello,
    Please how can one run java application but will be invisible in the Windows task manager.
    Which method can I use to make this possible.
    ThanksYou can't do that in Java. But, there are some tools that wraps your java programs in a executable
    format, some of them even includes the entire/partial JRE so you can run your Java program on any
    Windows machine.
    After you do the wrapping you can use other tools meant for Microsoft PE/NE executable (.exe, .com, etc files)
    in order to make then undetectable in the process list.
    But you loose portability.

  • Java and window-exe

    is it possible to compile java to a MS-windows exe?
    i would like to do this for two reasons:
    1) i hope for a better performance of my desktop-API
    2) i can't be sure that all of my users have JVM installed.
    do i need special programms for that?
    thanks
    gammloop

    1) There are thingys to do that...
    There's one on source forge. Can't remember what it's called.
    The JIT does that any though, so desktop performance isn't an issue.
    2) Oh, they will, they will. Now that evil is spreading across the land like a dark shadow.
    Why don't you ship the JRE with your application. Not the sdk (you're not allowed to do that). [I think you can distribute the JRE - I hope you can, otherwise I'm phoning my solicitor.]

  • Java and Window Vista

    Hello everyone,
    I am developing applications with Java beans2, JEE5 and netbeans 6, using XP. Now
    I would like to purchase a new laptop which has Vista installed. As you already know, PCs are
    not downgradeable to XPs. Is anyone still having problems with developing applications in java using Vista. The main reason I am buying this is to continue my development. And of cause, faster
    laptop. I would appreciate any suggestions.
    Thanking you.
    eve.

    hi,
    Discuss from another forums,
    answer
    From Baker
    i copied the file nsExtensionManager.js from the components folder of the downloaded firefox to the shown path to the file in the current installation. it works now. =)
    From dan
    Sorry about this error, which happens occasionally with the beta of Firefox 2.0 and which we hope will be rectified in the final release of the browser. Which OS are you using?
    A simple workaround for this problem is to save the Zotero file to your hard drive (it's a file that ends in .XPI; right-click to save it rather than a regular click, which would go straight to the file in the browser), and then open the file manually from within Firefox 2.0 (using file->open file...).

  • Fonts in Windows and Fonts in Java

    Hello,
    Say I have in my app:
    String string = "\\u09A1";
    I want to display this in my app. I can call:
    GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
    I can then iterate through these and find out which ones can display this unicode character using,
    font.canDisplayUpTo(string);
    My question is, are these the fonts that Java can display (from charsets.jar) or the ones installed in Windows?
    I would like to be able to get lists for both of these.
    Any ideas?
    Cheers,
    Jim

    Thank you. I did read that. I was not talking about drawing text in 'Hello World' alike applets/programs.
    I should give an example:
    I would like to print 'H' in Tahoma, 72, Bold (Windows format) at (100, 200).
    Font sizes:
    In Windows font size is 72 pixels.
    In Java this is equal to 96 points (72 px * 96 (scr resolution for Toolkit) / 72 (pixels per point).
    Real height in Windows and Java will be 64 px.
    That's fine. For some fonts this does not work.
    Positioning. See example above.
    According to the article you refer to in java we should use y-coordinate 200 + 72 (font size) = 272.
    In fact we have :
    Java text 14 pixels below than expected.
    Similar things happen to other parameters Weight, Styles, etc.
    I do use AttributedString and TextAttribute classes to render text
    Thanks in advance.
    Alex

  • 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

Maybe you are looking for

  • Unable to close web page using Safari 7.3.1

    Doing research and opened a page that required my name and password.  No idea what's going on and unable to close page even after force quitting Safari and restarting computer.

  • Nokia N8-00 upgrade to Nokia Belle gives confusing...

    During the upgrade process I receive a warning message telling me: "Don't use the mobile N8-00, shut ift off, or remove the cable or the unit will stop working". So, therefore I tried to shut it off. Immidiately I receive an errormessage telling me t

  • Where can I find a proxy server for firefox?

    I would like to try using a proxy. I've looked into it a bit before, but the sites where I found proxy addresses appeared pretty sketch. At one time I found a page on the firefox support site that named some suggested proxy websites, so I assume they

  • Working on epic slideshow....really could use some help please

    I have combed the manuals, discussion logs etc. but am yet to find a simple answer to my questions. Maybe there are none. My grandparents both passed away in the last month. I am not only archiving my pictures but creating a slideshow using final cut

  • AE CS6 on Windows8: H.264 Coded generated very strange frame rates when rendering

    funny things are happening: I import 300 jpegs (canon 6D raw exported from LR as jpeg at max quality) create a new composition (with 25fps) render video in h.264 @25 fps videos rendering works fine, plays well at external player. drag and drop video