equal
deleted
inserted
replaced
259 * cache the physical fonts, its not a problem to just return a |
259 * cache the physical fonts, its not a problem to just return a |
260 * new instance in this case. |
260 * new instance in this case. |
261 * Note that currently Swing native L&F composites are not handled |
261 * Note that currently Swing native L&F composites are not handled |
262 * by this code as they use the metrics of the physical anyway. |
262 * by this code as they use the metrics of the physical anyway. |
263 */ |
263 */ |
264 if (FontManager.maybeUsingAlternateCompositeFonts() && |
264 SunFontManager fm = SunFontManager.getInstance(); |
265 FontManager.getFont2D(font) instanceof CompositeFont) { |
265 if (fm.maybeUsingAlternateCompositeFonts() && |
|
266 FontUtilities.getFont2D(font) instanceof CompositeFont) { |
266 return new FontDesignMetrics(font, frc); |
267 return new FontDesignMetrics(font, frc); |
267 } |
268 } |
268 |
269 |
269 FontDesignMetrics m = null; |
270 FontDesignMetrics m = null; |
270 KeyReference r; |
271 KeyReference r; |
351 initAdvCache(); |
352 initAdvCache(); |
352 } |
353 } |
353 |
354 |
354 private void initMatrixAndMetrics() { |
355 private void initMatrixAndMetrics() { |
355 |
356 |
356 Font2D font2D = FontManager.getFont2D(font); |
357 Font2D font2D = FontUtilities.getFont2D(font); |
357 fontStrike = font2D.getStrike(font, frc); |
358 fontStrike = font2D.getStrike(font, frc); |
358 StrikeMetrics metrics = fontStrike.getFontMetrics(); |
359 StrikeMetrics metrics = fontStrike.getFontMetrics(); |
359 this.ascent = metrics.getAscent(); |
360 this.ascent = metrics.getAscent(); |
360 this.descent = metrics.getDescent(); |
361 this.descent = metrics.getDescent(); |
361 this.leading = metrics.getLeading(); |
362 this.leading = metrics.getLeading(); |
471 int length = str.length(); |
472 int length = str.length(); |
472 for (int i=0; i < length; i++) { |
473 for (int i=0; i < length; i++) { |
473 char ch = str.charAt(i); |
474 char ch = str.charAt(i); |
474 if (ch < 0x100) { |
475 if (ch < 0x100) { |
475 width += getLatinCharWidth(ch); |
476 width += getLatinCharWidth(ch); |
476 } else if (FontManager.isNonSimpleChar(ch)) { |
477 } else if (FontUtilities.isNonSimpleChar(ch)) { |
477 width = new TextLayout(str, font, frc).getAdvance(); |
478 width = new TextLayout(str, font, frc).getAdvance(); |
478 break; |
479 break; |
479 } else { |
480 } else { |
480 width += handleCharWidth(ch); |
481 width += handleCharWidth(ch); |
481 } |
482 } |
502 int limit = off + len; |
503 int limit = off + len; |
503 for (int i=off; i < limit; i++) { |
504 for (int i=off; i < limit; i++) { |
504 char ch = data[i]; |
505 char ch = data[i]; |
505 if (ch < 0x100) { |
506 if (ch < 0x100) { |
506 width += getLatinCharWidth(ch); |
507 width += getLatinCharWidth(ch); |
507 } else if (FontManager.isNonSimpleChar(ch)) { |
508 } else if (FontUtilities.isNonSimpleChar(ch)) { |
508 String str = new String(data, off, len); |
509 String str = new String(data, off, len); |
509 width = new TextLayout(str, font, frc).getAdvance(); |
510 width = new TextLayout(str, font, frc).getAdvance(); |
510 break; |
511 break; |
511 } else { |
512 } else { |
512 width += handleCharWidth(ch); |
513 width += handleCharWidth(ch); |