font « string « Java Data Type Q&A

1. How to get real string height in java?

I'm using the FontMetrics.getHeight() to get the height of the string, but it gives me a wrong value, cutting off the descenders of string characters. Is there a better function I ...

2. How to calculate the font's width?

I am using java to draw some text, but it is hard for me to calculate the string's width. for example: zheng??... How long will this string occupy?

3. Font settings for strings in java

Can I set font properties for a string in java.

4. Get the total width of a string rendered with an arbitrary .ttf font in Java Graphics 2

Currently we attempt to get the width of a string rendered with an arbitrary font.

BufferedImage img = new BufferedImage(10, 10, BufferedImage.TRANSLUCENT);
    Graphics2D g = ...

5. how to set the font type for a "string"

System.out.println prints to a DOS window that is always 2 colors (background and text) and a standard font. ---- If you were to print using a graphics object on something that could produce Fonts and colors you would do this: Create a new Font Object with the desired characteristics (see Java API for Font constructors). Set the font of your graphics ...

6. How to change font of String?

A text file has no format -- it's just text. To write formatted text to a file, you need to write a file format that supports... formatting. Options include HTML (lots of HTML libaries out there), PDF (the iText library) or RTF (iText again,) or PostScript (not sure what the best way to do this from Java is). But you can't ...

7. Font linking for a unicode string

Hi All I am using a pdf generating library. It requires me to provide a font whenever I am printing a string in the pdf document. The problem is that the string that will be printed is the user input from a textbox and I may have to select different font for different language input. I have found some information about ...

8. Strings and fonts

Hello, guys, i'm new to this forum (: Basically my situation is the following: i wanna present a certain text on the screen, and every time i see a certain word (let's say 'cat', for this matter) i want it to be in bold. or underlined. or highlighted. As far as i know i can't do it with a simple String ...

9. can i change font of a string...???

10. Font in String ???

11. Setting the Font on a String