Package org.jfree.layouting.layouter.context

Examples of org.jfree.layouting.layouter.context.FontSpecification


    LibLayoutBoot.getInstance().start();
    DefaultLayoutContext layoutContext =
            new DefaultLayoutContext
                    (new ContextId(0, 0,0), "Bah", "buh", null, new AttributeMap());
    layoutContext.getStyle().setValue(FontStyleKeys.FONT_FAMILY, new CSSConstant("helvetica"));
    final FontSpecification fontSpecification = layoutContext.getFontSpecification();
    fontSpecification.setFontFamily("Arial");
    fontSpecification.setFontSize(12);

    final FlowHtmlOutputProcessor out =
        new FlowHtmlOutputProcessor(LibLayoutBoot.getInstance().getGlobalConfig());
    final DefaultLayoutProcess layoutProcess = new DefaultLayoutProcess(out);
    TestRenderableTextFactory tr = new TestRenderableTextFactory(layoutProcess);
View Full Code Here


        (WhitespaceCollapse.PRESERVE.equals
            (context.getValue(TextStyleKeys.WHITE_SPACE_COLLAPSE)));
    staticBoxLayoutProperties.setDominantBaseline
        (context.getValue(LineStyleKeys.DOMINANT_BASELINE));

    final FontSpecification fontSpecification = context.getFontSpecification();
    final FontMetrics fontMetrics = metaData.getFontMetrics(fontSpecification);
    staticBoxLayoutProperties.setNominalBaselineInfo
        (TextUtility.createBaselineInfo('x', fontMetrics));

    final CSSValue widowsValue = context.getValue(PageStyleKeys.WIDOWS);
