2007-01-30 11:20:29 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
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/. */
|
2007-01-30 11:20:29 +03:00
|
|
|
|
|
|
|
#ifndef GFX_FONTCONFIG_UTILS_H
|
|
|
|
#define GFX_FONTCONFIG_UTILS_H
|
|
|
|
|
|
|
|
#include "gfxPlatform.h"
|
|
|
|
|
2008-11-07 05:21:34 +03:00
|
|
|
#include "nsAutoRef.h"
|
2016-07-20 22:07:11 +03:00
|
|
|
#include "gfxFT2FontBase.h"
|
2007-01-30 11:20:29 +03:00
|
|
|
|
2008-09-16 08:40:57 +04:00
|
|
|
#include <fontconfig/fontconfig.h>
|
|
|
|
|
2008-11-07 05:21:34 +03:00
|
|
|
|
2011-12-13 18:17:59 +04:00
|
|
|
template <>
|
2008-11-07 05:21:34 +03:00
|
|
|
class nsAutoRefTraits<FcPattern> : public nsPointerRefTraits<FcPattern>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void Release(FcPattern *ptr) { FcPatternDestroy(ptr); }
|
|
|
|
static void AddRef(FcPattern *ptr) { FcPatternReference(ptr); }
|
|
|
|
};
|
|
|
|
|
2011-12-13 18:17:59 +04:00
|
|
|
template <>
|
2008-11-07 05:21:34 +03:00
|
|
|
class nsAutoRefTraits<FcFontSet> : public nsPointerRefTraits<FcFontSet>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void Release(FcFontSet *ptr) { FcFontSetDestroy(ptr); }
|
|
|
|
};
|
|
|
|
|
2011-12-13 18:17:59 +04:00
|
|
|
template <>
|
2008-11-07 05:21:34 +03:00
|
|
|
class nsAutoRefTraits<FcCharSet> : public nsPointerRefTraits<FcCharSet>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void Release(FcCharSet *ptr) { FcCharSetDestroy(ptr); }
|
|
|
|
};
|
|
|
|
|
2016-07-20 22:07:11 +03:00
|
|
|
class gfxFontconfigFontBase : public gfxFT2FontBase {
|
|
|
|
public:
|
2017-04-07 00:41:02 +03:00
|
|
|
gfxFontconfigFontBase(const RefPtr<mozilla::gfx::UnscaledFontFontconfig>& aUnscaledFont,
|
|
|
|
cairo_scaled_font_t *aScaledFont,
|
2016-07-20 22:07:11 +03:00
|
|
|
FcPattern *aPattern,
|
|
|
|
gfxFontEntry *aFontEntry,
|
2017-03-22 19:00:02 +03:00
|
|
|
const gfxFontStyle *aFontStyle)
|
2017-04-07 00:41:02 +03:00
|
|
|
: gfxFT2FontBase(aUnscaledFont, aScaledFont, aFontEntry, aFontStyle)
|
2017-03-22 19:00:02 +03:00
|
|
|
, mPattern(aPattern) { }
|
2016-07-20 22:07:11 +03:00
|
|
|
|
|
|
|
virtual FontType GetType() const override { return FONT_TYPE_FONTCONFIG; }
|
|
|
|
virtual FcPattern *GetPattern() const { return mPattern; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsCountedRef<FcPattern> mPattern;
|
|
|
|
};
|
|
|
|
|
2007-01-30 11:20:29 +03:00
|
|
|
#endif /* GFX_FONTCONFIG_UTILS_H */
|