Questions tagged [fontmetrics]

115 questions
0
votes
2 answers

Using stringWidth with html String

This is probably a very easy question, but as I don't really know what I'm looking for, I couldn't succeed to find the solution... I'm using a JLabel inside which I put a html string. My string is obtained by Jsoup Then, I want to resize the JLabel…
Sharcoux
  • 5,546
  • 7
  • 45
  • 78
0
votes
2 answers

How can I get the width of a string of XYZ font in iOS Objective-C?

I have the following: -(float)getLength:(NSString *)text { UIFont *font = [UIFont fontWithName:@"Scurlock" size:20]; CGSize size = [text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName,…
Christos Hayward
  • 5,777
  • 17
  • 58
  • 113
0
votes
1 answer

Measuring string and font width

I want to measure a "smallest unit" of a string (which is displayed in JTextArea with some font). It's the width of a single character + the spacing after it (which depends on the next character). Eg. I want to measure the pixel distance from…
Karlovsky120
  • 6,212
  • 8
  • 41
  • 94
0
votes
1 answer

Android: Programmatically calculate Listview Font Metrics

I have a String and I need to truncate the string such that it fits on one line in a ListView. Can anyone point me in the right direction?
Matthew Hoggan
  • 7,402
  • 16
  • 75
  • 140
0
votes
2 answers

Calculating the CGSize of an unknown NSString

How can I find the CGSize of an unknown string that I just know its maximum number of characters but not the exact string? I know that you can calculate the size of an specific NSString with the "sizeWithFont" method on NSString like this : UIFont *…
0
votes
2 answers

Which text margin does SWT Table use when drawing text?

I got a relatively easy question - but I cannot find anything anywhere to answer it. I use a simple SWT table widget in my application that displays only text in the cells. I got an incremental search feature and want to highlight text snippets in…
Zordid
  • 10,451
  • 11
  • 42
  • 58
0
votes
2 answers

Font metric in OpenGL

is there any font metric like in Java (FontMetrics) ? Ex: FontMetrics fm = g2.getFontMetrics(); Rectangle2D rect = fm.getStringBounds(node.getText(), g2);
elect
  • 6,765
  • 10
  • 53
  • 119
0
votes
1 answer

How to use FontMetrics?

Can someone explain to me how to use FontMetrics in a JPanel? I need to figure out the width and height in pixels of a String when using drawString() to paint it on a JPanel Thanks!
Cin316
  • 651
  • 1
  • 9
  • 19
0
votes
1 answer

Is there a way to resize an MdiTab to fit your newly-updated text? (Infragistics)

I am resetting the text for an MdiTab in an UltraWinTabbedMdi. I reset it to be bold and longer, but the tab does not resize so the text is truncated. Right now, I'm just resetting the size of the tab to some magic number that I've found looks…
BCarpe
  • 860
  • 10
  • 27
-1
votes
1 answer

What causes FontMetrics stringWidth to return different values on different machines?

The following code prints different values when ran on different machines: import java.awt.*; import java.awt.image.BufferedImage; public class Main { public static void main(String []args){ Graphics g = new BufferedImage(100, 100,…
Alexandru Severin
  • 6,021
  • 11
  • 48
  • 71
1 2 3 4 5 6 7
8