set some default rendering hints, like text antialiasing on

@param g2D the graphics object to set the defaults on
768379
protected void setPaintDefaults(Graphics2D g2D){
		g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
				RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
		g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);

		g2D.setFont(seqFont);
	}
816921
@Override
    protected void paintComponent(Graphics g) {
        if (!isInitialized()) {
            return;
        }

        final Graphics2D G2 = (Graphics2D) g.create();

        CENTER.setLocation(getGaugeBounds().getCenterX(), getGaugeBounds().getCenterY());

        G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
        G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
        G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

        // Translate the coordinate system related to insets
        G2.translate(getFramelessOffset().getX(), getFramelessOffset().getY());

        final AffineTransform OLD_TRANSFORM = G2.getTransform();

        // Draw the frame
        if (isFrameVisible()) {
            G2.drawImage(frameImage, 0, 0, null);
        }

        // Draw the background
        if (isBackgroundVisible()) {
            G2.drawImage(backgroundImage, 0, 0, null);
        }

        // Draw the tickmarks
        if (rotateTickmarks) {
            G2.rotate(-rotationAngle, CENTER.getX(), CENTER.getY());
            G2.drawImage(tickmarksImage, 0, 0, null);
            G2.setTransform(OLD_TRANSFORM);
        } else {
            G2.drawImage(tickmarksImage, 0, 0, null);
        }

        // Draw plane
        if (!rotateTickmarks) {
            G2.rotate(rotationAngle, CENTER.getX(), CENTER.getY());
            G2.drawImage(planeImage, 0, 0, null);
            G2.setTransform(OLD_TRANSFORM);
        } else {
            G2.drawImage(planeImage, 0, 0, null);
        }

        // Draw foreground
        if (isForegroundVisible()) {
            G2.drawImage(foregroundImage, 0, 0, null);
        }

        if (!isEnabled()) {
            G2.drawImage(disabledImage, 0, 0, null);
        }

        // Translate coordinate system back to original
        G2.translate(-getInnerBounds().x, -getInnerBounds().y);

        G2.dispose();
    }
791092
private void initGraphics() {
        if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
            Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
            if (getPrefWidth() > 0 && getPrefHeight() > 0) {
                setPrefSize(getPrefWidth(), getPrefHeight());
            } else {
                setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); // 11x7
            }
        }

        state = State.CONSTANT;

        triangle = new Path();
        triangle.setStroke(null);
        triangle.setFill(state.color);
        triangle.setRotate(state.angle);

        nameText = new Text(getName());
        nameText.setTextOrigin(VPos.TOP);

        valueText = new Text(String.format(locale, formatString, getValue()));
        valueText.setTextOrigin(VPos.TOP);

        separator = new Line();

        pane = new Pane(triangle, nameText, valueText, separator);
        pane.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));

        getChildren().setAll(pane);
    }
118960
function( gl, v, renderer ) {

			var n = v.length,
				units = allocTexUnits( renderer, n );

			gl.uniform1iv( this.addr, units );

			for ( var i = 0; i !== n; ++ i ) {

				renderer.setTexture2D( v[ i ] || emptyTexture, units[ i ] );

			}

		}
909867
public GVRRenderData setDrawMode(int drawMode) {
        if (drawMode != GL_POINTS && drawMode != GL_LINES
                && drawMode != GL_LINE_STRIP && drawMode != GL_LINE_LOOP
                && drawMode != GL_TRIANGLES && drawMode != GL_TRIANGLE_STRIP
                && drawMode != GL_TRIANGLE_FAN) {
            throw new IllegalArgumentException(
                    "drawMode must be one of GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLES, GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP.");
        }
        NativeRenderData.setDrawMode(getNative(), drawMode);
        return this;
    }
845064
protected boolean drawImage(Graphics2D g)
    {
        int ofs = getFirstInlineBoxBaseline();
        if (ofs == -1)
            ofs = ctx.getBaselineOffset(); //use the font baseline
        int x = (int) Math.round(getAbsoluteContentX() - 0.5 * ctx.getEm());
        int y = getAbsoluteContentY() + ofs;
        Image img = image.getImage();
        if (img != null)
        {
            int w = img.getWidth(image);
            int h = img.getHeight(image);
            g.drawImage(img, x - w, y - h, image);
            return true;
        }
        else
            return false; //could not decode the image
    }
