Merge m-c to inbound.
[gecko.git] / gfx / thebes / gfxOS2Platform.h
blobeeab5e6930266557815fa90b4c66707af2f1e74e
1 /* vim: set sw=4 sts=4 et cin: */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef GFX_OS2_PLATFORM_H
7 #define GFX_OS2_PLATFORM_H
9 #define INCL_GPIBITMAPS
10 #include <os2.h>
12 #include "gfxPlatform.h"
13 #include "gfxOS2Fonts.h"
14 #include "gfxFontUtils.h"
15 #include "nsTArray.h"
17 class gfxFontconfigUtils;
19 class gfxOS2Platform : public gfxPlatform {
21 public:
22 gfxOS2Platform();
23 virtual ~gfxOS2Platform();
25 static gfxOS2Platform *GetPlatform() {
26 return (gfxOS2Platform*) gfxPlatform::GetPlatform();
29 already_AddRefed<gfxASurface>
30 CreateOffscreenSurface(const gfxIntSize& size,
31 gfxContentType contentType);
33 nsresult GetFontList(nsIAtom *aLangGroup,
34 const nsACString& aGenericFamily,
35 nsTArray<nsString>& aListOfFonts);
36 nsresult UpdateFontList();
37 nsresult ResolveFontName(const nsAString& aFontName,
38 FontResolverCallback aCallback,
39 void *aClosure, bool& aAborted);
40 nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName);
42 gfxFontGroup *CreateFontGroup(const nsAString &aFamilies,
43 const gfxFontStyle *aStyle,
44 gfxUserFontSet *aUserFontSet);
46 // Given a string and a font we already have, find the font that
47 // supports the most code points and most closely resembles aFont.
48 // This simple version involves looking at the fonts on the machine to see
49 // which code points they support.
50 already_AddRefed<gfxOS2Font> FindFontForChar(uint32_t aCh, gfxOS2Font *aFont);
52 // return true if it's already known that we don't have a font for this char
53 bool noFontWithChar(uint32_t aCh) {
54 return mCodepointsWithNoFonts.test(aCh);
57 protected:
58 static gfxFontconfigUtils *sFontconfigUtils;
60 private:
61 // when font lookup fails for a character, cache it to skip future searches
62 gfxSparseBitSet mCodepointsWithNoFonts;
65 #endif /* GFX_OS2_PLATFORM_H */