diff --git a/js/MathSymbolFont.ts b/js/MathSymbolFont.ts index bc146e51..04837c87 100644 --- a/js/MathSymbolFont.ts +++ b/js/MathSymbolFont.ts @@ -14,6 +14,10 @@ import StrictOmit from '../../phet-core/js/types/StrictOmit.js'; import StringUtils from '../../phetcommon/js/util/StringUtils.js'; import { Font, FontOptions } from '../../scenery/js/imports.js'; import sceneryPhet from './sceneryPhet.js'; +import PickOptional from '../../phet-core/js/types/PickOptional.js'; +import { PhetioObjectOptions } from '../../tandem/js/PhetioObject.js'; +import Tandem from '../../tandem/js/Tandem.js'; +import StringIO from '../../tandem/js/types/StringIO.js'; const DEFAULT_STYLE = 'italic'; @@ -21,6 +25,8 @@ type SelfOptions = EmptySelfOptions; export type MathSymbolFontOptions = SelfOptions & StrictOmit; +type CreateDerivedPropertyOptions = PickOptional & PickOptional; + export default class MathSymbolFont extends Font { public static readonly FAMILY = '"Times New Roman", Times, serif'; @@ -59,9 +65,15 @@ export default class MathSymbolFont extends Font { /** * Wraps a dynamic string in RichText that will display the string in the same font as MathSymbolFont. */ - public static createDerivedProperty( symbolStringProperty: TReadOnlyProperty, style = DEFAULT_STYLE ): TReadOnlyProperty { + public static createDerivedProperty( symbolStringProperty: TReadOnlyProperty, providedOptions?: CreateDerivedPropertyOptions ): TReadOnlyProperty { + + const options = providedOptions || {}; + return new DerivedProperty( [ symbolStringProperty ], - symbolString => MathSymbolFont.getRichTextMarkup( symbolString, style ) ); + symbolString => MathSymbolFont.getRichTextMarkup( symbolString, options.style || DEFAULT_STYLE ), { + tandem: options.tandem || Tandem.OPT_OUT, + phetioValueType: StringIO + } ); } }