136672
public static void optimizeGraphicsSpeed(Graphics2D g)
    {
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
        g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
        g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED);
        g.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
        g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
        g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
        g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
        g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
    }
803421
public void render(Graphics g) {
		// last list generation
		if (list == -1) {
			list = GL.glGenLists(1);
			GL.glNewList(list, SGL.GL_COMPILE);
				render(g, diagram);
			GL.glEndList();
		}
		
		GL.glCallList(list);
		
		TextureImpl.bindNone();
	}
437924
@Override
    protected void paintComponent(Graphics g) {
        if (img != null) {
            setOpaque(false);
            Map<RenderingHints.Key, Object> hints = new HashMap<RenderingHints.Key, Object>();
            hints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
            hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
            hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            ((Graphics2D) g).addRenderingHints(hints);
            g.drawImage(img, 0, 0, 
                    (int)(DisplayUtils.getScaledSize(img.getWidth()) * scale),
                    (int)(DisplayUtils.getScaledSize(img.getHeight()) * scale), null);
        }
        
        super.paintComponent(g);
    }
910697
public void enableTexture(GL2 gl) {
        if( texture != null ) {
            texture.enable(gl);
            texture.bind(gl);
        }
    }
1243362
@Override
    protected void paintComponent(Graphics g) {
        if (!isInitialized()) {
            return;
        }

        final Graphics2D G2 = (Graphics2D) g.create();

        G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
        G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
        G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

        // Translate coordinate system related to insets
        G2.translate(getFramelessOffset().getX(), getFramelessOffset().getY());

        // Draw combined background image
        G2.drawImage(bImage, 0, 0, null);

        // Draw an Arc2d object that will visualize the range of measured values
        if (isRangeOfMeasuredValuesVisible()) {
            G2.setPaint(getModel().getRangeOfMeasuredValuesPaint());
            if (getGaugeType() == GaugeType.TYPE3 || getGaugeType() == GaugeType.TYPE4) {
                final Area area = new Area(getModel().getRadialShapeOfMeasuredValues());
                area.subtract(new Area(LCD));
                G2.fill(area);
            } else {
                G2.fill(getModel().getRadialShapeOfMeasuredValues());
            }
        }

        // Draw LED if enabled
        if (isLedVisible()) {
            G2.drawImage(getCurrentLedImage(), (int) (getGaugeBounds().width * getLedPosition().getX()), (int) (getGaugeBounds().height * getLedPosition().getY()), null);
        }

        // Draw user LED if enabled
        if (isUserLedVisible()) {
            G2.drawImage(getCurrentUserLedImage(), (int) (getGaugeBounds().width * getUserLedPosition().getX()), (int) (getGaugeBounds().height * getUserLedPosition().getY()), null);
        }

        // Draw LCD display
        if (isLcdVisible()) {
            if (getLcdColor() == LcdColor.CUSTOM) {
                G2.setColor(getCustomLcdForeground());
            } else {
                G2.setColor(getLcdColor().TEXT_COLOR);
            }
            G2.setFont(getLcdUnitFont());
            if (isLcdTextVisible()) {
            final double UNIT_STRING_WIDTH;
            if (isLcdUnitStringVisible()) {
                unitLayout = new TextLayout(getLcdUnitString(), G2.getFont(), RENDER_CONTEXT);
                UNIT_BOUNDARY.setFrame(unitLayout.getBounds());
                G2.drawString(getLcdUnitString(), (int) (LCD.getX() + (LCD.getWidth() - UNIT_BOUNDARY.getWidth()) - LCD.getWidth() * 0.03), (int) (LCD.getY() + LCD.getHeight() * 0.76));
                UNIT_STRING_WIDTH = UNIT_BOUNDARY.getWidth();
            } else {
                UNIT_STRING_WIDTH = 0;
            }
            G2.setFont(getLcdValueFont());
            switch (getModel().getNumberSystem()) {
                case HEX:
                    valueLayout = new TextLayout(Integer.toHexString((int) getLcdValue()).toUpperCase(), G2.getFont(), RENDER_CONTEXT);
                    VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
                    G2.drawString(Integer.toHexString((int) getLcdValue()).toUpperCase(), (int) (LCD.getX() + (LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09), (int) (LCD.getY() + LCD.getHeight() * 0.76));
                    break;

                case OCT:
                    valueLayout = new TextLayout(Integer.toOctalString((int) getLcdValue()), G2.getFont(), RENDER_CONTEXT);
                    VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
                    G2.drawString(Integer.toOctalString((int) getLcdValue()), (int) (LCD.getX() + (LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09), (int) (LCD.getY() + LCD.getHeight() * 0.76));
                    break;

                case DEC:

                default:
                    valueLayout = new TextLayout(formatLcdValue(getLcdValue()), G2.getFont(), RENDER_CONTEXT);
                    VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
                    G2.drawString(formatLcdValue(getLcdValue()), (int) (LCD.getX() + (LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09), (int) (LCD.getY() + LCD.getHeight() * 0.76));
                    break;
            }
            }
            // Draw lcd info string
            if (!getLcdInfoString().isEmpty()) {
                G2.setFont(getLcdInfoFont());
                infoLayout = new TextLayout(getLcdInfoString(), G2.getFont(), RENDER_CONTEXT);
                INFO_BOUNDARY.setFrame(infoLayout.getBounds());
                G2.drawString(getLcdInfoString(), LCD.getBounds().x + 5, LCD.getBounds().y + (int) INFO_BOUNDARY.getHeight() + 5);
            }

            // Draw lcd threshold indicator
            if (getLcdNumberSystem() == NumberSystem.DEC && isLcdThresholdVisible() && getLcdValue() >= getLcdThreshold()) {
                G2.drawImage(lcdThresholdImage, (int) (LCD.getX() + LCD.getHeight() * 0.0568181818), (int) (LCD.getY() + LCD.getHeight() - lcdThresholdImage.getHeight() - LCD.getHeight() * 0.0568181818), null);
            }
        }

        // Draw the active leds in dependence on the current value
        final AffineTransform OLD_TRANSFORM = G2.getTransform();

        final double ACTIVE_LED_ANGLE;
        if (!isLogScale()) {
            ACTIVE_LED_ANGLE = getAngleForValue(getValue());
        } else {
            ACTIVE_LED_ANGLE = Math.toDegrees(UTIL.logOfBase(BASE, getValue() - getMinValue()) * getLogAngleStep());
        }

        if (!getModel().isSingleLedBargraphEnabled()) {
            for (double angle = 0; Double.compare(angle, ACTIVE_LED_ANGLE) <= 0; angle += 5.0) {
                G2.rotate(Math.toRadians(angle + getModel().getBargraphOffset()), CENTER.getX(), CENTER.getY());
                // If sections visible, color the bargraph with the given section colors
                G2.setPaint(ledGradient);
                if (isSectionsVisible()) {
                    // Use defined bargraphColor in areas where no section is defined
                    for (Section section : getSections()) {
                        if (Double.compare(angle, sectionAngles.get(section).getX()) >= 0 && angle < sectionAngles.get(section).getY()) {
                            G2.setPaint(sectionGradients.get(section));
                            break;
                        }
                    }
                } else {
                    G2.setPaint(ledGradient);
                }
                G2.fill(led);
                G2.setTransform(OLD_TRANSFORM);
            }
        } else {   // Draw only one led instead of all active leds
            final double ANGLE = Math.toRadians(((getValue() - getMinValue()) / (getMaxValue() - getMinValue())) * getModel().getApexAngle());
            G2.rotate(ANGLE, CENTER.getX(), CENTER.getY());
            if (isSectionsVisible()) {
                for (Section section : getSections()) {
                    if (Double.compare(ANGLE, sectionAngles.get(section).getX()) >= 0 && ANGLE < sectionAngles.get(section).getY()) {
                        G2.setPaint(sectionGradients.get(section));
                        break;
                    }
                }
            } else {
                G2.setPaint(ledGradient);
            }
            G2.fill(led);
            G2.setTransform(OLD_TRANSFORM);
        }

        // Draw peak value if enabled
        if (isPeakValueEnabled() && isPeakValueVisible()) {
            G2.rotate(Math.toRadians(((getPeakValue() - getMinValue()) / (getMaxValue() - getMinValue())) * getModel().getApexAngle() + getModel().getBargraphOffset()), CENTER.getX(), CENTER.getY());
            G2.fill(led);
            G2.setTransform(OLD_TRANSFORM);
        }

        // Draw the foreground
        if (isForegroundVisible()) {
            G2.drawImage(fImage, 0, 0, null);
        }

        // Draw glow indicator
        if (isGlowVisible()) {
            if (isGlowing()) {
                G2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getGlowAlpha()));
                G2.drawImage(glowImageOn, 0, 0, null);
                G2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f));
            } else
            {
                G2.drawImage(glowImageOff, 0, 0, null);
            }
        }

        if (!isEnabled()) {
            G2.drawImage(disabledImage, 0, 0, null);
        }

        G2.dispose();
    }
293619
void prepareFill(Graphics2D gfx) {
    if (fillGradient != null) gfx.setPaint(fillGradient.paint);
    else if (fillPattern != null) gfx.setPaint(fillPattern.paint);
    else gfx.setPaint(convertColor(fillColor));
    clipper.setClip(gfx);
    gfx.setComposite(convertComposite(composite, alpha));
  }
755727
public double render(Graphics2D g2) {
		double labelSize = (double)getMetrics().getTextFontWidth(ScoreElements.PART_LABEL, getText());
		Font previousFont = g2.getFont();
		Color previousColor = g2.getColor();
		setColor(g2, ScoreElements.PART_LABEL);
		Rectangle2D bb = getBoundingBox();
		g2.setFont(getTemplate().getTextFont(ScoreElements.PART_LABEL));
		float descent = g2.getFont().getLineMetrics(getText(), g2.getFontRenderContext())
			.getDescent();
		g2.drawString(getText(), (int)(bb.getCenterX() - labelSize/2),
				(int)(bb.getY() + bb.getHeight() - descent));
		g2.setFont(previousFont);
		g2.draw(bb);
		g2.setColor(previousColor);
		return getWidth();
	}
441512
public void setColor(Color c) {
		boolean renderAgain = (c != m_color) && isRendered();
		m_color = c;
		if (renderAgain)
			render(g2d);
	}
