List of usage examples for java.awt.font TextAttribute WEIGHT_DEMIBOLD
Float WEIGHT_DEMIBOLD
To view the source code for java.awt.font TextAttribute WEIGHT_DEMIBOLD.
Click Source Link
From source file:org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.internal.PdfLogicalPageDrawable.java
private PdfTextSpec computeFont(final RichTextSpec.StyledChunk c) { final StyleSheet layoutContext = c.getStyleSheet(); final PdfGraphics2D g2 = (PdfGraphics2D) getGraphics(); final PdfContentByte cb = g2.getRawContentByte(); final TypedMapWrapper<Attribute, Object> attributes = new TypedMapWrapper<Attribute, Object>( c.getAttributes());//from w w w .jav a 2s . c o m final String fontName = attributes.get(TextAttribute.FAMILY, String.class); final Number fontSize = attributes.get(TextAttribute.SIZE, 10f, Number.class); final String encoding = (String) layoutContext.getStyleProperty(TextStyleKeys.FONTENCODING); final boolean embed = globalEmbed || layoutContext.getBooleanStyleProperty(TextStyleKeys.EMBEDDED_FONT); final Float weightRaw = attributes.get(TextAttribute.WEIGHT, TextAttribute.WEIGHT_REGULAR, Float.class); final Float italicsRaw = attributes.get(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE, Float.class); final BaseFontFontMetrics fontMetrics = getMetaData().getBaseFontFontMetrics(fontName, fontSize.doubleValue(), weightRaw >= TextAttribute.WEIGHT_DEMIBOLD, italicsRaw >= TextAttribute.POSTURE_OBLIQUE, encoding, embed, false); return new PdfTextSpec(layoutContext, getMetaData(), g2, fontMetrics, cb); }
From source file:org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.internal.PdfLogicalPageDrawable.java
private int computeStyle(final TypedMapWrapper<Attribute, Object> attributes, final PdfTextSpec pdfTextSpec) { final Float weight = attributes.get(TextAttribute.WEIGHT, TextAttribute.WEIGHT_REGULAR, Float.class); final Float italics = attributes.get(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE, Float.class); final boolean underlined = attributes.exists(TextAttribute.UNDERLINE); final boolean strikethrough = attributes.exists(TextAttribute.STRIKETHROUGH); FontNativeContext nativeContext = pdfTextSpec.getFontMetrics().getNativeContext(); int style = 0; if (nativeContext.isNativeBold() == false && weight >= TextAttribute.WEIGHT_DEMIBOLD) { style |= Font.BOLD;/*from w w w . j av a 2 s .c o m*/ } if (nativeContext.isNativeItalics() == false && italics >= TextAttribute.POSTURE_OBLIQUE) { style |= Font.ITALIC; } if (underlined) { style |= Font.UNDERLINE; } if (strikethrough) { style |= Font.STRIKETHRU; } return style; }