MathMLTextRunFactory.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. * This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef MATHMLTEXTRUNFACTORY_H_
  6. #define MATHMLTEXTRUNFACTORY_H_
  7. #include "mozilla/UniquePtr.h"
  8. #include "nsTextRunTransformations.h"
  9. /**
  10. * Builds textruns that render their text with MathML specific renderings.
  11. */
  12. class MathMLTextRunFactory : public nsTransformingTextRunFactory {
  13. public:
  14. MathMLTextRunFactory(UniquePtr<nsTransformingTextRunFactory> aInnerTransformingTextRunFactory,
  15. uint32_t aFlags, uint8_t aSSTYScriptLevel,
  16. float aFontInflation)
  17. : mInnerTransformingTextRunFactory(Move(aInnerTransformingTextRunFactory)),
  18. mFlags(aFlags),
  19. mFontInflation(aFontInflation),
  20. mSSTYScriptLevel(aSSTYScriptLevel) {}
  21. virtual void RebuildTextRun(nsTransformedTextRun* aTextRun,
  22. mozilla::gfx::DrawTarget* aRefDrawTarget,
  23. gfxMissingFontRecorder* aMFR) override;
  24. enum {
  25. // Style effects which may override single character <mi> behaviour
  26. MATH_FONT_STYLING_NORMAL = 0x1, // fontstyle="normal" has been set.
  27. MATH_FONT_WEIGHT_BOLD = 0x2, // fontweight="bold" has been set.
  28. MATH_FONT_FEATURE_DTLS = 0x4, // font feature dtls should be set
  29. };
  30. protected:
  31. UniquePtr<nsTransformingTextRunFactory> mInnerTransformingTextRunFactory;
  32. uint32_t mFlags;
  33. float mFontInflation;
  34. uint8_t mSSTYScriptLevel;
  35. };
  36. #endif /*MATHMLTEXTRUNFACTORY_H_*/