2008-04-19 15:02:52 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2012-05-21 11:12:37 +00: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/. */
|
2008-04-19 15:02:52 +00:00
|
|
|
|
|
|
|
#ifndef GFX_PLATFORM_QT_H
|
|
|
|
#define GFX_PLATFORM_QT_H
|
|
|
|
|
|
|
|
#include "gfxPlatform.h"
|
2010-03-06 13:29:55 +00:00
|
|
|
#include "nsAutoRef.h"
|
2008-04-19 15:02:52 +00:00
|
|
|
#include "nsDataHashtable.h"
|
2009-01-18 20:14:14 +00:00
|
|
|
#include "nsTArray.h"
|
2012-03-22 23:24:40 +00:00
|
|
|
#ifdef MOZ_X11
|
|
|
|
#include "X11/Xlib.h"
|
|
|
|
#endif
|
2008-04-19 15:02:52 +00:00
|
|
|
|
2010-03-06 13:29:55 +00:00
|
|
|
class gfxFontconfigUtils;
|
2014-02-21 02:09:02 +00:00
|
|
|
class QWindow;
|
2008-04-19 15:02:52 +00:00
|
|
|
|
2013-05-29 21:59:24 +00:00
|
|
|
class gfxQtPlatform : public gfxPlatform {
|
2008-04-19 15:02:52 +00:00
|
|
|
public:
|
|
|
|
gfxQtPlatform();
|
|
|
|
virtual ~gfxQtPlatform();
|
|
|
|
|
|
|
|
static gfxQtPlatform *GetPlatform() {
|
2014-02-21 02:09:02 +00:00
|
|
|
return static_cast<gfxQtPlatform*>(gfxPlatform::GetPlatform());
|
2008-04-19 15:02:52 +00:00
|
|
|
}
|
|
|
|
|
2014-02-09 08:04:38 +00:00
|
|
|
virtual already_AddRefed<gfxASurface>
|
|
|
|
CreateOffscreenSurface(const IntSize& size,
|
2015-03-21 16:28:04 +00:00
|
|
|
gfxContentType contentType) override;
|
2008-04-19 15:02:52 +00:00
|
|
|
|
2014-02-21 02:09:02 +00:00
|
|
|
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
|
2015-03-21 16:28:04 +00:00
|
|
|
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont) override;
|
2014-01-30 07:01:16 +00:00
|
|
|
|
2014-02-21 02:09:02 +00:00
|
|
|
virtual nsresult GetFontList(nsIAtom *aLangGroup,
|
|
|
|
const nsACString& aGenericFamily,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsTArray<nsString>& aListOfFonts) override;
|
2008-04-19 15:02:52 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult UpdateFontList() override;
|
2008-04-19 15:02:52 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) override;
|
2008-04-19 15:02:52 +00:00
|
|
|
|
2014-06-06 06:09:23 +00:00
|
|
|
virtual gfxFontGroup *CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList,
|
2014-02-21 02:09:02 +00:00
|
|
|
const gfxFontStyle *aStyle,
|
2015-03-21 16:28:04 +00:00
|
|
|
gfxUserFontSet* aUserFontSet) override;
|
2008-04-19 15:02:52 +00:00
|
|
|
|
2010-03-06 13:29:55 +00:00
|
|
|
/**
|
|
|
|
* Look up a local platform font using the full font face name (needed to
|
|
|
|
* support @font-face src local() )
|
|
|
|
*/
|
2014-09-08 07:23:19 +00:00
|
|
|
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
|
|
|
uint16_t aWeight,
|
|
|
|
int16_t aStretch,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aItalic) override;
|
2010-03-06 13:29:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Activate a platform font (needed to support @font-face src url() )
|
|
|
|
*
|
|
|
|
*/
|
2014-09-08 07:23:19 +00:00
|
|
|
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
|
|
|
uint16_t aWeight,
|
|
|
|
int16_t aStretch,
|
|
|
|
bool aItalic,
|
|
|
|
const uint8_t* aFontData,
|
2015-03-21 16:28:04 +00:00
|
|
|
uint32_t aLength) override;
|
2010-03-06 13:29:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether format is supported on a platform or not (if unclear,
|
|
|
|
* returns true).
|
|
|
|
*/
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsFontFormatSupported(nsIURI *aFontURI,
|
2015-03-21 16:28:04 +00:00
|
|
|
uint32_t aFormatFlags) override;
|
2010-01-11 20:31:43 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
static int32_t GetDPI();
|
2010-08-13 09:58:01 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual gfxImageFormat GetOffscreenFormat() override;
|
2012-03-22 23:24:40 +00:00
|
|
|
#ifdef MOZ_X11
|
2014-02-21 02:09:02 +00:00
|
|
|
static Display* GetXDisplay(QWindow* aWindow = 0);
|
|
|
|
static Screen* GetXScreen(QWindow* aWindow = 0);
|
2012-03-22 23:24:40 +00:00
|
|
|
#endif
|
2010-12-15 18:17:26 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual int GetScreenDepth() const override;
|
2014-02-21 02:09:02 +00:00
|
|
|
|
2009-09-27 00:21:32 +00:00
|
|
|
protected:
|
2008-04-19 15:02:52 +00:00
|
|
|
static gfxFontconfigUtils *sFontconfigUtils;
|
|
|
|
|
|
|
|
private:
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void GetPlatformCMSOutputProfile(void *&mem, size_t &size) override;
|
2010-01-11 20:31:43 +00:00
|
|
|
|
2012-08-01 19:00:24 +00:00
|
|
|
int mScreenDepth;
|
2008-04-19 15:02:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* GFX_PLATFORM_QT_H */
|
|
|
|
|