sun.font.StandardGlyphVector Java Examples
The following examples show how to use
sun.font.StandardGlyphVector.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Font.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Returns the logical bounds of the specified array of characters * in the specified <code>FontRenderContext</code>. The logical * bounds contains the origin, ascent, advance, and height, which * includes the leading. The logical bounds does not always enclose * all the text. For example, in some languages and in some fonts, * accent marks can be positioned above the ascent or below the * descent. To obtain a visual bounding box, which encloses all the * text, use the {@link TextLayout#getBounds() getBounds} method of * <code>TextLayout</code>. * <p>Note: The returned bounds is in baseline-relative coordinates * (see {@link java.awt.Font class notes}). * @param chars an array of characters * @param beginIndex the initial offset in the array of * characters * @param limit the end offset in the array of characters * @param frc the specified <code>FontRenderContext</code> * @return a <code>Rectangle2D</code> that is the bounding box of the * specified array of characters in the specified * <code>FontRenderContext</code>. * @throws IndexOutOfBoundsException if <code>beginIndex</code> is * less than zero, or <code>limit</code> is greater than the * length of <code>chars</code>, or <code>beginIndex</code> * is greater than <code>limit</code>. * @see FontRenderContext * @see Font#createGlyphVector * @since 1.2 */ public Rectangle2D getStringBounds(char [] chars, int beginIndex, int limit, FontRenderContext frc) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex); } if (limit > chars.length) { throw new IndexOutOfBoundsException("limit: " + limit); } if (beginIndex > limit) { throw new IndexOutOfBoundsException("range length: " + (limit - beginIndex)); } // this code should be in textlayout // quick check for simple text, assume GV ok to use if simple boolean simple = values == null || (values.getKerning() == 0 && values.getLigatures() == 0 && values.getBaselineTransform() == null); if (simple) { simple = ! FontUtilities.isComplexText(chars, beginIndex, limit); } if (simple) { GlyphVector gv = new StandardGlyphVector(this, chars, beginIndex, limit - beginIndex, frc); return gv.getLogicalBounds(); } else { // need char array constructor on textlayout String str = new String(chars, beginIndex, limit - beginIndex); TextLayout tl = new TextLayout(str, this, frc); return new Rectangle2D.Float(0, -tl.getAscent(), tl.getAdvance(), tl.getAscent() + tl.getDescent() + tl.getLeading()); } }
Example #2
Source File: Font.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Returns the logical bounds of the specified array of characters * in the specified <code>FontRenderContext</code>. The logical * bounds contains the origin, ascent, advance, and height, which * includes the leading. The logical bounds does not always enclose * all the text. For example, in some languages and in some fonts, * accent marks can be positioned above the ascent or below the * descent. To obtain a visual bounding box, which encloses all the * text, use the {@link TextLayout#getBounds() getBounds} method of * <code>TextLayout</code>. * <p>Note: The returned bounds is in baseline-relative coordinates * (see {@link java.awt.Font class notes}). * @param chars an array of characters * @param beginIndex the initial offset in the array of * characters * @param limit the end offset in the array of characters * @param frc the specified <code>FontRenderContext</code> * @return a <code>Rectangle2D</code> that is the bounding box of the * specified array of characters in the specified * <code>FontRenderContext</code>. * @throws IndexOutOfBoundsException if <code>beginIndex</code> is * less than zero, or <code>limit</code> is greater than the * length of <code>chars</code>, or <code>beginIndex</code> * is greater than <code>limit</code>. * @see FontRenderContext * @see Font#createGlyphVector * @since 1.2 */ public Rectangle2D getStringBounds(char [] chars, int beginIndex, int limit, FontRenderContext frc) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex); } if (limit > chars.length) { throw new IndexOutOfBoundsException("limit: " + limit); } if (beginIndex > limit) { throw new IndexOutOfBoundsException("range length: " + (limit - beginIndex)); } // this code should be in textlayout // quick check for simple text, assume GV ok to use if simple boolean simple = values == null || (values.getKerning() == 0 && values.getLigatures() == 0 && values.getBaselineTransform() == null); if (simple) { simple = ! FontUtilities.isComplexText(chars, beginIndex, limit); } if (simple) { GlyphVector gv = new StandardGlyphVector(this, chars, beginIndex, limit - beginIndex, frc); return gv.getLogicalBounds(); } else { // need char array constructor on textlayout String str = new String(chars, beginIndex, limit - beginIndex); TextLayout tl = new TextLayout(str, this, frc); return new Rectangle2D.Float(0, -tl.getAscent(), tl.getAdvance(), tl.getAscent() + tl.getDescent() + tl.getLeading()); } }
Example #3
Source File: Font.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Returns the logical bounds of the specified array of characters * in the specified <code>FontRenderContext</code>. The logical * bounds contains the origin, ascent, advance, and height, which * includes the leading. The logical bounds does not always enclose * all the text. For example, in some languages and in some fonts, * accent marks can be positioned above the ascent or below the * descent. To obtain a visual bounding box, which encloses all the * text, use the {@link TextLayout#getBounds() getBounds} method of * <code>TextLayout</code>. * <p>Note: The returned bounds is in baseline-relative coordinates * (see {@link java.awt.Font class notes}). * @param chars an array of characters * @param beginIndex the initial offset in the array of * characters * @param limit the end offset in the array of characters * @param frc the specified <code>FontRenderContext</code> * @return a <code>Rectangle2D</code> that is the bounding box of the * specified array of characters in the specified * <code>FontRenderContext</code>. * @throws IndexOutOfBoundsException if <code>beginIndex</code> is * less than zero, or <code>limit</code> is greater than the * length of <code>chars</code>, or <code>beginIndex</code> * is greater than <code>limit</code>. * @see FontRenderContext * @see Font#createGlyphVector * @since 1.2 */ public Rectangle2D getStringBounds(char [] chars, int beginIndex, int limit, FontRenderContext frc) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex); } if (limit > chars.length) { throw new IndexOutOfBoundsException("limit: " + limit); } if (beginIndex > limit) { throw new IndexOutOfBoundsException("range length: " + (limit - beginIndex)); } // this code should be in textlayout // quick check for simple text, assume GV ok to use if simple boolean simple = values == null || (values.getKerning() == 0 && values.getLigatures() == 0 && values.getBaselineTransform() == null); if (simple) { simple = ! FontUtilities.isComplexText(chars, beginIndex, limit); } if (simple) { GlyphVector gv = new StandardGlyphVector(this, chars, beginIndex, limit - beginIndex, frc); return gv.getLogicalBounds(); } else { // need char array constructor on textlayout String str = new String(chars, beginIndex, limit - beginIndex); TextLayout tl = new TextLayout(str, this, frc); return new Rectangle2D.Float(0, -tl.getAscent(), tl.getAdvance(), tl.getAscent() + tl.getDescent() + tl.getLeading()); } }
Example #4
Source File: Font.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Returns the logical bounds of the specified array of characters * in the specified <code>FontRenderContext</code>. The logical * bounds contains the origin, ascent, advance, and height, which * includes the leading. The logical bounds does not always enclose * all the text. For example, in some languages and in some fonts, * accent marks can be positioned above the ascent or below the * descent. To obtain a visual bounding box, which encloses all the * text, use the {@link TextLayout#getBounds() getBounds} method of * <code>TextLayout</code>. * <p>Note: The returned bounds is in baseline-relative coordinates * (see {@link java.awt.Font class notes}). * @param chars an array of characters * @param beginIndex the initial offset in the array of * characters * @param limit the end offset in the array of characters * @param frc the specified <code>FontRenderContext</code> * @return a <code>Rectangle2D</code> that is the bounding box of the * specified array of characters in the specified * <code>FontRenderContext</code>. * @throws IndexOutOfBoundsException if <code>beginIndex</code> is * less than zero, or <code>limit</code> is greater than the * length of <code>chars</code>, or <code>beginIndex</code> * is greater than <code>limit</code>. * @see FontRenderContext * @see Font#createGlyphVector * @since 1.2 */ public Rectangle2D getStringBounds(char [] chars, int beginIndex, int limit, FontRenderContext frc) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex); } if (limit > chars.length) { throw new IndexOutOfBoundsException("limit: " + limit); } if (beginIndex > limit) { throw new IndexOutOfBoundsException("range length: " + (limit - beginIndex)); } // this code should be in textlayout // quick check for simple text, assume GV ok to use if simple boolean simple = values == null || (values.getKerning() == 0 && values.getLigatures() == 0 && values.getBaselineTransform() == null); if (simple) { simple = ! FontUtilities.isComplexText(chars, beginIndex, limit); } if (simple) { GlyphVector gv = new StandardGlyphVector(this, chars, beginIndex, limit - beginIndex, frc); return gv.getLogicalBounds(); } else { // need char array constructor on textlayout String str = new String(chars, beginIndex, limit - beginIndex); TextLayout tl = new TextLayout(str, this, frc); return new Rectangle2D.Float(0, -tl.getAscent(), tl.getAdvance(), tl.getAscent() + tl.getDescent() + tl.getLeading()); } }
Example #5
Source File: Font.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Returns the logical bounds of the specified array of characters * in the specified <code>FontRenderContext</code>. The logical * bounds contains the origin, ascent, advance, and height, which * includes the leading. The logical bounds does not always enclose * all the text. For example, in some languages and in some fonts, * accent marks can be positioned above the ascent or below the * descent. To obtain a visual bounding box, which encloses all the * text, use the {@link TextLayout#getBounds() getBounds} method of * <code>TextLayout</code>. * <p>Note: The returned bounds is in baseline-relative coordinates * (see {@link java.awt.Font class notes}). * @param chars an array of characters * @param beginIndex the initial offset in the array of * characters * @param limit the end offset in the array of characters * @param frc the specified <code>FontRenderContext</code> * @return a <code>Rectangle2D</code> that is the bounding box of the * specified array of characters in the specified * <code>FontRenderContext</code>. * @throws IndexOutOfBoundsException if <code>beginIndex</code> is * less than zero, or <code>limit</code> is greater than the * length of <code>chars</code>, or <code>beginIndex</code> * is greater than <code>limit</code>. * @see FontRenderContext * @see Font#createGlyphVector * @since 1.2 */ public Rectangle2D getStringBounds(char [] chars, int beginIndex, int limit, FontRenderContext frc) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex); } if (limit > chars.length) { throw new IndexOutOfBoundsException("limit: " + limit); } if (beginIndex > limit) { throw new IndexOutOfBoundsException("range length: " + (limit - beginIndex)); } // this code should be in textlayout // quick check for simple text, assume GV ok to use if simple boolean simple = values == null || (values.getKerning() == 0 && values.getLigatures() == 0 && values.getBaselineTransform() == null); if (simple) { simple = ! FontUtilities.isComplexText(chars, beginIndex, limit); } if (simple) { GlyphVector gv = new StandardGlyphVector(this, chars, beginIndex, limit - beginIndex, frc); return gv.getLogicalBounds(); } else { // need char array constructor on textlayout String str = new String(chars, beginIndex, limit - beginIndex); TextLayout tl = new TextLayout(str, this, frc); return new Rectangle2D.Float(0, -tl.getAscent(), tl.getAdvance(), tl.getAscent() + tl.getDescent() + tl.getLeading()); } }
Example #6
Source File: Font.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the logical bounds of the specified array of characters * in the specified <code>FontRenderContext</code>. The logical * bounds contains the origin, ascent, advance, and height, which * includes the leading. The logical bounds does not always enclose * all the text. For example, in some languages and in some fonts, * accent marks can be positioned above the ascent or below the * descent. To obtain a visual bounding box, which encloses all the * text, use the {@link TextLayout#getBounds() getBounds} method of * <code>TextLayout</code>. * <p>Note: The returned bounds is in baseline-relative coordinates * (see {@link java.awt.Font class notes}). * @param chars an array of characters * @param beginIndex the initial offset in the array of * characters * @param limit the end offset in the array of characters * @param frc the specified <code>FontRenderContext</code> * @return a <code>Rectangle2D</code> that is the bounding box of the * specified array of characters in the specified * <code>FontRenderContext</code>. * @throws IndexOutOfBoundsException if <code>beginIndex</code> is * less than zero, or <code>limit</code> is greater than the * length of <code>chars</code>, or <code>beginIndex</code> * is greater than <code>limit</code>. * @see FontRenderContext * @see Font#createGlyphVector * @since 1.2 */ public Rectangle2D getStringBounds(char [] chars, int beginIndex, int limit, FontRenderContext frc) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex); } if (limit > chars.length) { throw new IndexOutOfBoundsException("limit: " + limit); } if (beginIndex > limit) { throw new IndexOutOfBoundsException("range length: " + (limit - beginIndex)); } // this code should be in textlayout // quick check for simple text, assume GV ok to use if simple boolean simple = values == null || (values.getKerning() == 0 && values.getLigatures() == 0 && values.getBaselineTransform() == null); if (simple) { simple = ! FontUtilities.isComplexText(chars, beginIndex, limit); } if (simple) { GlyphVector gv = new StandardGlyphVector(this, chars, beginIndex, limit - beginIndex, frc); return gv.getLogicalBounds(); } else { // need char array constructor on textlayout String str = new String(chars, beginIndex, limit - beginIndex); TextLayout tl = new TextLayout(str, this, frc); return new Rectangle2D.Float(0, -tl.getAscent(), tl.getAdvance(), tl.getAscent() + tl.getDescent() + tl.getLeading()); } }
Example #7
Source File: Font.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Returns the logical bounds of the specified array of characters * in the specified <code>FontRenderContext</code>. The logical * bounds contains the origin, ascent, advance, and height, which * includes the leading. The logical bounds does not always enclose * all the text. For example, in some languages and in some fonts, * accent marks can be positioned above the ascent or below the * descent. To obtain a visual bounding box, which encloses all the * text, use the {@link TextLayout#getBounds() getBounds} method of * <code>TextLayout</code>. * <p>Note: The returned bounds is in baseline-relative coordinates * (see {@link java.awt.Font class notes}). * @param chars an array of characters * @param beginIndex the initial offset in the array of * characters * @param limit the end offset in the array of characters * @param frc the specified <code>FontRenderContext</code> * @return a <code>Rectangle2D</code> that is the bounding box of the * specified array of characters in the specified * <code>FontRenderContext</code>. * @throws IndexOutOfBoundsException if <code>beginIndex</code> is * less than zero, or <code>limit</code> is greater than the * length of <code>chars</code>, or <code>beginIndex</code> * is greater than <code>limit</code>. * @see FontRenderContext * @see Font#createGlyphVector * @since 1.2 */ public Rectangle2D getStringBounds(char [] chars, int beginIndex, int limit, FontRenderContext frc) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex); } if (limit > chars.length) { throw new IndexOutOfBoundsException("limit: " + limit); } if (beginIndex > limit) { throw new IndexOutOfBoundsException("range length: " + (limit - beginIndex)); } // this code should be in textlayout // quick check for simple text, assume GV ok to use if simple boolean simple = values == null || (values.getKerning() == 0 && values.getLigatures() == 0 && values.getBaselineTransform() == null); if (simple) { simple = ! FontUtilities.isComplexText(chars, beginIndex, limit); } if (simple) { GlyphVector gv = new StandardGlyphVector(this, chars, beginIndex, limit - beginIndex, frc); return gv.getLogicalBounds(); } else { // need char array constructor on textlayout String str = new String(chars, beginIndex, limit - beginIndex); TextLayout tl = new TextLayout(str, this, frc); return new Rectangle2D.Float(0, -tl.getAscent(), tl.getAdvance(), tl.getAscent() + tl.getDescent() + tl.getLeading()); } }
Example #8
Source File: Font.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns the logical bounds of the specified array of characters * in the specified <code>FontRenderContext</code>. The logical * bounds contains the origin, ascent, advance, and height, which * includes the leading. The logical bounds does not always enclose * all the text. For example, in some languages and in some fonts, * accent marks can be positioned above the ascent or below the * descent. To obtain a visual bounding box, which encloses all the * text, use the {@link TextLayout#getBounds() getBounds} method of * <code>TextLayout</code>. * <p>Note: The returned bounds is in baseline-relative coordinates * (see {@link java.awt.Font class notes}). * @param chars an array of characters * @param beginIndex the initial offset in the array of * characters * @param limit the end offset in the array of characters * @param frc the specified <code>FontRenderContext</code> * @return a <code>Rectangle2D</code> that is the bounding box of the * specified array of characters in the specified * <code>FontRenderContext</code>. * @throws IndexOutOfBoundsException if <code>beginIndex</code> is * less than zero, or <code>limit</code> is greater than the * length of <code>chars</code>, or <code>beginIndex</code> * is greater than <code>limit</code>. * @see FontRenderContext * @see Font#createGlyphVector * @since 1.2 */ public Rectangle2D getStringBounds(char [] chars, int beginIndex, int limit, FontRenderContext frc) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex); } if (limit > chars.length) { throw new IndexOutOfBoundsException("limit: " + limit); } if (beginIndex > limit) { throw new IndexOutOfBoundsException("range length: " + (limit - beginIndex)); } // this code should be in textlayout // quick check for simple text, assume GV ok to use if simple boolean simple = values == null || (values.getKerning() == 0 && values.getLigatures() == 0 && values.getBaselineTransform() == null); if (simple) { simple = ! FontUtilities.isComplexText(chars, beginIndex, limit); } if (simple) { GlyphVector gv = new StandardGlyphVector(this, chars, beginIndex, limit - beginIndex, frc); return gv.getLogicalBounds(); } else { // need char array constructor on textlayout String str = new String(chars, beginIndex, limit - beginIndex); TextLayout tl = new TextLayout(str, this, frc); return new Rectangle2D.Float(0, -tl.getAscent(), tl.getAdvance(), tl.getAscent() + tl.getDescent() + tl.getLeading()); } }
Example #9
Source File: Font.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns the logical bounds of the specified array of characters * in the specified <code>FontRenderContext</code>. The logical * bounds contains the origin, ascent, advance, and height, which * includes the leading. The logical bounds does not always enclose * all the text. For example, in some languages and in some fonts, * accent marks can be positioned above the ascent or below the * descent. To obtain a visual bounding box, which encloses all the * text, use the {@link TextLayout#getBounds() getBounds} method of * <code>TextLayout</code>. * <p>Note: The returned bounds is in baseline-relative coordinates * (see {@link java.awt.Font class notes}). * @param chars an array of characters * @param beginIndex the initial offset in the array of * characters * @param limit the end offset in the array of characters * @param frc the specified <code>FontRenderContext</code> * @return a <code>Rectangle2D</code> that is the bounding box of the * specified array of characters in the specified * <code>FontRenderContext</code>. * @throws IndexOutOfBoundsException if <code>beginIndex</code> is * less than zero, or <code>limit</code> is greater than the * length of <code>chars</code>, or <code>beginIndex</code> * is greater than <code>limit</code>. * @see FontRenderContext * @see Font#createGlyphVector * @since 1.2 */ public Rectangle2D getStringBounds(char [] chars, int beginIndex, int limit, FontRenderContext frc) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex); } if (limit > chars.length) { throw new IndexOutOfBoundsException("limit: " + limit); } if (beginIndex > limit) { throw new IndexOutOfBoundsException("range length: " + (limit - beginIndex)); } // this code should be in textlayout // quick check for simple text, assume GV ok to use if simple boolean simple = values == null || (values.getKerning() == 0 && values.getLigatures() == 0 && values.getBaselineTransform() == null); if (simple) { simple = ! FontUtilities.isComplexText(chars, beginIndex, limit); } if (simple) { GlyphVector gv = new StandardGlyphVector(this, chars, beginIndex, limit - beginIndex, frc); return gv.getLogicalBounds(); } else { // need char array constructor on textlayout String str = new String(chars, beginIndex, limit - beginIndex); TextLayout tl = new TextLayout(str, this, frc); return new Rectangle2D.Float(0, -tl.getAscent(), tl.getAdvance(), tl.getAscent() + tl.getDescent() + tl.getLeading()); } }
Example #10
Source File: Font.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Returns the logical bounds of the specified array of characters * in the specified <code>FontRenderContext</code>. The logical * bounds contains the origin, ascent, advance, and height, which * includes the leading. The logical bounds does not always enclose * all the text. For example, in some languages and in some fonts, * accent marks can be positioned above the ascent or below the * descent. To obtain a visual bounding box, which encloses all the * text, use the {@link TextLayout#getBounds() getBounds} method of * <code>TextLayout</code>. * <p>Note: The returned bounds is in baseline-relative coordinates * (see {@link java.awt.Font class notes}). * @param chars an array of characters * @param beginIndex the initial offset in the array of * characters * @param limit the end offset in the array of characters * @param frc the specified <code>FontRenderContext</code> * @return a <code>Rectangle2D</code> that is the bounding box of the * specified array of characters in the specified * <code>FontRenderContext</code>. * @throws IndexOutOfBoundsException if <code>beginIndex</code> is * less than zero, or <code>limit</code> is greater than the * length of <code>chars</code>, or <code>beginIndex</code> * is greater than <code>limit</code>. * @see FontRenderContext * @see Font#createGlyphVector * @since 1.2 */ public Rectangle2D getStringBounds(char [] chars, int beginIndex, int limit, FontRenderContext frc) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex); } if (limit > chars.length) { throw new IndexOutOfBoundsException("limit: " + limit); } if (beginIndex > limit) { throw new IndexOutOfBoundsException("range length: " + (limit - beginIndex)); } // this code should be in textlayout // quick check for simple text, assume GV ok to use if simple boolean simple = values == null || (values.getKerning() == 0 && values.getLigatures() == 0 && values.getBaselineTransform() == null); if (simple) { simple = ! FontUtilities.isComplexText(chars, beginIndex, limit); } if (simple) { GlyphVector gv = new StandardGlyphVector(this, chars, beginIndex, limit - beginIndex, frc); return gv.getLogicalBounds(); } else { // need char array constructor on textlayout String str = new String(chars, beginIndex, limit - beginIndex); TextLayout tl = new TextLayout(str, this, frc); return new Rectangle2D.Float(0, -tl.getAscent(), tl.getAdvance(), tl.getAscent() + tl.getDescent() + tl.getLeading()); } }
Example #11
Source File: Font.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the logical bounds of the specified array of characters * in the specified <code>FontRenderContext</code>. The logical * bounds contains the origin, ascent, advance, and height, which * includes the leading. The logical bounds does not always enclose * all the text. For example, in some languages and in some fonts, * accent marks can be positioned above the ascent or below the * descent. To obtain a visual bounding box, which encloses all the * text, use the {@link TextLayout#getBounds() getBounds} method of * <code>TextLayout</code>. * <p>Note: The returned bounds is in baseline-relative coordinates * (see {@link java.awt.Font class notes}). * @param chars an array of characters * @param beginIndex the initial offset in the array of * characters * @param limit the end offset in the array of characters * @param frc the specified <code>FontRenderContext</code> * @return a <code>Rectangle2D</code> that is the bounding box of the * specified array of characters in the specified * <code>FontRenderContext</code>. * @throws IndexOutOfBoundsException if <code>beginIndex</code> is * less than zero, or <code>limit</code> is greater than the * length of <code>chars</code>, or <code>beginIndex</code> * is greater than <code>limit</code>. * @see FontRenderContext * @see Font#createGlyphVector * @since 1.2 */ public Rectangle2D getStringBounds(char [] chars, int beginIndex, int limit, FontRenderContext frc) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex); } if (limit > chars.length) { throw new IndexOutOfBoundsException("limit: " + limit); } if (beginIndex > limit) { throw new IndexOutOfBoundsException("range length: " + (limit - beginIndex)); } // this code should be in textlayout // quick check for simple text, assume GV ok to use if simple boolean simple = values == null || (values.getKerning() == 0 && values.getLigatures() == 0 && values.getBaselineTransform() == null); if (simple) { simple = ! FontUtilities.isComplexText(chars, beginIndex, limit); } if (simple) { GlyphVector gv = new StandardGlyphVector(this, chars, beginIndex, limit - beginIndex, frc); return gv.getLogicalBounds(); } else { // need char array constructor on textlayout String str = new String(chars, beginIndex, limit - beginIndex); TextLayout tl = new TextLayout(str, this, frc); return new Rectangle2D.Float(0, -tl.getAscent(), tl.getAdvance(), tl.getAscent() + tl.getDescent() + tl.getLeading()); } }
Example #12
Source File: Font.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Returns the logical bounds of the specified array of characters * in the specified {@code FontRenderContext}. The logical * bounds contains the origin, ascent, advance, and height, which * includes the leading. The logical bounds does not always enclose * all the text. For example, in some languages and in some fonts, * accent marks can be positioned above the ascent or below the * descent. To obtain a visual bounding box, which encloses all the * text, use the {@link TextLayout#getBounds() getBounds} method of * {@code TextLayout}. * <p>Note: The returned bounds is in baseline-relative coordinates * (see {@link java.awt.Font class notes}). * @param chars an array of characters * @param beginIndex the initial offset in the array of * characters * @param limit the end offset in the array of characters * @param frc the specified {@code FontRenderContext} * @return a {@code Rectangle2D} that is the bounding box of the * specified array of characters in the specified * {@code FontRenderContext}. * @throws IndexOutOfBoundsException if {@code beginIndex} is * less than zero, or {@code limit} is greater than the * length of {@code chars}, or {@code beginIndex} * is greater than {@code limit}. * @see FontRenderContext * @see Font#createGlyphVector * @since 1.2 */ public Rectangle2D getStringBounds(char [] chars, int beginIndex, int limit, FontRenderContext frc) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex); } if (limit > chars.length) { throw new IndexOutOfBoundsException("limit: " + limit); } if (beginIndex > limit) { throw new IndexOutOfBoundsException("range length: " + (limit - beginIndex)); } // this code should be in textlayout // quick check for simple text, assume GV ok to use if simple boolean simple = values == null || (values.getKerning() == 0 && values.getLigatures() == 0 && values.getBaselineTransform() == null); if (simple) { simple = ! FontUtilities.isComplexText(chars, beginIndex, limit); } if (simple) { GlyphVector gv = new StandardGlyphVector(this, chars, beginIndex, limit - beginIndex, frc); return gv.getLogicalBounds(); } else { // need char array constructor on textlayout String str = new String(chars, beginIndex, limit - beginIndex); TextLayout tl = new TextLayout(str, this, frc); return new Rectangle2D.Float(0, -tl.getAscent(), tl.getAdvance(), tl.getAscent() + tl.getDescent() + tl.getLeading()); } }
Example #13
Source File: Font.java From dragonwell8_jdk with GNU General Public License v2.0 | 3 votes |
/** * Returns a new <code>GlyphVector</code> object, performing full * layout of the text if possible. Full layout is required for * complex text, such as Arabic or Hindi. Support for different * scripts depends on the font and implementation. * <p> * Layout requires bidi analysis, as performed by * <code>Bidi</code>, and should only be performed on text that * has a uniform direction. The direction is indicated in the * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a * right-to-left (Arabic and Hebrew) run direction, or * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) * run direction. * <p> * In addition, some operations, such as Arabic shaping, require * context, so that the characters at the start and limit can have * the proper shapes. Sometimes the data in the buffer outside * the provided range does not have valid data. The values * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be * added to the flags parameter to indicate that the text before * start, or after limit, respectively, should not be examined * for context. * <p> * All other values for the flags parameter are reserved. * * @param frc the specified <code>FontRenderContext</code> * @param text the text to layout * @param start the start of the text to use for the <code>GlyphVector</code> * @param limit the limit of the text to use for the <code>GlyphVector</code> * @param flags control flags as described above * @return a new <code>GlyphVector</code> representing the text between * start and limit, with glyphs chosen and positioned so as to best represent * the text * @throws ArrayIndexOutOfBoundsException if start or limit is * out of bounds * @see java.text.Bidi * @see #LAYOUT_LEFT_TO_RIGHT * @see #LAYOUT_RIGHT_TO_LEFT * @see #LAYOUT_NO_START_CONTEXT * @see #LAYOUT_NO_LIMIT_CONTEXT * @since 1.4 */ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) { GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines StandardGlyphVector gv = gl.layout(this, frc, text, start, limit-start, flags, null); GlyphLayout.done(gl); return gv; }
Example #14
Source File: Font.java From Bytecoder with Apache License 2.0 | 3 votes |
/** * Returns a new {@code GlyphVector} object, performing full * layout of the text if possible. Full layout is required for * complex text, such as Arabic or Hindi. Support for different * scripts depends on the font and implementation. * <p> * Layout requires bidi analysis, as performed by * {@code Bidi}, and should only be performed on text that * has a uniform direction. The direction is indicated in the * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a * right-to-left (Arabic and Hebrew) run direction, or * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) * run direction. * <p> * In addition, some operations, such as Arabic shaping, require * context, so that the characters at the start and limit can have * the proper shapes. Sometimes the data in the buffer outside * the provided range does not have valid data. The values * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be * added to the flags parameter to indicate that the text before * start, or after limit, respectively, should not be examined * for context. * <p> * All other values for the flags parameter are reserved. * * @param frc the specified {@code FontRenderContext} * @param text the text to layout * @param start the start of the text to use for the {@code GlyphVector} * @param limit the limit of the text to use for the {@code GlyphVector} * @param flags control flags as described above * @return a new {@code GlyphVector} representing the text between * start and limit, with glyphs chosen and positioned so as to best represent * the text * @throws ArrayIndexOutOfBoundsException if start or limit is * out of bounds * @see java.text.Bidi * @see #LAYOUT_LEFT_TO_RIGHT * @see #LAYOUT_RIGHT_TO_LEFT * @see #LAYOUT_NO_START_CONTEXT * @see #LAYOUT_NO_LIMIT_CONTEXT * @since 1.4 */ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) { GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines StandardGlyphVector gv = gl.layout(this, frc, text, start, limit-start, flags, null); GlyphLayout.done(gl); return gv; }
Example #15
Source File: Font.java From openjdk-8-source with GNU General Public License v2.0 | 3 votes |
/** * Returns a new <code>GlyphVector</code> object, performing full * layout of the text if possible. Full layout is required for * complex text, such as Arabic or Hindi. Support for different * scripts depends on the font and implementation. * <p> * Layout requires bidi analysis, as performed by * <code>Bidi</code>, and should only be performed on text that * has a uniform direction. The direction is indicated in the * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a * right-to-left (Arabic and Hebrew) run direction, or * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) * run direction. * <p> * In addition, some operations, such as Arabic shaping, require * context, so that the characters at the start and limit can have * the proper shapes. Sometimes the data in the buffer outside * the provided range does not have valid data. The values * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be * added to the flags parameter to indicate that the text before * start, or after limit, respectively, should not be examined * for context. * <p> * All other values for the flags parameter are reserved. * * @param frc the specified <code>FontRenderContext</code> * @param text the text to layout * @param start the start of the text to use for the <code>GlyphVector</code> * @param limit the limit of the text to use for the <code>GlyphVector</code> * @param flags control flags as described above * @return a new <code>GlyphVector</code> representing the text between * start and limit, with glyphs chosen and positioned so as to best represent * the text * @throws ArrayIndexOutOfBoundsException if start or limit is * out of bounds * @see java.text.Bidi * @see #LAYOUT_LEFT_TO_RIGHT * @see #LAYOUT_RIGHT_TO_LEFT * @see #LAYOUT_NO_START_CONTEXT * @see #LAYOUT_NO_LIMIT_CONTEXT * @since 1.4 */ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) { GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines StandardGlyphVector gv = gl.layout(this, frc, text, start, limit-start, flags, null); GlyphLayout.done(gl); return gv; }
Example #16
Source File: Font.java From hottub with GNU General Public License v2.0 | 3 votes |
/** * Returns a new <code>GlyphVector</code> object, performing full * layout of the text if possible. Full layout is required for * complex text, such as Arabic or Hindi. Support for different * scripts depends on the font and implementation. * <p> * Layout requires bidi analysis, as performed by * <code>Bidi</code>, and should only be performed on text that * has a uniform direction. The direction is indicated in the * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a * right-to-left (Arabic and Hebrew) run direction, or * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) * run direction. * <p> * In addition, some operations, such as Arabic shaping, require * context, so that the characters at the start and limit can have * the proper shapes. Sometimes the data in the buffer outside * the provided range does not have valid data. The values * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be * added to the flags parameter to indicate that the text before * start, or after limit, respectively, should not be examined * for context. * <p> * All other values for the flags parameter are reserved. * * @param frc the specified <code>FontRenderContext</code> * @param text the text to layout * @param start the start of the text to use for the <code>GlyphVector</code> * @param limit the limit of the text to use for the <code>GlyphVector</code> * @param flags control flags as described above * @return a new <code>GlyphVector</code> representing the text between * start and limit, with glyphs chosen and positioned so as to best represent * the text * @throws ArrayIndexOutOfBoundsException if start or limit is * out of bounds * @see java.text.Bidi * @see #LAYOUT_LEFT_TO_RIGHT * @see #LAYOUT_RIGHT_TO_LEFT * @see #LAYOUT_NO_START_CONTEXT * @see #LAYOUT_NO_LIMIT_CONTEXT * @since 1.4 */ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) { GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines StandardGlyphVector gv = gl.layout(this, frc, text, start, limit-start, flags, null); GlyphLayout.done(gl); return gv; }
Example #17
Source File: Font.java From Java8CN with Apache License 2.0 | 3 votes |
/** * Returns a new <code>GlyphVector</code> object, performing full * layout of the text if possible. Full layout is required for * complex text, such as Arabic or Hindi. Support for different * scripts depends on the font and implementation. * <p> * Layout requires bidi analysis, as performed by * <code>Bidi</code>, and should only be performed on text that * has a uniform direction. The direction is indicated in the * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a * right-to-left (Arabic and Hebrew) run direction, or * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) * run direction. * <p> * In addition, some operations, such as Arabic shaping, require * context, so that the characters at the start and limit can have * the proper shapes. Sometimes the data in the buffer outside * the provided range does not have valid data. The values * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be * added to the flags parameter to indicate that the text before * start, or after limit, respectively, should not be examined * for context. * <p> * All other values for the flags parameter are reserved. * * @param frc the specified <code>FontRenderContext</code> * @param text the text to layout * @param start the start of the text to use for the <code>GlyphVector</code> * @param limit the limit of the text to use for the <code>GlyphVector</code> * @param flags control flags as described above * @return a new <code>GlyphVector</code> representing the text between * start and limit, with glyphs chosen and positioned so as to best represent * the text * @throws ArrayIndexOutOfBoundsException if start or limit is * out of bounds * @see java.text.Bidi * @see #LAYOUT_LEFT_TO_RIGHT * @see #LAYOUT_RIGHT_TO_LEFT * @see #LAYOUT_NO_START_CONTEXT * @see #LAYOUT_NO_LIMIT_CONTEXT * @since 1.4 */ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) { GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines StandardGlyphVector gv = gl.layout(this, frc, text, start, limit-start, flags, null); GlyphLayout.done(gl); return gv; }
Example #18
Source File: Font.java From TencentKona-8 with GNU General Public License v2.0 | 3 votes |
/** * Returns a new <code>GlyphVector</code> object, performing full * layout of the text if possible. Full layout is required for * complex text, such as Arabic or Hindi. Support for different * scripts depends on the font and implementation. * <p> * Layout requires bidi analysis, as performed by * <code>Bidi</code>, and should only be performed on text that * has a uniform direction. The direction is indicated in the * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a * right-to-left (Arabic and Hebrew) run direction, or * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) * run direction. * <p> * In addition, some operations, such as Arabic shaping, require * context, so that the characters at the start and limit can have * the proper shapes. Sometimes the data in the buffer outside * the provided range does not have valid data. The values * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be * added to the flags parameter to indicate that the text before * start, or after limit, respectively, should not be examined * for context. * <p> * All other values for the flags parameter are reserved. * * @param frc the specified <code>FontRenderContext</code> * @param text the text to layout * @param start the start of the text to use for the <code>GlyphVector</code> * @param limit the limit of the text to use for the <code>GlyphVector</code> * @param flags control flags as described above * @return a new <code>GlyphVector</code> representing the text between * start and limit, with glyphs chosen and positioned so as to best represent * the text * @throws ArrayIndexOutOfBoundsException if start or limit is * out of bounds * @see java.text.Bidi * @see #LAYOUT_LEFT_TO_RIGHT * @see #LAYOUT_RIGHT_TO_LEFT * @see #LAYOUT_NO_START_CONTEXT * @see #LAYOUT_NO_LIMIT_CONTEXT * @since 1.4 */ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) { GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines StandardGlyphVector gv = gl.layout(this, frc, text, start, limit-start, flags, null); GlyphLayout.done(gl); return gv; }
Example #19
Source File: Font.java From openjdk-8 with GNU General Public License v2.0 | 3 votes |
/** * Returns a new <code>GlyphVector</code> object, performing full * layout of the text if possible. Full layout is required for * complex text, such as Arabic or Hindi. Support for different * scripts depends on the font and implementation. * <p> * Layout requires bidi analysis, as performed by * <code>Bidi</code>, and should only be performed on text that * has a uniform direction. The direction is indicated in the * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a * right-to-left (Arabic and Hebrew) run direction, or * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) * run direction. * <p> * In addition, some operations, such as Arabic shaping, require * context, so that the characters at the start and limit can have * the proper shapes. Sometimes the data in the buffer outside * the provided range does not have valid data. The values * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be * added to the flags parameter to indicate that the text before * start, or after limit, respectively, should not be examined * for context. * <p> * All other values for the flags parameter are reserved. * * @param frc the specified <code>FontRenderContext</code> * @param text the text to layout * @param start the start of the text to use for the <code>GlyphVector</code> * @param limit the limit of the text to use for the <code>GlyphVector</code> * @param flags control flags as described above * @return a new <code>GlyphVector</code> representing the text between * start and limit, with glyphs chosen and positioned so as to best represent * the text * @throws ArrayIndexOutOfBoundsException if start or limit is * out of bounds * @see java.text.Bidi * @see #LAYOUT_LEFT_TO_RIGHT * @see #LAYOUT_RIGHT_TO_LEFT * @see #LAYOUT_NO_START_CONTEXT * @see #LAYOUT_NO_LIMIT_CONTEXT * @since 1.4 */ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) { GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines StandardGlyphVector gv = gl.layout(this, frc, text, start, limit-start, flags, null); GlyphLayout.done(gl); return gv; }
Example #20
Source File: Font.java From jdk8u_jdk with GNU General Public License v2.0 | 3 votes |
/** * Returns a new <code>GlyphVector</code> object, performing full * layout of the text if possible. Full layout is required for * complex text, such as Arabic or Hindi. Support for different * scripts depends on the font and implementation. * <p> * Layout requires bidi analysis, as performed by * <code>Bidi</code>, and should only be performed on text that * has a uniform direction. The direction is indicated in the * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a * right-to-left (Arabic and Hebrew) run direction, or * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) * run direction. * <p> * In addition, some operations, such as Arabic shaping, require * context, so that the characters at the start and limit can have * the proper shapes. Sometimes the data in the buffer outside * the provided range does not have valid data. The values * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be * added to the flags parameter to indicate that the text before * start, or after limit, respectively, should not be examined * for context. * <p> * All other values for the flags parameter are reserved. * * @param frc the specified <code>FontRenderContext</code> * @param text the text to layout * @param start the start of the text to use for the <code>GlyphVector</code> * @param limit the limit of the text to use for the <code>GlyphVector</code> * @param flags control flags as described above * @return a new <code>GlyphVector</code> representing the text between * start and limit, with glyphs chosen and positioned so as to best represent * the text * @throws ArrayIndexOutOfBoundsException if start or limit is * out of bounds * @see java.text.Bidi * @see #LAYOUT_LEFT_TO_RIGHT * @see #LAYOUT_RIGHT_TO_LEFT * @see #LAYOUT_NO_START_CONTEXT * @see #LAYOUT_NO_LIMIT_CONTEXT * @since 1.4 */ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) { GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines StandardGlyphVector gv = gl.layout(this, frc, text, start, limit-start, flags, null); GlyphLayout.done(gl); return gv; }
Example #21
Source File: Font.java From jdk8u-jdk with GNU General Public License v2.0 | 3 votes |
/** * Returns a new <code>GlyphVector</code> object, performing full * layout of the text if possible. Full layout is required for * complex text, such as Arabic or Hindi. Support for different * scripts depends on the font and implementation. * <p> * Layout requires bidi analysis, as performed by * <code>Bidi</code>, and should only be performed on text that * has a uniform direction. The direction is indicated in the * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a * right-to-left (Arabic and Hebrew) run direction, or * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) * run direction. * <p> * In addition, some operations, such as Arabic shaping, require * context, so that the characters at the start and limit can have * the proper shapes. Sometimes the data in the buffer outside * the provided range does not have valid data. The values * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be * added to the flags parameter to indicate that the text before * start, or after limit, respectively, should not be examined * for context. * <p> * All other values for the flags parameter are reserved. * * @param frc the specified <code>FontRenderContext</code> * @param text the text to layout * @param start the start of the text to use for the <code>GlyphVector</code> * @param limit the limit of the text to use for the <code>GlyphVector</code> * @param flags control flags as described above * @return a new <code>GlyphVector</code> representing the text between * start and limit, with glyphs chosen and positioned so as to best represent * the text * @throws ArrayIndexOutOfBoundsException if start or limit is * out of bounds * @see java.text.Bidi * @see #LAYOUT_LEFT_TO_RIGHT * @see #LAYOUT_RIGHT_TO_LEFT * @see #LAYOUT_NO_START_CONTEXT * @see #LAYOUT_NO_LIMIT_CONTEXT * @since 1.4 */ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) { GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines StandardGlyphVector gv = gl.layout(this, frc, text, start, limit-start, flags, null); GlyphLayout.done(gl); return gv; }
Example #22
Source File: Font.java From openjdk-jdk8u with GNU General Public License v2.0 | 3 votes |
/** * Returns a new <code>GlyphVector</code> object, performing full * layout of the text if possible. Full layout is required for * complex text, such as Arabic or Hindi. Support for different * scripts depends on the font and implementation. * <p> * Layout requires bidi analysis, as performed by * <code>Bidi</code>, and should only be performed on text that * has a uniform direction. The direction is indicated in the * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a * right-to-left (Arabic and Hebrew) run direction, or * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) * run direction. * <p> * In addition, some operations, such as Arabic shaping, require * context, so that the characters at the start and limit can have * the proper shapes. Sometimes the data in the buffer outside * the provided range does not have valid data. The values * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be * added to the flags parameter to indicate that the text before * start, or after limit, respectively, should not be examined * for context. * <p> * All other values for the flags parameter are reserved. * * @param frc the specified <code>FontRenderContext</code> * @param text the text to layout * @param start the start of the text to use for the <code>GlyphVector</code> * @param limit the limit of the text to use for the <code>GlyphVector</code> * @param flags control flags as described above * @return a new <code>GlyphVector</code> representing the text between * start and limit, with glyphs chosen and positioned so as to best represent * the text * @throws ArrayIndexOutOfBoundsException if start or limit is * out of bounds * @see java.text.Bidi * @see #LAYOUT_LEFT_TO_RIGHT * @see #LAYOUT_RIGHT_TO_LEFT * @see #LAYOUT_NO_START_CONTEXT * @see #LAYOUT_NO_LIMIT_CONTEXT * @since 1.4 */ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) { GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines StandardGlyphVector gv = gl.layout(this, frc, text, start, limit-start, flags, null); GlyphLayout.done(gl); return gv; }
Example #23
Source File: Font.java From openjdk-jdk9 with GNU General Public License v2.0 | 3 votes |
/** * Returns a new {@code GlyphVector} object, performing full * layout of the text if possible. Full layout is required for * complex text, such as Arabic or Hindi. Support for different * scripts depends on the font and implementation. * <p> * Layout requires bidi analysis, as performed by * {@code Bidi}, and should only be performed on text that * has a uniform direction. The direction is indicated in the * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a * right-to-left (Arabic and Hebrew) run direction, or * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) * run direction. * <p> * In addition, some operations, such as Arabic shaping, require * context, so that the characters at the start and limit can have * the proper shapes. Sometimes the data in the buffer outside * the provided range does not have valid data. The values * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be * added to the flags parameter to indicate that the text before * start, or after limit, respectively, should not be examined * for context. * <p> * All other values for the flags parameter are reserved. * * @param frc the specified {@code FontRenderContext} * @param text the text to layout * @param start the start of the text to use for the {@code GlyphVector} * @param limit the limit of the text to use for the {@code GlyphVector} * @param flags control flags as described above * @return a new {@code GlyphVector} representing the text between * start and limit, with glyphs chosen and positioned so as to best represent * the text * @throws ArrayIndexOutOfBoundsException if start or limit is * out of bounds * @see java.text.Bidi * @see #LAYOUT_LEFT_TO_RIGHT * @see #LAYOUT_RIGHT_TO_LEFT * @see #LAYOUT_NO_START_CONTEXT * @see #LAYOUT_NO_LIMIT_CONTEXT * @since 1.4 */ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) { GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines StandardGlyphVector gv = gl.layout(this, frc, text, start, limit-start, flags, null); GlyphLayout.done(gl); return gv; }
Example #24
Source File: Font.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 3 votes |
/** * Returns a new <code>GlyphVector</code> object, performing full * layout of the text if possible. Full layout is required for * complex text, such as Arabic or Hindi. Support for different * scripts depends on the font and implementation. * <p> * Layout requires bidi analysis, as performed by * <code>Bidi</code>, and should only be performed on text that * has a uniform direction. The direction is indicated in the * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a * right-to-left (Arabic and Hebrew) run direction, or * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) * run direction. * <p> * In addition, some operations, such as Arabic shaping, require * context, so that the characters at the start and limit can have * the proper shapes. Sometimes the data in the buffer outside * the provided range does not have valid data. The values * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be * added to the flags parameter to indicate that the text before * start, or after limit, respectively, should not be examined * for context. * <p> * All other values for the flags parameter are reserved. * * @param frc the specified <code>FontRenderContext</code> * @param text the text to layout * @param start the start of the text to use for the <code>GlyphVector</code> * @param limit the limit of the text to use for the <code>GlyphVector</code> * @param flags control flags as described above * @return a new <code>GlyphVector</code> representing the text between * start and limit, with glyphs chosen and positioned so as to best represent * the text * @throws ArrayIndexOutOfBoundsException if start or limit is * out of bounds * @see java.text.Bidi * @see #LAYOUT_LEFT_TO_RIGHT * @see #LAYOUT_RIGHT_TO_LEFT * @see #LAYOUT_NO_START_CONTEXT * @see #LAYOUT_NO_LIMIT_CONTEXT * @since 1.4 */ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) { GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines StandardGlyphVector gv = gl.layout(this, frc, text, start, limit-start, flags, null); GlyphLayout.done(gl); return gv; }
Example #25
Source File: Font.java From jdk8u60 with GNU General Public License v2.0 | 3 votes |
/** * Returns a new <code>GlyphVector</code> object, performing full * layout of the text if possible. Full layout is required for * complex text, such as Arabic or Hindi. Support for different * scripts depends on the font and implementation. * <p> * Layout requires bidi analysis, as performed by * <code>Bidi</code>, and should only be performed on text that * has a uniform direction. The direction is indicated in the * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a * right-to-left (Arabic and Hebrew) run direction, or * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) * run direction. * <p> * In addition, some operations, such as Arabic shaping, require * context, so that the characters at the start and limit can have * the proper shapes. Sometimes the data in the buffer outside * the provided range does not have valid data. The values * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be * added to the flags parameter to indicate that the text before * start, or after limit, respectively, should not be examined * for context. * <p> * All other values for the flags parameter are reserved. * * @param frc the specified <code>FontRenderContext</code> * @param text the text to layout * @param start the start of the text to use for the <code>GlyphVector</code> * @param limit the limit of the text to use for the <code>GlyphVector</code> * @param flags control flags as described above * @return a new <code>GlyphVector</code> representing the text between * start and limit, with glyphs chosen and positioned so as to best represent * the text * @throws ArrayIndexOutOfBoundsException if start or limit is * out of bounds * @see java.text.Bidi * @see #LAYOUT_LEFT_TO_RIGHT * @see #LAYOUT_RIGHT_TO_LEFT * @see #LAYOUT_NO_START_CONTEXT * @see #LAYOUT_NO_LIMIT_CONTEXT * @since 1.4 */ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) { GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines StandardGlyphVector gv = gl.layout(this, frc, text, start, limit-start, flags, null); GlyphLayout.done(gl); return gv; }
Example #26
Source File: Font.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * Creates a {@link java.awt.font.GlyphVector GlyphVector} by * mapping characters to glyphs one-to-one based on the * Unicode cmap in this <code>Font</code>. This method does no other * processing besides the mapping of glyphs to characters. This * means that this method is not useful for some scripts, such * as Arabic, Hebrew, Thai, and Indic, that require reordering, * shaping, or ligature substitution. * @param frc the specified <code>FontRenderContext</code> * @param chars the specified array of characters * @return a new <code>GlyphVector</code> created with the * specified array of characters and the specified * <code>FontRenderContext</code>. */ public GlyphVector createGlyphVector(FontRenderContext frc, char[] chars) { return (GlyphVector)new StandardGlyphVector(this, chars, frc); }
Example #27
Source File: Font.java From openjdk-jdk9 with GNU General Public License v2.0 | 2 votes |
/** * Creates a {@link java.awt.font.GlyphVector GlyphVector} by * mapping characters to glyphs one-to-one based on the * Unicode cmap in this {@code Font}. This method does no other * processing besides the mapping of glyphs to characters. This * means that this method is not useful for some scripts, such * as Arabic, Hebrew, Thai, and Indic, that require reordering, * shaping, or ligature substitution. * @param frc the specified {@code FontRenderContext} * @param glyphCodes the specified integer array * @return a new {@code GlyphVector} created with the * specified integer array and the specified * {@code FontRenderContext}. */ public GlyphVector createGlyphVector( FontRenderContext frc, int [] glyphCodes) { return (GlyphVector)new StandardGlyphVector(this, glyphCodes, frc); }
Example #28
Source File: Font.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * Creates a {@link java.awt.font.GlyphVector GlyphVector} by * mapping the specified characters to glyphs one-to-one based on the * Unicode cmap in this <code>Font</code>. This method does no other * processing besides the mapping of glyphs to characters. This * means that this method is not useful for some scripts, such * as Arabic, Hebrew, Thai, and Indic, that require reordering, * shaping, or ligature substitution. * @param frc the specified <code>FontRenderContext</code> * @param ci the specified <code>CharacterIterator</code> * @return a new <code>GlyphVector</code> created with the * specified <code>CharacterIterator</code> and the specified * <code>FontRenderContext</code>. */ public GlyphVector createGlyphVector( FontRenderContext frc, CharacterIterator ci) { return (GlyphVector)new StandardGlyphVector(this, ci, frc); }
Example #29
Source File: Font.java From openjdk-8 with GNU General Public License v2.0 | 2 votes |
/** * Creates a {@link java.awt.font.GlyphVector GlyphVector} by * mapping characters to glyphs one-to-one based on the * Unicode cmap in this <code>Font</code>. This method does no other * processing besides the mapping of glyphs to characters. This * means that this method is not useful for some scripts, such * as Arabic, Hebrew, Thai, and Indic, that require reordering, * shaping, or ligature substitution. * @param frc the specified <code>FontRenderContext</code> * @param str the specified <code>String</code> * @return a new <code>GlyphVector</code> created with the * specified <code>String</code> and the specified * <code>FontRenderContext</code>. */ public GlyphVector createGlyphVector(FontRenderContext frc, String str) { return (GlyphVector)new StandardGlyphVector(this, str, frc); }
Example #30
Source File: Font.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * Creates a {@link java.awt.font.GlyphVector GlyphVector} by * mapping characters to glyphs one-to-one based on the * Unicode cmap in this <code>Font</code>. This method does no other * processing besides the mapping of glyphs to characters. This * means that this method is not useful for some scripts, such * as Arabic, Hebrew, Thai, and Indic, that require reordering, * shaping, or ligature substitution. * @param frc the specified <code>FontRenderContext</code> * @param str the specified <code>String</code> * @return a new <code>GlyphVector</code> created with the * specified <code>String</code> and the specified * <code>FontRenderContext</code>. */ public GlyphVector createGlyphVector(FontRenderContext frc, String str) { return (GlyphVector)new StandardGlyphVector(this, str, frc); }