Lines Matching refs:Font
29 import java.awt.Font;
32 import java.awt.font.FontRenderContext;
33 import java.awt.font.GlyphVector;
41 * Render the text by breaking it into various scripts and using the right font for each script.
54 private final Font font;
56 private ScriptRun(int start, int limit, @NonNull Font font) {
59 this.font = font;
134 // We break the text into scripts and then select font based on it and then render each of
137 int flag = Font.LAYOUT_NO_LIMIT_CONTEXT | Font.LAYOUT_NO_START_CONTEXT;
138 flag |= isRtl ? Font.LAYOUT_RIGHT_TO_LEFT : Font.LAYOUT_LEFT_TO_RIGHT;
139 renderScript(run.start, run.limit, run.font, flag, advances, advancesIndex, draw);
146 * Render a script run to the right of the bounds passed. Use the preferred font to render as
148 * be drawn using the preferred font.
150 private void renderScript(int start, int limit, Font preferredFont, int flag,
171 // The current character cannot be drawn with the preferred font. Cycle through all the
177 Font font = fontInfos.get(i).mFont;
178 if (font == null) {
182 canDisplayUpTo = font.canDisplayUpTo(mText, start, start + charCount);
184 render(start, start+charCount, font, flag, advances, advancesIndex, draw);
192 // No font can display this char. Use the preferred font. The char will most
210 * Renders the text to the right of the bounds with the given font.
211 * @param font The font to render the text with.
213 private void render(int start, int limit, Font font, int flag, float[] advances,
216 Toolkit.getDefaultToolkit().getFontMetrics(font).getFontRenderContext();
225 frc = new FontRenderContext(font.getTransform(), false,
231 if (font.isTransformed()) {
232 AffineTransform transform = font.getTransform();
243 AffineTransform transform = font.getTransform();
247 frc = new FontRenderContext(font.getTransform(), true, frc.usesFractionalMetrics());
251 GlyphVector gv = font.layoutGlyphVector(frc, mText, start, limit, flag);
313 // TODO: Replace this method with one which returns the font based on the scriptCode.
315 private static Font getScriptFont(char[] text, int start, int limit, List<FontInfo> fonts) {
324 // Fallback font in case no font can be loaded
325 return Font.getFont(Font.SERIF);