Package org.jfree.fonts.registry

Examples of org.jfree.fonts.registry.FontMetrics


            (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);
    staticBoxLayoutProperties.setWidows(Math.max(1, (int)
View Full Code Here


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

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

    }

    final double adjustFactor = nval.getValue();
    final FontSpecification fontSpecification =
        currentNode.getLayoutContext().getFontSpecification();
    final FontMetrics fontMetrics =
        process.getOutputMetaData().getFontMetrics(fontSpecification);
    if (fontMetrics == null)
    {
      return; // no font metrics means no valid font...
    }

    final double actualFontXHeight = fontMetrics.getXHeight();

    final double fontSize = fontSpecification.getFontSize();
    final double aspectRatio = actualFontXHeight / fontSize;
    final double result = (fontSize * (adjustFactor / aspectRatio));
    fontSpecification.setFontSize(result);
View Full Code Here

    // Percentages get resolved against the width of a standard space (0x20)
    // character.
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final FontSpecification fontSpecification =
            layoutContext.getFontSpecification();
    final FontMetrics fm = process.getOutputMetaData().getFontMetrics(fontSpecification);
    if (fm == null)
    {
      // we have no font family, so return.
      layoutContext.setValue(TextStyleKeys.X_MIN_LETTER_SPACING, CSSNumericValue.ZERO_LENGTH);
      layoutContext.setValue(TextStyleKeys.X_MAX_LETTER_SPACING, CSSNumericValue.ZERO_LENGTH);
      layoutContext.setValue(TextStyleKeys.X_OPTIMUM_LETTER_SPACING, CSSNumericValue.ZERO_LENGTH);
      return;
    }

    final double width = fm.getCharWidth(0x20);
    final CSSNumericValue percentageBase =
            CSSNumericValue.createValue(CSSNumericType.PT, width);
    final CSSNumericValue min = CSSValueResolverUtility.getLength
            (resolveValue(layoutContext, TextStyleKeys.X_MIN_LETTER_SPACING), percentageBase);
    final CSSNumericValue max = CSSValueResolverUtility.getLength
View Full Code Here

    // Percentages get resolved against the width of a standard space (0x20)
    // character.
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final FontSpecification fontSpecification =
            layoutContext.getFontSpecification();
    final FontMetrics fm = process.getOutputMetaData().getFontMetrics(fontSpecification);
    if (fm == null)
    {
      CSSValue value = layoutContext.getValue(FontStyleKeys.FONT_FAMILY);
      Log.warn ("FontFamily is " + value + " but has not been set?" + currentNode);
      return;
    }
    final double width = fm.getCharWidth(0x20);
    final CSSNumericValue percentageBase =
            CSSNumericValue.createValue(CSSNumericType.PT, width);
    final CSSNumericValue min = CSSValueResolverUtility.getLength
            (resolveValue(layoutContext, TextStyleKeys.X_MIN_WORD_SPACING), percentageBase);
    final CSSNumericValue max = CSSValueResolverUtility.getLength
View Full Code Here

    final OutputProcessorMetaData outputMetaData =

        layoutProcess.getOutputMetaData();

    final FontMetrics fontMetrics =

        outputMetaData.getFontMetrics(fontSpecification);

    return new VariableFontSizeProducer(fontMetrics);
View Full Code Here

TOP

Related Classes of org.jfree.fonts.registry.FontMetrics

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.