|
1 /* -*- Mode: C++; tab-width: 20; 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 MOZILLA_GFX_SCALEDFONTDWRITE_H_ |
|
7 #define MOZILLA_GFX_SCALEDFONTDWRITE_H_ |
|
8 |
|
9 #include <dwrite.h> |
|
10 #include "ScaledFontBase.h" |
|
11 |
|
12 struct ID2D1GeometrySink; |
|
13 |
|
14 namespace mozilla { |
|
15 namespace gfx { |
|
16 |
|
17 class ScaledFontDWrite MOZ_FINAL : public ScaledFontBase |
|
18 { |
|
19 public: |
|
20 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontDwrite) |
|
21 ScaledFontDWrite(IDWriteFontFace *aFont, Float aSize) |
|
22 : mFontFace(aFont) |
|
23 , ScaledFontBase(aSize) |
|
24 {} |
|
25 ScaledFontDWrite(uint8_t *aData, uint32_t aSize, uint32_t aIndex, Float aGlyphSize); |
|
26 |
|
27 virtual FontType GetType() const { return FontType::DWRITE; } |
|
28 |
|
29 virtual TemporaryRef<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget); |
|
30 virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint); |
|
31 |
|
32 void CopyGlyphsToSink(const GlyphBuffer &aBuffer, ID2D1GeometrySink *aSink); |
|
33 |
|
34 virtual bool GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton); |
|
35 |
|
36 virtual AntialiasMode GetDefaultAAMode(); |
|
37 |
|
38 #ifdef USE_SKIA |
|
39 virtual SkTypeface* GetSkTypeface() |
|
40 { |
|
41 MOZ_ASSERT(false, "Skia and DirectWrite do not mix"); |
|
42 return nullptr; |
|
43 } |
|
44 #endif |
|
45 |
|
46 RefPtr<IDWriteFontFace> mFontFace; |
|
47 }; |
|
48 |
|
49 class GlyphRenderingOptionsDWrite : public GlyphRenderingOptions |
|
50 { |
|
51 public: |
|
52 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GlyphRenderingOptionsDWrite) |
|
53 GlyphRenderingOptionsDWrite(IDWriteRenderingParams *aParams) |
|
54 : mParams(aParams) |
|
55 { |
|
56 } |
|
57 |
|
58 virtual FontType GetType() const { return FontType::DWRITE; } |
|
59 |
|
60 private: |
|
61 friend class DrawTargetD2D; |
|
62 friend class DrawTargetD2D1; |
|
63 |
|
64 RefPtr<IDWriteRenderingParams> mParams; |
|
65 }; |
|
66 |
|
67 } |
|
68 } |
|
69 |
|
70 #endif /* MOZILLA_GFX_SCALEDFONTDWRITE_H_ */ |