2011-06-24 21:41:16 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2012-05-21 15:12:37 +04: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 23:41:33 +04:00
|
|
|
|
2011-06-24 21:41:16 +04:00
|
|
|
#ifndef MOZILLA_GFX_SCALEDFONTDWRITE_H_
|
|
|
|
#define MOZILLA_GFX_SCALEDFONTDWRITE_H_
|
2011-05-26 23:41:33 +04:00
|
|
|
|
2011-06-24 21:41:16 +04:00
|
|
|
#include <dwrite.h>
|
2012-08-09 00:17:04 +04:00
|
|
|
#include "ScaledFontBase.h"
|
2011-05-26 23:41:33 +04:00
|
|
|
|
2012-03-29 22:53:44 +04:00
|
|
|
struct ID2D1GeometrySink;
|
|
|
|
|
2011-06-24 21:41:16 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
2011-05-26 23:41:33 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class ScaledFontDWrite final : public ScaledFontBase
|
2011-06-24 21:41:16 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-02-24 17:23:37 +04:00
|
|
|
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontDwrite)
|
2011-06-24 21:41:16 +04:00
|
|
|
ScaledFontDWrite(IDWriteFontFace *aFont, Float aSize)
|
2015-11-05 23:19:33 +03:00
|
|
|
: ScaledFontBase(aSize)
|
2016-01-06 22:35:04 +03:00
|
|
|
, mFont(nullptr)
|
|
|
|
, mFontFamily(nullptr)
|
2015-11-05 23:19:33 +03:00
|
|
|
, mFontFace(aFont)
|
2011-06-24 21:41:16 +04:00
|
|
|
{}
|
2011-05-26 23:41:33 +04:00
|
|
|
|
2016-01-06 22:35:04 +03:00
|
|
|
ScaledFontDWrite(IDWriteFont* aFont, IDWriteFontFamily* aFontFamily,
|
|
|
|
IDWriteFontFace *aFontFace, Float aSize)
|
|
|
|
: ScaledFontBase(aSize)
|
|
|
|
, mFont(aFont)
|
|
|
|
, mFontFamily(aFontFamily)
|
|
|
|
, mFontFace(aFontFace)
|
|
|
|
{}
|
|
|
|
|
2014-01-10 23:06:16 +04:00
|
|
|
virtual FontType GetType() const { return FontType::DWRITE; }
|
2011-05-26 23:41:33 +04:00
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
virtual already_AddRefed<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget);
|
2013-12-13 02:37:00 +04:00
|
|
|
virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint);
|
2011-05-26 23:41:33 +04:00
|
|
|
|
2012-03-29 22:53:44 +04:00
|
|
|
void CopyGlyphsToSink(const GlyphBuffer &aBuffer, ID2D1GeometrySink *aSink);
|
|
|
|
|
2012-09-24 19:02:49 +04:00
|
|
|
virtual bool GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton);
|
|
|
|
|
2012-11-23 05:53:12 +04:00
|
|
|
virtual AntialiasMode GetDefaultAAMode();
|
|
|
|
|
2012-08-09 00:17:04 +04:00
|
|
|
#ifdef USE_SKIA
|
2016-01-06 22:35:04 +03:00
|
|
|
virtual SkTypeface* GetSkTypeface();
|
2012-08-09 00:17:04 +04:00
|
|
|
#endif
|
|
|
|
|
2016-01-06 22:35:04 +03:00
|
|
|
RefPtr<IDWriteFont> mFont;
|
|
|
|
RefPtr<IDWriteFontFamily> mFontFamily;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<IDWriteFontFace> mFontFace;
|
2016-01-05 13:08:56 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
#ifdef USE_CAIRO_SCALED_FONT
|
|
|
|
cairo_font_face_t* GetCairoFontFace() override;
|
|
|
|
#endif
|
2011-05-26 23:41:33 +04:00
|
|
|
};
|
|
|
|
|
2012-03-19 23:20:17 +04:00
|
|
|
class GlyphRenderingOptionsDWrite : public GlyphRenderingOptions
|
|
|
|
{
|
|
|
|
public:
|
2014-02-24 17:23:37 +04:00
|
|
|
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GlyphRenderingOptionsDWrite)
|
2012-03-19 23:20:17 +04:00
|
|
|
GlyphRenderingOptionsDWrite(IDWriteRenderingParams *aParams)
|
|
|
|
: mParams(aParams)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-01-10 23:06:16 +04:00
|
|
|
virtual FontType GetType() const { return FontType::DWRITE; }
|
2012-03-19 23:20:17 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
friend class DrawTargetD2D;
|
2013-07-17 16:12:22 +04:00
|
|
|
friend class DrawTargetD2D1;
|
2012-03-19 23:20:17 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<IDWriteRenderingParams> mParams;
|
2012-03-19 23:20:17 +04:00
|
|
|
};
|
|
|
|
|
2011-06-24 21:41:16 +04:00
|
|
|
}
|
2011-05-26 23:41:33 +04:00
|
|
|
}
|
|
|
|
|
2011-06-24 21:41:16 +04:00
|
|
|
#endif /* MOZILLA_GFX_SCALEDFONTDWRITE_H_ */
|