2011-06-24 10:41:16 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
#ifndef MOZILLA_GFX_SCALEDFONTDWRITE_H_
|
|
|
|
#define MOZILLA_GFX_SCALEDFONTDWRITE_H_
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
#include <dwrite.h>
|
2012-08-08 13:17:04 -07:00
|
|
|
#include "ScaledFontBase.h"
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2012-03-29 11:53:44 -07:00
|
|
|
struct ID2D1GeometrySink;
|
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2013-01-11 01:43:29 -08:00
|
|
|
class ScaledFontDWrite MOZ_FINAL : public ScaledFontBase
|
2011-06-24 10:41:16 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-02-24 05:23:37 -08:00
|
|
|
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontDwrite)
|
2011-06-24 10:41:16 -07:00
|
|
|
ScaledFontDWrite(IDWriteFontFace *aFont, Float aSize)
|
|
|
|
: mFontFace(aFont)
|
2012-08-08 13:17:04 -07:00
|
|
|
, ScaledFontBase(aSize)
|
2011-06-24 10:41:16 -07:00
|
|
|
{}
|
2012-09-24 08:02:49 -07:00
|
|
|
ScaledFontDWrite(uint8_t *aData, uint32_t aSize, uint32_t aIndex, Float aGlyphSize);
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2014-01-10 11:06:16 -08:00
|
|
|
virtual FontType GetType() const { return FontType::DWRITE; }
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
virtual TemporaryRef<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget);
|
2013-12-12 14:37:00 -08:00
|
|
|
virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint);
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2012-03-29 11:53:44 -07:00
|
|
|
void CopyGlyphsToSink(const GlyphBuffer &aBuffer, ID2D1GeometrySink *aSink);
|
|
|
|
|
2012-09-24 08:02:49 -07:00
|
|
|
virtual bool GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton);
|
|
|
|
|
2012-11-22 17:53:12 -08:00
|
|
|
virtual AntialiasMode GetDefaultAAMode();
|
|
|
|
|
2012-08-08 13:17:04 -07:00
|
|
|
#ifdef USE_SKIA
|
|
|
|
virtual SkTypeface* GetSkTypeface()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(false, "Skia and DirectWrite do not mix");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
RefPtr<IDWriteFontFace> mFontFace;
|
2011-05-26 12:41:33 -07:00
|
|
|
};
|
|
|
|
|
2012-03-19 12:20:17 -07:00
|
|
|
class GlyphRenderingOptionsDWrite : public GlyphRenderingOptions
|
|
|
|
{
|
|
|
|
public:
|
2014-02-24 05:23:37 -08:00
|
|
|
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GlyphRenderingOptionsDWrite)
|
2012-03-19 12:20:17 -07:00
|
|
|
GlyphRenderingOptionsDWrite(IDWriteRenderingParams *aParams)
|
|
|
|
: mParams(aParams)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-01-10 11:06:16 -08:00
|
|
|
virtual FontType GetType() const { return FontType::DWRITE; }
|
2012-03-19 12:20:17 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
friend class DrawTargetD2D;
|
2013-07-17 05:12:22 -07:00
|
|
|
friend class DrawTargetD2D1;
|
2012-03-19 12:20:17 -07:00
|
|
|
|
|
|
|
RefPtr<IDWriteRenderingParams> mParams;
|
|
|
|
};
|
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
}
|
2011-05-26 12:41:33 -07:00
|
|
|
}
|
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
#endif /* MOZILLA_GFX_SCALEDFONTDWRITE_H_ */
|