Package org.pentaho.reporting.libraries.pixie.wmf

Examples of org.pentaho.reporting.libraries.pixie.wmf.MfLogFont


   */
  public void replay(final WmfFile file)
  {
    final Graphics2D graphics = file.getGraphics2D();
    final MfDcState state = file.getCurrentState();
    final MfLogFont lFont = state.getLogFont();

    state.prepareDrawText();
    final FontMetrics metrics = graphics.getFontMetrics();
    final int textWidth = metrics.stringWidth(text);
    final Point p = getScaledOrigin();
    final int x = p.x + calcDeltaX(state.getVerticalTextAlignment(), textWidth);
    int y = p.y + calcDeltaY(state.getHorizontalTextAlignment(), metrics);

    if (isOpaque() || state.getBkMode() != BrushConstants.TRANSPARENT)
    {
      final Rectangle background = new Rectangle(x, y - metrics.getAscent(), textWidth, metrics.getHeight());
      graphics.setColor(state.getBkColor());
      graphics.fill(background);
      graphics.setColor(state.getTextColor());
    }
    // System.out.println("X: " + x + " Y: " + p.y + " " + calcDeltaY(state.getHorizontalTextAlignment(), metrics));

    final Graphics2D g2 = (Graphics2D) graphics.create();
    g2.drawString(text, x, y);

    if (lFont.isUnderline())
    {  // Underline.
      y += metrics.getDescent() / 8 + 1;
      //state.prepareDraw();
      g2.setStroke(new BasicStroke(metrics.getHeight() / 14));
      g2.drawLine(x, y, x + textWidth, y);
      //state.postDraw();
    }
    if (lFont.isStrikeOut())
    {  // Underline.
      //state.prepareDraw();
      y -= metrics.getAscent() / 2.5 + 1;
      g2.setStroke(new BasicStroke(metrics.getHeight() / 14));
      g2.drawLine(x, y, x + textWidth, y);
View Full Code Here


   *
   * @param file the meta file.
   */
  public void replay(final WmfFile file)
  {
    final MfLogFont lfont = new MfLogFont();
    lfont.setFace(getFontFace());
    lfont.setSize(getScaledHeight());
    int style;
    // should be bold ?
    if (getWeight() > 650)
    {
      style = Font.BOLD;
    }
    else
    {
      style = Font.PLAIN;
    }
    if (isItalic())
    {
      style += Font.ITALIC;
    }
    lfont.setStyle(style);
    lfont.setUnderline(isUnderline());
    lfont.setStrikeOut(isStrikeout());
    lfont.setRotation(getEscapement() / 10);
    file.getCurrentState().setLogFont(lfont);
    file.storeObject(lfont);
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.pixie.wmf.MfLogFont

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.