View Full Code Here

    if (context != null)
    {
      if (CSSNumericType.EM.equals(value.getType()))
      {
        final FontSpecification fspec =
            context.getFontSpecification();
        final double fontSize = fspec.getFontSize();
        return (fontSize * value.getValue());
      }
      if (CSSNumericType.EX.equals(value.getType()))
      {
        final FontSpecification fspec =
            context.getFontSpecification();
        final FontMetrics fontMetrics = metaData.getFontMetrics(fspec);
        if (fontMetrics == null)
        {
          final long fontSize = (long) (fspec.getFontSize() * DEFAULT_X_HEIGHT_FACTOR);
          return StrictGeomUtility.toExternalValue((long) (value.getValue() * fontSize));
        }
        else
        {
          return StrictGeomUtility.toExternalValue((long) (value.getValue() * fontMetrics.getXHeight()));
 
View Full Code Here

    if (context != null)
    {
      if (CSSNumericType.EM.equals(value.getType()))
      {
        final FontSpecification fspec =
            context.getFontSpecification();
        final double fontSize = fspec.getFontSize();
        return (long) (fontSize * internal);
      }
      if (CSSNumericType.EX.equals(value.getType()))
      {
        final FontSpecification fspec =
            context.getFontSpecification();
        final FontMetrics fontMetrics = metaData.getFontMetrics(fspec);
        if (fontMetrics == null)
        {
          final long fontSize = (long) (fspec.getFontSize() * DEFAULT_X_HEIGHT_FACTOR);
          return StrictGeomUtility.multiply (internal, fontSize);
        }
        else
        {
          return StrictGeomUtility.multiply (internal, fontMetrics.getXHeight());
View Full Code Here

    final long posX = renderableText.getX();
    final long posY = renderableText.getY();
    long runningPos = posX;

    final LayoutContext layoutContext = renderableText.getLayoutContext();
    final FontSpecification fontSpecification =
            layoutContext.getFontSpecification();

    int style = Font.PLAIN;
    if (fontSpecification.getFontWeight() > 400)
    {
      style |= Font.BOLD;
    }
    if (fontSpecification.isItalic() || fontSpecification.isOblique())
    {
      style |= Font.ITALIC;
    }

    final CSSColorValue cssColor = (CSSColorValue)
            layoutContext.getValue(ColorStyleKeys.COLOR);

    g2.setColor(cssColor);
    g2.setFont(new Font(fontSpecification.getFontFamily(), style, (int) fontSpecification.getFontSize()));

    final int length = renderableText.getOffset() + renderableText.getLength();
    for (int i = renderableText.getOffset(); i < length; i++)
    {
      final Glyph g = gs[i];
View Full Code Here

                      final StyleKey key)
  {
    // as this is an 'auto' handler, we can assume that 'auto' is the
    // current value
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final FontSpecification fs =
            layoutContext.getFontSpecification();
    final double threshold =
            process.getOutputMetaData().getNumericFeatureValue
            (OutputProcessorFeature.FONT_SMOOTH_THRESHOLD);
    if (fs.getFontSize() < threshold)
    {
      layoutContext.setValue(FontStyleKeys.X_FONT_SMOOTH_FLAG, FontSmooth.NEVER);
    }
    else
    {
View Full Code Here

      startText = false;
      produced = false;
    }

    // Todo: This is part of a cheap hack ..
    final FontSpecification fontSpecification =
        layoutContext.getFontSpecification();
    final OutputProcessorMetaData outputMetaData =
        layoutProcess.getOutputMetaData();
    fontMetrics = outputMetaData.getFontMetrics(fontSpecification);
View Full Code Here

  }

  protected FontSizeProducer createFontSizeProducer
      (final LayoutContext layoutContext)
  {
    final FontSpecification fontSpecification =
        layoutContext.getFontSpecification();
    final OutputProcessorMetaData outputMetaData =
        layoutProcess.getOutputMetaData();
    final FontMetrics fontMetrics =
        outputMetaData.getFontMetrics(fontSpecification);
View Full Code Here

                         final LayoutElement currentNode,
                         final StyleKey key)
  {
    //Log.debug ("Processing: " + currentNode);
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final FontSpecification fs =
            layoutContext.getFontSpecification();
    final OutputProcessorMetaData outputMetaData = process.getOutputMetaData();
    final CSSValue cssValue = layoutContext.getValue(key);
    if (cssValue instanceof CSSValueList)
    {

      final CSSValueList list = (CSSValueList) cssValue;
      for (int i = 0; i < list.getLength(); i++)
      {
        final CSSValue item = list.getItem(i);
        if (item instanceof CSSConstant)
        {
          final CSSConstant c = (CSSConstant) lookupValue((CSSConstant) item);
          final FontFamily family = outputMetaData.getFontFamilyForGenericName(c);
          fs.setFontFamily(family.getFamilyName());
          if (process.getOutputMetaData().isValid(fs))
          {
            return;
          }
          // Ignore, although this is not ok.
          DebugLog.log ("Invalid state after setting predefined font family.");
        }
        else if (item instanceof CSSStringValue)
        {
          final CSSStringValue sval = (CSSStringValue) item;
          final String fontName = sval.getValue();
          fs.setFontFamily(fontName);
          if (process.getOutputMetaData().isValid(fs))
          {
            return;
          }
        }
      }
    }
    else if (cssValue instanceof CSSConstant)
    {
      if (FontFamilyValues.NONE.equals(cssValue))
      {
        fs.setFontFamily(null);
        return;
      }
    }

    final FontFamily family = outputMetaData.getDefaultFontFamily();
    fs.setFontFamily(family.getFamilyName());
    if (process.getOutputMetaData().isValid(fs) == false)
    {
      throw new IllegalStateException
              ("Invalid state after setting the default font family.");
    }
View Full Code Here

      // this is either the logical page box or one of the direct anchestors
      // of said box.
      return;
    }

    final FontSpecification fs = layoutContext.getFontSpecification();
    final double fontSize = fs.getFontSize();
    builder.append(FontStyleKeys.FONT_SIZE, toPointString(fontSize), "pt");
    builder.append(FontStyleKeys.FONT_FAMILY, fs.getFontFamily());
    builder.append(FontStyleKeys.FONT_WEIGHT,
        layoutContext.getValue(FontStyleKeys.FONT_WEIGHT));
    builder.append(FontStyleKeys.FONT_STYLE,
        layoutContext.getValue(FontStyleKeys.FONT_STYLE));
    builder.append(TextStyleKeys.TEXT_ALIGN, layoutContext.getValue(TextStyleKeys.TEXT_ALIGN));
View Full Code Here

TOP

Related Classes of org.jfree.layouting.layouter.context.FontSpecification

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.