|
53 | 53 | importstaticsun.font.EAttribute.EWIDTH; |
54 | 54 |
|
55 | 55 | importjava.awt.font.FontRenderContext; |
| 56 | +importjava.awt.font.GlyphVector; |
56 | 57 | importjava.awt.font.LineMetrics; |
57 | 58 | importjava.awt.font.TextAttribute; |
58 | 59 | importjava.awt.font.TextLayout; |
|
65 | 66 | importjava.text.CharacterIterator; |
66 | 67 | importjava.util.Map; |
67 | 68 |
|
| 69 | +importcom.sun.javafx.text.GlyphLayout; |
| 70 | + |
68 | 71 | importjavajs.util.SB; |
69 | 72 | importsun.font.AttributeMap; |
70 | 73 | importsun.font.AttributeValues; |
71 | 74 | importsun.font.CoreMetrics; |
72 | 75 | importsun.font.Font2DHandle; |
73 | 76 | importsun.font.FontDesignMetrics; |
74 | 77 | importsun.font.FontLineMetrics; |
| 78 | +importsun.font.StandardGlyphVector; |
75 | 79 | importswingjs.JSToolkit; |
76 | 80 |
|
77 | 81 | /** |
@@ -2578,139 +2582,139 @@ public Rectangle2D getMaxCharBounds(FontRenderContext frc) { |
2578 | 2582 | metrics[0] +metrics[1] +metrics[2]); |
2579 | 2583 | } |
2580 | 2584 |
|
2581 | | -//// /** |
2582 | | -//// * Creates a {@link java.awt.font.GlyphVector GlyphVector} by |
2583 | | -//// * mapping characters to glyphs one-to-one based on the |
2584 | | -//// * Unicode cmap in this <code>Font</code>. This method does no other |
2585 | | -//// * processing besides the mapping of glyphs to characters. This |
2586 | | -//// * means that this method is not useful for some scripts, such |
2587 | | -//// * as Arabic, Hebrew, Thai, and Indic, that require reordering, |
2588 | | -//// * shaping, or ligature substitution. |
2589 | | -//// * @param frc the specified <code>FontRenderContext</code> |
2590 | | -//// * @param str the specified <code>String</code> |
2591 | | -//// * @return a new <code>GlyphVector</code> created with the |
2592 | | -//// * specified <code>String</code> and the specified |
2593 | | -//// * <code>FontRenderContext</code>. |
2594 | | -//// */ |
2595 | | -//// public GlyphVector createGlyphVector(FontRenderContext frc, String str) |
2596 | | -//// { |
2597 | | -//// return (GlyphVector)new StandardGlyphVector(this, str, frc); |
2598 | | -//// } |
2599 | | -//// |
2600 | | -//// /** |
2601 | | -//// * Creates a {@link java.awt.font.GlyphVector GlyphVector} by |
2602 | | -//// * mapping characters to glyphs one-to-one based on the |
2603 | | -//// * Unicode cmap in this <code>Font</code>. This method does no other |
2604 | | -//// * processing besides the mapping of glyphs to characters. This |
2605 | | -//// * means that this method is not useful for some scripts, such |
2606 | | -//// * as Arabic, Hebrew, Thai, and Indic, that require reordering, |
2607 | | -//// * shaping, or ligature substitution. |
2608 | | -//// * @param frc the specified <code>FontRenderContext</code> |
2609 | | -//// * @param chars the specified array of characters |
2610 | | -//// * @return a new <code>GlyphVector</code> created with the |
2611 | | -//// * specified array of characters and the specified |
2612 | | -//// * <code>FontRenderContext</code>. |
2613 | | -//// */ |
2614 | | -//// public GlyphVector createGlyphVector(FontRenderContext frc, char[] chars) |
2615 | | -//// { |
2616 | | -//// return (GlyphVector)new StandardGlyphVector(this, chars, frc); |
2617 | | -//// } |
2618 | | -//// |
2619 | | -//// /** |
2620 | | -//// * Creates a {@link java.awt.font.GlyphVector GlyphVector} by |
2621 | | -//// * mapping the specified characters to glyphs one-to-one based on the |
2622 | | -//// * Unicode cmap in this <code>Font</code>. This method does no other |
2623 | | -//// * processing besides the mapping of glyphs to characters. This |
2624 | | -//// * means that this method is not useful for some scripts, such |
2625 | | -//// * as Arabic, Hebrew, Thai, and Indic, that require reordering, |
2626 | | -//// * shaping, or ligature substitution. |
2627 | | -//// * @param frc the specified <code>FontRenderContext</code> |
2628 | | -//// * @param ci the specified <code>CharacterIterator</code> |
2629 | | -//// * @return a new <code>GlyphVector</code> created with the |
2630 | | -//// * specified <code>CharacterIterator</code> and the specified |
2631 | | -//// * <code>FontRenderContext</code>. |
2632 | | -//// */ |
2633 | | -//// public GlyphVector createGlyphVector( FontRenderContext frc, |
2634 | | -//// CharacterIterator ci) |
2635 | | -//// { |
2636 | | -//// return (GlyphVector)new StandardGlyphVector(this, ci, frc); |
2637 | | -//// } |
2638 | | -//// |
2639 | | -//// /** |
2640 | | -//// * Creates a {@link java.awt.font.GlyphVector GlyphVector} by |
2641 | | -//// * mapping characters to glyphs one-to-one based on the |
2642 | | -//// * Unicode cmap in this <code>Font</code>. This method does no other |
2643 | | -//// * processing besides the mapping of glyphs to characters. This |
2644 | | -//// * means that this method is not useful for some scripts, such |
2645 | | -//// * as Arabic, Hebrew, Thai, and Indic, that require reordering, |
2646 | | -//// * shaping, or ligature substitution. |
2647 | | -//// * @param frc the specified <code>FontRenderContext</code> |
2648 | | -//// * @param glyphCodes the specified integer array |
2649 | | -//// * @return a new <code>GlyphVector</code> created with the |
2650 | | -//// * specified integer array and the specified |
2651 | | -//// * <code>FontRenderContext</code>. |
2652 | | -//// */ |
2653 | | -//// public GlyphVector createGlyphVector( FontRenderContext frc, |
2654 | | -//// int [] glyphCodes) |
2655 | | -//// { |
2656 | | -//// return (GlyphVector)new StandardGlyphVector(this, glyphCodes, frc); |
2657 | | -//// } |
2658 | | -//// |
2659 | | -//// /** |
2660 | | -//// * Returns a new <code>GlyphVector</code> object, performing full |
2661 | | -//// * layout of the text if possible. Full layout is required for |
2662 | | -//// * complex text, such as Arabic or Hindi. Support for different |
2663 | | -//// * scripts depends on the font and implementation. |
2664 | | -//// * <p> |
2665 | | -//// * Layout requires bidi analysis, as performed by |
2666 | | -//// * <code>Bidi</code>, and should only be performed on text that |
2667 | | -//// * has a uniform direction. The direction is indicated in the |
2668 | | -//// * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a |
2669 | | -//// * right-to-left (Arabic and Hebrew) run direction, or |
2670 | | -//// * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) |
2671 | | -//// * run direction. |
2672 | | -//// * <p> |
2673 | | -//// * In addition, some operations, such as Arabic shaping, require |
2674 | | -//// * context, so that the characters at the start and limit can have |
2675 | | -//// * the proper shapes. Sometimes the data in the buffer outside |
2676 | | -//// * the provided range does not have valid data. The values |
2677 | | -//// * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be |
2678 | | -//// * added to the flags parameter to indicate that the text before |
2679 | | -//// * start, or after limit, respectively, should not be examined |
2680 | | -//// * for context. |
2681 | | -//// * <p> |
2682 | | -//// * All other values for the flags parameter are reserved. |
2683 | | -//// * |
2684 | | -//// * @param frc the specified <code>FontRenderContext</code> |
2685 | | -//// * @param text the text to layout |
2686 | | -//// * @param start the start of the text to use for the <code>GlyphVector</code> |
2687 | | -//// * @param limit the limit of the text to use for the <code>GlyphVector</code> |
2688 | | -//// * @param flags control flags as described above |
2689 | | -//// * @return a new <code>GlyphVector</code> representing the text between |
2690 | | -//// * start and limit, with glyphs chosen and positioned so as to best represent |
2691 | | -//// * the text |
2692 | | -//// * @throws ArrayIndexOutOfBoundsException if start or limit is |
2693 | | -//// * out of bounds |
2694 | | -//// * @see java.text.Bidi |
2695 | | -//// * @see #LAYOUT_LEFT_TO_RIGHT |
2696 | | -//// * @see #LAYOUT_RIGHT_TO_LEFT |
2697 | | -//// * @see #LAYOUT_NO_START_CONTEXT |
2698 | | -//// * @see #LAYOUT_NO_LIMIT_CONTEXT |
2699 | | -//// * @since 1.4 |
2700 | | -//// */ |
2701 | | -//// public GlyphVector layoutGlyphVector(FontRenderContext frc, |
2702 | | -//// char[] text, |
2703 | | -//// int start, |
2704 | | -//// int limit, |
2705 | | -//// int flags) { |
2706 | | -//// |
2707 | | -//// GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines |
2708 | | -//// StandardGlyphVector gv = gl.layout(this, frc, text, |
2709 | | -//// start, limit-start, flags, null); |
2710 | | -//// GlyphLayout.done(gl); |
2711 | | -//// return gv; |
2712 | | -//// } |
| 2585 | +/** |
| 2586 | + * Creates a {@link java.awt.font.GlyphVector GlyphVector} by |
| 2587 | + * mapping characters to glyphs one-to-one based on the |
| 2588 | + * Unicode cmap in this <code>Font</code>. This method does no other |
| 2589 | + * processing besides the mapping of glyphs to characters. This |
| 2590 | + * means that this method is not useful for some scripts, such |
| 2591 | + * as Arabic, Hebrew, Thai, and Indic, that require reordering, |
| 2592 | + * shaping, or ligature substitution. |
| 2593 | + * @param frc the specified <code>FontRenderContext</code> |
| 2594 | + * @param str the specified <code>String</code> |
| 2595 | + * @return a new <code>GlyphVector</code> created with the |
| 2596 | + * specified <code>String</code> and the specified |
| 2597 | + * <code>FontRenderContext</code>. |
| 2598 | + */ |
| 2599 | +publicGlyphVectorcreateGlyphVector(FontRenderContextfrc,Stringstr) |
| 2600 | + { |
| 2601 | +return (GlyphVector)newStandardGlyphVector(this,str,frc); |
| 2602 | + } |
| 2603 | + |
| 2604 | +/** |
| 2605 | + * Creates a {@link java.awt.font.GlyphVector GlyphVector} by |
| 2606 | + * mapping characters to glyphs one-to-one based on the |
| 2607 | + * Unicode cmap in this <code>Font</code>. This method does no other |
| 2608 | + * processing besides the mapping of glyphs to characters. This |
| 2609 | + * means that this method is not useful for some scripts, such |
| 2610 | + * as Arabic, Hebrew, Thai, and Indic, that require reordering, |
| 2611 | + * shaping, or ligature substitution. |
| 2612 | + * @param frc the specified <code>FontRenderContext</code> |
| 2613 | + * @param chars the specified array of characters |
| 2614 | + * @return a new <code>GlyphVector</code> created with the |
| 2615 | + * specified array of characters and the specified |
| 2616 | + * <code>FontRenderContext</code>. |
| 2617 | + */ |
| 2618 | +publicGlyphVectorcreateGlyphVector(FontRenderContextfrc,char[]chars) |
| 2619 | + { |
| 2620 | +return (GlyphVector)newStandardGlyphVector(this,chars,frc); |
| 2621 | + } |
2713 | 2622 |
|
| 2623 | +/** |
| 2624 | + * Creates a {@link java.awt.font.GlyphVector GlyphVector} by |
| 2625 | + * mapping the specified characters to glyphs one-to-one based on the |
| 2626 | + * Unicode cmap in this <code>Font</code>. This method does no other |
| 2627 | + * processing besides the mapping of glyphs to characters. This |
| 2628 | + * means that this method is not useful for some scripts, such |
| 2629 | + * as Arabic, Hebrew, Thai, and Indic, that require reordering, |
| 2630 | + * shaping, or ligature substitution. |
| 2631 | + * @param frc the specified <code>FontRenderContext</code> |
| 2632 | + * @param ci the specified <code>CharacterIterator</code> |
| 2633 | + * @return a new <code>GlyphVector</code> created with the |
| 2634 | + * specified <code>CharacterIterator</code> and the specified |
| 2635 | + * <code>FontRenderContext</code>. |
| 2636 | + */ |
| 2637 | +publicGlyphVectorcreateGlyphVector(FontRenderContextfrc, |
| 2638 | +CharacterIteratorci) |
| 2639 | + { |
| 2640 | +return (GlyphVector)newStandardGlyphVector(this,ci,frc); |
| 2641 | + } |
| 2642 | + |
| 2643 | +/** |
| 2644 | + * Creates a {@link java.awt.font.GlyphVector GlyphVector} by |
| 2645 | + * mapping characters to glyphs one-to-one based on the |
| 2646 | + * Unicode cmap in this <code>Font</code>. This method does no other |
| 2647 | + * processing besides the mapping of glyphs to characters. This |
| 2648 | + * means that this method is not useful for some scripts, such |
| 2649 | + * as Arabic, Hebrew, Thai, and Indic, that require reordering, |
| 2650 | + * shaping, or ligature substitution. |
| 2651 | + * @param frc the specified <code>FontRenderContext</code> |
| 2652 | + * @param glyphCodes the specified integer array |
| 2653 | + * @return a new <code>GlyphVector</code> created with the |
| 2654 | + * specified integer array and the specified |
| 2655 | + * <code>FontRenderContext</code>. |
| 2656 | + */ |
| 2657 | +publicGlyphVectorcreateGlyphVector(FontRenderContextfrc, |
| 2658 | +int []glyphCodes) |
| 2659 | + { |
| 2660 | +return (GlyphVector)newStandardGlyphVector(this,glyphCodes,frc); |
| 2661 | + } |
| 2662 | + |
| 2663 | +/** |
| 2664 | + * Returns a new <code>GlyphVector</code> object, performing full |
| 2665 | + * layout of the text if possible. Full layout is required for |
| 2666 | + * complex text, such as Arabic or Hindi. Support for different |
| 2667 | + * scripts depends on the font and implementation. |
| 2668 | + * <p> |
| 2669 | + * Layout requires bidi analysis, as performed by |
| 2670 | + * <code>Bidi</code>, and should only be performed on text that |
| 2671 | + * has a uniform direction. The direction is indicated in the |
| 2672 | + * flags parameter,by using LAYOUT_RIGHT_TO_LEFT to indicate a |
| 2673 | + * right-to-left (Arabic and Hebrew) run direction, or |
| 2674 | + * LAYOUT_LEFT_TO_RIGHT to indicate a left-to-right (English) |
| 2675 | + * run direction. |
| 2676 | + * <p> |
| 2677 | + * In addition, some operations, such as Arabic shaping, require |
| 2678 | + * context, so that the characters at the start and limit can have |
| 2679 | + * the proper shapes. Sometimes the data in the buffer outside |
| 2680 | + * the provided range does not have valid data. The values |
| 2681 | + * LAYOUT_NO_START_CONTEXT and LAYOUT_NO_LIMIT_CONTEXT can be |
| 2682 | + * added to the flags parameter to indicate that the text before |
| 2683 | + * start, or after limit, respectively, should not be examined |
| 2684 | + * for context. |
| 2685 | + * <p> |
| 2686 | + * All other values for the flags parameter are reserved. |
| 2687 | + * |
| 2688 | + * @param frc the specified <code>FontRenderContext</code> |
| 2689 | + * @param text the text to layout |
| 2690 | + * @param start the start of the text to use for the <code>GlyphVector</code> |
| 2691 | + * @param limit the limit of the text to use for the <code>GlyphVector</code> |
| 2692 | + * @param flags control flags as described above |
| 2693 | + * @return a new <code>GlyphVector</code> representing the text between |
| 2694 | + * start and limit, with glyphs chosen and positioned so as to best represent |
| 2695 | + * the text |
| 2696 | + * @throws ArrayIndexOutOfBoundsException if start or limit is |
| 2697 | + * out of bounds |
| 2698 | + * @see java.text.Bidi |
| 2699 | + * @see #LAYOUT_LEFT_TO_RIGHT |
| 2700 | + * @see #LAYOUT_RIGHT_TO_LEFT |
| 2701 | + * @see #LAYOUT_NO_START_CONTEXT |
| 2702 | + * @see #LAYOUT_NO_LIMIT_CONTEXT |
| 2703 | + * @since 1.4 |
| 2704 | + */ |
| 2705 | +// public GlyphVector layoutGlyphVector(FontRenderContext frc, |
| 2706 | +// char[] text, |
| 2707 | +// int start, |
| 2708 | +// int limit, |
| 2709 | +// int flags) { |
| 2710 | +// |
| 2711 | +// GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines |
| 2712 | +// StandardGlyphVector gv = gl.layout(this, frc, text, |
| 2713 | +// start, limit-start, flags, null); |
| 2714 | +// GlyphLayout.done(gl); |
| 2715 | +// return gv; |
| 2716 | +// } |
| 2717 | +// |
2714 | 2718 | /** |
2715 | 2719 | * A flag to layoutGlyphVector indicating that text is left-to-right as |
2716 | 2720 | * determined by Bidi analysis. |
|