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