Class FontTextShaperBuilder

java.lang.Object
de.xima.fc.common.text.shape.FontTextShaperBuilder

public final class FontTextShaperBuilder extends Object
A builder for a ITextShaper that uses an Aspose text shaper to measure text.

Harfbuzz to measure text.

Since:
8.4.0
  • Method Details

    • buildThreadSafe

      public ITextShaper buildThreadSafe()
      Creates a new shaper with the current settings.
      Returns:
      A new shaper.
    • buildThreadUnsafe

      public ITextShaper buildThreadUnsafe()
      Creates a new shaper with the current settings. This shaper is not thread-safe and should not be used from multiple threads at the same time. In exchange, it might offer better performance, especially when reused.
      Returns:
      A new shaper.
    • fallbackFontFinder

      public FontTextShaperBuilder fallbackFontFinder(IFallbackFontFinder fallbackFontFinder)
      Sets the finder for locating fallback fonts, in case the main font cannot render a piece of text.
      Parameters:
      fallbackFontFinder - The fallback font finder to use.
      Returns:
      This builder for chaining method calls.
    • mainFont

      public FontTextShaperBuilder mainFont(FontSpecifier mainFont)
      Sets the main font to use for shaping text, overriding any previously set main font.
      Parameters:
      mainFont - The main font to use.
      Returns:
      This builder for chaining method calls.
    • textShaperType

      public FontTextShaperBuilder textShaperType(TextShaperType textShaperType)
      Sets the text shaper implementation to use. This determines the details of how the text will be shaped.
      Parameters:
      textShaperType - The text shaper type to use, such as Harfbuzz or AWT.
      Returns:
      This builder for chaining method calls.
    • useSharedFontFactory

      public FontTextShaperBuilder useSharedFontFactory(boolean useSharedFontFactory)
      Sets whether to use a shared font factory for loading fonts. This can improve performance when shaping text with the same font multiple times. Defaults to true if not set.
      Parameters:
      useSharedFontFactory - Whether to use a shared font factory.
      Returns:
      This builder for chaining method calls.