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