Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MathSymbolsFont.getRichTextMarkup #172

Open
pixelzoom opened this issue Jul 19, 2022 · 0 comments
Open

Use MathSymbolsFont.getRichTextMarkup #172

pixelzoom opened this issue Jul 19, 2022 · 0 comments
Assignees

Comments

@pixelzoom
Copy link
Contributor

I see this kind of thing in curve-fitting and area-model-common, search for <i style='font-family:

// PointNode.js
const Y_PATTERN = `<i style='font-family:${CurveFittingConstants.EQUATION_SYMBOL_FONT.family}'>{{y}}</i>`;
...
        y: StringUtils.fillIn( Y_PATTERN, {
          y: ySymbolString
        } )

FYI, MathSymbolsFont provides support for this:

  /**
   * Converts a string to the markup needed to display that string with RichText, using the same family as MathSymbolFont.
   * @param text
   * @param [style] - see Font options.style
   */
  public static getRichTextMarkup( text: string, style = DEFAULT_STYLE ): string {

In the PointNode.js example above, Y_PATTERN is unecessary, and it becomes:

        y: MathSymbolsFont.getRichTextMarkup( ySymbolString )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants