Line data Source code
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 :
6 : #ifndef MATHMLTEXTRUNFACTORY_H_
7 : #define MATHMLTEXTRUNFACTORY_H_
8 :
9 : #include "mozilla/UniquePtr.h"
10 : #include "nsTextRunTransformations.h"
11 :
12 : /**
13 : * Builds textruns that render their text with MathML specific renderings.
14 : */
15 0 : class MathMLTextRunFactory : public nsTransformingTextRunFactory {
16 : public:
17 0 : MathMLTextRunFactory(mozilla::UniquePtr<nsTransformingTextRunFactory> aInnerTransformingTextRunFactory,
18 : uint32_t aFlags, uint8_t aSSTYScriptLevel,
19 : float aFontInflation)
20 0 : : mInnerTransformingTextRunFactory(Move(aInnerTransformingTextRunFactory)),
21 : mFlags(aFlags),
22 : mFontInflation(aFontInflation),
23 0 : mSSTYScriptLevel(aSSTYScriptLevel) {}
24 :
25 : virtual void RebuildTextRun(nsTransformedTextRun* aTextRun,
26 : mozilla::gfx::DrawTarget* aRefDrawTarget,
27 : gfxMissingFontRecorder* aMFR) override;
28 : enum {
29 : // Style effects which may override single character <mi> behaviour
30 : MATH_FONT_STYLING_NORMAL = 0x1, // fontstyle="normal" has been set.
31 : MATH_FONT_WEIGHT_BOLD = 0x2, // fontweight="bold" has been set.
32 : MATH_FONT_FEATURE_DTLS = 0x4, // font feature dtls should be set
33 : };
34 :
35 : protected:
36 : mozilla::UniquePtr<nsTransformingTextRunFactory> mInnerTransformingTextRunFactory;
37 : uint32_t mFlags;
38 : float mFontInflation;
39 : uint8_t mSSTYScriptLevel;
40 : };
41 :
42 : #endif /*MATHMLTEXTRUNFACTORY_H_*/
|