542505
@Override
    protected void paintComponent(Graphics g) {
        if (!isInitialized()) {
            return;
        }

        final Graphics2D G2 = (Graphics2D) g.create();

        G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
        G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
        G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

        // Translate the coordinate system related to insets
        G2.translate(getFramelessOffset().getX(), getFramelessOffset().getY());

        final AffineTransform OLD_TRANSFORM = G2.getTransform();

        // Draw combined background image
        G2.drawImage(bImage, 0, 0, null);

        // Draw blips
        G2.setColor(BLIP_TEXT_COLOR);
        G2.setFont(BLIP_FONT);
        for (Poi poi : blips.values()) {
            if (poi.distanceTo(MY_LOCATION) < this.range) {
                G2.drawImage(poi.getPoiImage(), (int) (CENTER.getX() - poi.getPoiImage().getWidth() / 2.0 + (poi.getLocationXY().getX() - CENTER_XY.getX()) / pixelScaleX), (int) (CENTER.getY() - poi.getPoiImage().getWidth() / 2.0 + (poi.getLocationXY().getY() - CENTER_XY.getY()) / pixelScaleY), null);
                G2.drawString(poi.getName(), (int) (CENTER.getX() - poi.getPoiImage().getWidth() + (poi.getLocationXY().getX() - CENTER_XY.getX()) / pixelScaleX), (int) (CENTER.getY() - poi.getPoiImage().getWidth() + (poi.getLocationXY().getY() - CENTER_XY.getY()) / pixelScaleY));
            }
        }

        // Draw the beam
        G2.rotate(rotationAngle, CENTER.getX(), CENTER.getY());
        G2.drawImage(beamImage, 0, 0, null);
        G2.setTransform(OLD_TRANSFORM);

        G2.rotate(Math.toRadians(-135) + rotationAngle, CENTER.getX(), CENTER.getY());
        G2.setColor(BEAM_COLOR);
        G2.draw(BEAM);
        G2.setTransform(OLD_TRANSFORM);

        if (!isEnabled()) {
            G2.drawImage(disabledImage, 0, 0, null);
        }

        G2.dispose();
    }
