Examples of FontMetrics


Examples of org.gwt.mosaic.core.client.FontMetrics

   * Computes the global dialog base units.
   *
   * @return a DialogBaseUnits object used globally
   */
  private DialogBaseUnits computeGlobalDialogBaseUnits() {
    final FontMetrics metrics = new FontMetrics();
    DOM.setStyleAttribute(metrics.getElement(), "whiteSpace", "nowrap");
    final Dimension boxSize = metrics.stringBoxSize(averageCharWidthTestString);
    return new DialogBaseUnits(boxSize.width
        / averageCharWidthTestString.length(), boxSize.height);
  }
View Full Code Here

Examples of org.jfree.fonts.registry.FontMetrics

  {
    final FontSpecification fontSpecification =
        layoutContext.getFontSpecification();
    final OutputProcessorMetaData outputMetaData =
        layoutProcess.getOutputMetaData();
    final FontMetrics fontMetrics =
        outputMetaData.getFontMetrics(fontSpecification);
    return new VariableFontSizeProducer(fontMetrics);
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.fonts.registry.FontMetrics

      final StaticBoxLayoutProperties staticBoxLayoutProperties = writeContext.getStaticBoxLayoutProperties();
      long spaceWidth = staticBoxLayoutProperties.getSpaceWidth();
      if (spaceWidth == 0)
      {
        // Space has not been computed yet.
        final FontMetrics fontMetrics = metaData.getFontMetrics(writeContext.getStyleSheet());
        spaceWidth = fontMetrics.getCharWidth(' ');
        staticBoxLayoutProperties.setSpaceWidth(spaceWidth);
      }

      if ((next.getNodeType() & LayoutNodeTypes.MASK_BOX) == LayoutNodeTypes.MASK_BOX)
      {
View Full Code Here

Examples of org.pentaho.reporting.libraries.fonts.registry.FontMetrics

                                                    final boolean embedded,
                                                    final boolean antiAliasing) throws IllegalArgumentException
  {
    try
    {
      final FontMetrics metrics = super.getFontMetrics(fontFamily, fontSize, bold, italics, encoding, embedded,
          antiAliasing);
      if (metrics instanceof LegacyFontMetrics)
      {
        final LegacyFontMetrics lm = (LegacyFontMetrics) metrics;
        return (BaseFontFontMetrics) lm.getParent();
View Full Code Here

Examples of org.pentaho.reporting.libraries.fonts.registry.FontMetrics

    lookupKey.setFontFamily(fontFamily);
    lookupKey.setFontSize(fontSize);
    lookupKey.setBold(bold);
    lookupKey.setItalics(italics);

    final FontMetrics cached = (FontMetrics) fontMetricsCache.get(lookupKey);
    if (cached != null)
    {
      return cached;
    }

    final FontRegistry registry = getFontRegistry();
    FontFamily family = registry.getFontFamily(fontFamily);
    if (family == null)
    {
      AbstractOutputProcessorMetaData.logger.warn("Unable to lookup the font family: " + fontFamily);

      // Get the default font name
      final String fallBack = getNormalizedFontFamilyName(null);
      if (fallBack == null)
      {
        // If this case happens, the output-processor meta-data does not provide a sensible
        // fall-back value. As we cannot continue without a font, we fail here instead of
        // waiting for a NullPointer or other weird error later.
        throw new IllegalArgumentException("No default family defined, aborting.");
      }

      family = registry.getFontFamily(fallBack);
      if (family == null)
      {
        // If this case happens, the output-processor meta-data does not provide a sensible
        // fall-back value. As we cannot continue without a font, we fail here instead of
        // waiting for a NullPointer or other weird error later.
        throw new IllegalArgumentException("Default family is invalid. Aborting.");
      }
    }


    reusableFontContext.setAntiAliased(antiAliasing);
    reusableFontContext.setFontSize(fontSize);
    reusableFontContext.setEncoding(encoding);
    reusableFontContext.setEmbedded(embedded);

    final FontRecord record = family.getFontRecord(bold, italics);
    final FontMetrics fm = getFontStorage().getFontMetrics(record.getIdentifier(), reusableFontContext);
    if (fm == null)
    {
      // If this case happens, then the previous steps of mapping the font name into sensible
      // defaults failed. The font-system's font-registry is not in sync with the actual font-metrics
      // provider (which indicates that the LibFonts font-system implementation is invalid).
View Full Code Here

Examples of org.pentaho.reporting.libraries.fonts.registry.FontMetrics

    return fm;
  }

  public ExtendedBaselineInfo getBaselineInfo(final int codePoint, final StyleSheet styleSheet)
  {
    final FontMetrics fontMetrics = getFontMetrics(styleSheet);
    if (fontMetrics.isUniformFontMetrics())
    {
      final String fontFamily = getNormalizedFontFamilyName((String) styleSheet.getStyleProperty(TextStyleKeys.FONT));
      if (fontFamily == null)
      {
        // If this case happens, the stylesheet is not implemented correctly. At that point,
        // we have to assume that the whole engine is no longer behaving valid and therefore we
        // abort early.
        throw new IllegalArgumentException("No valid font family specified.");
      }

      final double fontSize = styleSheet.getDoubleStyleProperty
          (TextStyleKeys.FONTSIZE, defaultFontSize);

      final boolean antiAliasing = RenderUtility.isFontSmooth(styleSheet, this);
      final String encoding = (String) styleSheet.getStyleProperty(TextStyleKeys.FONTENCODING);
      final boolean embedded =
          isFeatureSupported(OutputProcessorFeature.EMBED_ALL_FONTS) ||
              styleSheet.getBooleanStyleProperty(TextStyleKeys.EMBEDDED_FONT);
      final boolean bold = styleSheet.getBooleanStyleProperty(TextStyleKeys.BOLD, false);
      final boolean italics = styleSheet.getBooleanStyleProperty(TextStyleKeys.ITALIC, false);

      lookupKey.setAntiAliased(antiAliasing);
      lookupKey.setEncoding(encoding);
      lookupKey.setEmbedded(embedded);
      lookupKey.setFontFamily(fontFamily);
      lookupKey.setFontSize(fontSize);
      lookupKey.setBold(bold);
      lookupKey.setItalics(italics);

      final ExtendedBaselineInfo cached = (ExtendedBaselineInfo) baselinesCache.get(lookupKey);
      if (cached != null)
      {
        return cached;
      }
    }
    final ExtendedBaselineInfo baselineInfo = TextUtility.createBaselineInfo('x', fontMetrics, null);
    if (fontMetrics.isUniformFontMetrics())
    {
      baselinesCache.put(new FontMetricsKey(lookupKey), baselineInfo);
    }
    return baselineInfo;
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.fonts.registry.FontMetrics

        isFeatureSupported(OutputProcessorFeature.EMBED_ALL_FONTS) ||
            styleSheet.getBooleanStyleProperty(TextStyleKeys.EMBEDDED_FONT);
    final boolean bold = styleSheet.getBooleanStyleProperty(TextStyleKeys.BOLD, false);
    final boolean italics = styleSheet.getBooleanStyleProperty(TextStyleKeys.ITALIC, false);

    final FontMetrics metrics = getFontMetrics(fontFamily, fontSize, bold, italics, encoding, embedded, antiAliasing);
    fontMetricsByStyleCache.put(key, new StyleCacheEntry(styleSheet.getChangeTracker(), metrics));
    return metrics;
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.fonts.registry.FontMetrics

                                                    final boolean embedded,
                                                    final boolean antiAliasing) throws IllegalArgumentException
  {
    try
    {
      final FontMetrics metrics = super.getFontMetrics(fontFamily, fontSize, bold, italics, encoding, embedded,
          antiAliasing);
      if (metrics instanceof LegacyFontMetrics)
      {
        final LegacyFontMetrics lm = (LegacyFontMetrics) metrics;
        return (BaseFontFontMetrics) lm.getParent();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.