Lines Matching refs:font
26 package sun.font;
36 import java.awt.font.FontRenderContext;
37 import java.awt.font.TextLayout;
58 * specify the size of glyphs in a font. This point size defines a
70 * The FontDesignMetrics class expresses font metrics in terms of arbitrary
71 * <i>typographic units</i> (not points) chosen by the font supplier
72 * and used in the underlying platform font representations. These units are
75 * font. A typographic unit is the smallest measurable unit in the
76 * em-square. The number of units-per-em is determined by the font
85 * in a 9-point font. Because typographic units are relative to the
95 * size of a font is effectively points/em. Using a normalized transform
98 * that an N point font displays N pixels high. In general,
121 private Font font;
168 * and FRC. A lot of callers use only the font so although there's code
169 * duplication, we allow just a font to be a key implying a default FRC.
203 Font font;
210 MetricsKey(Font font, FontRenderContext frc) {
211 init(font, frc);
214 void init(Font font, FontRenderContext frc) {
215 this.font = font;
217 this.hash = font.hashCode() + frc.hashCode();
225 font.equals(((MetricsKey)key).font) &&
249 public static FontDesignMetrics getMetrics(Font font) {
250 return getMetrics(font, getDefaultFrc());
253 public static FontDesignMetrics getMetrics(Font font,
266 FontUtilities.getFont2D(font) instanceof CompositeFont) {
267 return new FontDesignMetrics(font, frc);
274 * If the FRC is set to all defaults, we just use the font as the key.
276 * that combines the font and FRC.
281 r = metricsCache.get(font);
286 MetricsKey.key.init(font, frc);
302 m = new FontDesignMetrics(font, frc);
304 metricsCache.put(font, new KeyReference(font, m));
306 MetricsKey newKey = new MetricsKey(font, frc);
330 * @param font a Font object.
333 private FontDesignMetrics(Font font) {
335 this(font, getDefaultFrc());
339 private FontDesignMetrics(Font font, FontRenderContext frc) {
340 super(font);
341 this.font = font;
357 Font2D font2D = FontUtilities.getFont2D(font);
358 fontStrike = font2D.getStrike(font, frc);
462 if (font.hasLayoutAttributes()) {
470 width = new TextLayout(str, font, frc).getAdvance();
478 width = new TextLayout(str, font, frc).getAdvance();
492 if (font.hasLayoutAttributes()) {
497 width = new TextLayout(str, font, frc).getAdvance();
510 width = new TextLayout(str, font, frc).getAdvance();
550 * Returns the typographic ascent of the font. This is the maximum distance
551 * glyphs in this font extend above the base line (measured in typographic
559 * Returns the typographic descent of the font. This is the maximum distance
560 * glyphs in this font extend below the base line.