508461
public static void setDefaults() {

        lineColor = Color.BLACK;
        fontColor=Color.WHITE;
        backgroundColor=Color.BLACK;
        lineWidth = 1f;
        fontSizeDp=32;
        DEBUG=false;
        DEBUG2=false;
    }
1075179
public double render(Graphics2D g2) {
		Font previousFont = g2.getFont();
		Color previousColor = g2.getColor();

		Font font = getTemplate().getTextFont(m_textField);
		g2.setFont(font);
		setColor(g2, m_textField);
		LineMetrics lineMetrics = font.getLineMetrics(getText(), g2.getFontRenderContext());
		float leading = (float) Math.ceil(Math.max(lineMetrics.getLeading(), lineMetrics.getDescent()));
		//System.out.println("leading "+getText()+" = "+leading);

		//music font for sharp and flats
		Font musicFont;
		try {
			musicFont = getMusicalFont().getFont();
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		musicFont = musicFont.deriveFont(font.getSize()*3f);
		//sharp and natural are translated up a little :)
		AffineTransform at = AffineTransform.getTranslateInstance(0, -font.getSize()/2.5);
		Font musicFontSharp = musicFont.deriveFont(at);
		at = AffineTransform.getTranslateInstance(0, -font.getSize()/3);
		Font musicFontNatural = musicFont.deriveFont(at);
		
		char sharp = getMusicalFont().getAccidental(Accidental.SHARP);
		char flat = getMusicalFont().getAccidental(Accidental.FLAT);
		char natural = getMusicalFont().getAccidental(Accidental.NATURAL);
		char double_flat = getMusicalFont().getAccidental(Accidental.DOUBLE_FLAT);
		char double_sharp = getMusicalFont().getAccidental(Accidental.DOUBLE_SHARP);
		
		String[] lines = getTextLines();
		double line_height = getOneLineHeight();
		for (int line_count = 0; line_count < lines.length; line_count++) {
			String text = lines[line_count].replace(Chord.UNICODE_SHARP, sharp)
				.replace(Chord.UNICODE_FLAT, flat)
				.replace(Chord.UNICODE_NATURAL, natural)
				.replaceAll("\\(b\\)", flat+"")
				.replaceAll("\\(bb\\)", double_flat+"")
				.replaceAll("\\(#\\)", sharp+"")
				.replaceAll("\\(##\\)", double_sharp+"")
				.replaceAll("\\(\\=\\)", natural+"");
			if (text.length() == 0)
				continue;
			
			AttributedString as = new AttributedString(text);
			as.addAttributes(font.getAttributes(), 0, text.length());
			int begin = -1;
			for (int i = 0; i < text.length(); i++) {
				char charAtI = text.charAt(i);
				if (begin == -1)
					begin = i;
				if ((charAtI == sharp) || (charAtI == flat) || (charAtI == natural)) {
					if (begin != i) {
						as.addAttribute(TextAttribute.FONT, font, begin, i);
					}
					as.addAttribute(TextAttribute.FONT,
							charAtI==flat?musicFont
								:(charAtI==sharp?musicFontSharp
												:musicFontNatural),
							i, i+1);
					begin = -1;
				}
			}
			if (begin != -1) {
				as.addAttributes(font.getAttributes(), begin, text.length());
			}
			//end of flat/sharp replacement

			Map attrib = getTemplate().getTextAttributes(m_textField);
			if (attrib != null) {
                for (Object o : attrib.keySet()) {
                    Attribute ta = (Attribute) o;
                    as.addAttribute(ta, attrib.get(ta));
                }
			}
			if (getTextJustification() == TextJustification.JUSTIFIED) {
				as.addAttribute(TextAttribute.JUSTIFICATION, TextAttribute.JUSTIFICATION_FULL);
			}
			
			double x = getBase().getX();
			double y = getBase().getY();
			Rectangle2D box = getBoundingBox();
			
			switch(getTextJustification()) {
			case TextJustification.CENTER:
				x -= box.getWidth()/2; break;
			case TextJustification.RIGHT:
				x -= box.getWidth(); break;
			}
			y = box.getMinY() + line_height;
			
			g2.drawString(as.getIterator(),
					(float) x,
					(float) (y-leading + line_count*line_height));
		}
		
		g2.setFont(previousFont);
		g2.setColor(previousColor);
		
		//renderDebugBoundingBox(g2);
		return getWidth();
	}