103 if (!useGDITextLayout) {
104 if (textLayoutStr.equalsIgnoreCase("prefer")) {
105 useGDITextLayout = true;
106 preferGDITextLayout = true;
107 }
108 }
109 }
110 }
111
112 WPathGraphics(Graphics2D graphics, PrinterJob printerJob,
113 Printable painter, PageFormat pageFormat, int pageIndex,
114 boolean canRedraw) {
115 super(graphics, printerJob, painter, pageFormat, pageIndex, canRedraw);
116 }
117
118 /**
119 * Creates a new <code>Graphics</code> object that is
120 * a copy of this <code>Graphics</code> object.
121 * @return a new graphics context that is a copy of
122 * this graphics context.
123 * @since JDK1.0
124 */
125 @Override
126 public Graphics create() {
127
128 return new WPathGraphics((Graphics2D) getDelegate().create(),
129 getPrinterJob(),
130 getPrintable(),
131 getPageFormat(),
132 getPageIndex(),
133 canDoRedraws());
134 }
135
136 /**
137 * Strokes the outline of a Shape using the settings of the current
138 * graphics state. The rendering attributes applied include the
139 * clip, transform, paint or color, composite and stroke attributes.
140 * @param s The shape to be drawn.
141 * @see #setStroke
142 * @see #setPaint
143 * @see java.awt.Graphics#setColor
236 }
237
238 /* The stroke in effect was not a BasicStroke so we
239 * will not try to enforce a minimum line width.
240 */
241 } else {
242 super.draw(s);
243 }
244 }
245
246 /**
247 * Draws the text given by the specified string, using this
248 * graphics context's current font and color. The baseline of the
249 * first character is at position (<i>x</i>, <i>y</i>) in this
250 * graphics context's coordinate system.
251 * @param str the string to be drawn.
252 * @param x the <i>x</i> coordinate.
253 * @param y the <i>y</i> coordinate.
254 * @see java.awt.Graphics#drawBytes
255 * @see java.awt.Graphics#drawChars
256 * @since JDK1.0
257 */
258 @Override
259 public void drawString(String str, int x, int y) {
260 drawString(str, (float) x, (float) y);
261 }
262
263 @Override
264 public void drawString(String str, float x, float y) {
265 drawString(str, x, y, getFont(), getFontRenderContext(), 0f);
266 }
267
268 /* A return value of 0 would mean font not available to GDI, or the
269 * it can't be used for this string.
270 * A return of 1 means it is suitable, including for composites.
271 * We check that the transform in effect is doable with GDI, and that
272 * this is a composite font AWT can handle, or a physical font GDI
273 * can handle directly. Its possible that some strings may ultimately
274 * fail the more stringent tests in drawString but this is rare and
275 * also that method will always succeed, as if the font isn't available
276 * it will use outlines via a superclass call. Also it is only called for
|
103 if (!useGDITextLayout) {
104 if (textLayoutStr.equalsIgnoreCase("prefer")) {
105 useGDITextLayout = true;
106 preferGDITextLayout = true;
107 }
108 }
109 }
110 }
111
112 WPathGraphics(Graphics2D graphics, PrinterJob printerJob,
113 Printable painter, PageFormat pageFormat, int pageIndex,
114 boolean canRedraw) {
115 super(graphics, printerJob, painter, pageFormat, pageIndex, canRedraw);
116 }
117
118 /**
119 * Creates a new <code>Graphics</code> object that is
120 * a copy of this <code>Graphics</code> object.
121 * @return a new graphics context that is a copy of
122 * this graphics context.
123 * @since 1.0
124 */
125 @Override
126 public Graphics create() {
127
128 return new WPathGraphics((Graphics2D) getDelegate().create(),
129 getPrinterJob(),
130 getPrintable(),
131 getPageFormat(),
132 getPageIndex(),
133 canDoRedraws());
134 }
135
136 /**
137 * Strokes the outline of a Shape using the settings of the current
138 * graphics state. The rendering attributes applied include the
139 * clip, transform, paint or color, composite and stroke attributes.
140 * @param s The shape to be drawn.
141 * @see #setStroke
142 * @see #setPaint
143 * @see java.awt.Graphics#setColor
236 }
237
238 /* The stroke in effect was not a BasicStroke so we
239 * will not try to enforce a minimum line width.
240 */
241 } else {
242 super.draw(s);
243 }
244 }
245
246 /**
247 * Draws the text given by the specified string, using this
248 * graphics context's current font and color. The baseline of the
249 * first character is at position (<i>x</i>, <i>y</i>) in this
250 * graphics context's coordinate system.
251 * @param str the string to be drawn.
252 * @param x the <i>x</i> coordinate.
253 * @param y the <i>y</i> coordinate.
254 * @see java.awt.Graphics#drawBytes
255 * @see java.awt.Graphics#drawChars
256 * @since 1.0
257 */
258 @Override
259 public void drawString(String str, int x, int y) {
260 drawString(str, (float) x, (float) y);
261 }
262
263 @Override
264 public void drawString(String str, float x, float y) {
265 drawString(str, x, y, getFont(), getFontRenderContext(), 0f);
266 }
267
268 /* A return value of 0 would mean font not available to GDI, or the
269 * it can't be used for this string.
270 * A return of 1 means it is suitable, including for composites.
271 * We check that the transform in effect is doable with GDI, and that
272 * this is a composite font AWT can handle, or a physical font GDI
273 * can handle directly. Its possible that some strings may ultimately
274 * fail the more stringent tests in drawString but this is rare and
275 * also that method will always succeed, as if the font isn't available
276 * it will use outlines via a superclass call. Also it is only called for
|