Bug 1728955: part 6) Log result of Windows' `OleSetClipboardResult`. r=masayuki
[gecko.git] / gfx / thebes / gfxFT2Fonts.h
blob65699b27b75afd4c3f672a802521e3c961c29b4f
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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_FT2FONTS_H
7 #define GFX_FT2FONTS_H
9 #include "mozilla/MemoryReporting.h"
10 #include "gfxTypes.h"
11 #include "gfxFont.h"
12 #include "gfxFT2FontBase.h"
13 #include "gfxContext.h"
14 #include "gfxFontUtils.h"
15 #include "gfxUserFontSet.h"
17 class FT2FontEntry;
19 class gfxFT2Font : public gfxFT2FontBase {
20 public: // new functions
21 gfxFT2Font(const RefPtr<mozilla::gfx::UnscaledFontFreeType>& aUnscaledFont,
22 RefPtr<mozilla::gfx::SharedFTFace>&& aFTFace,
23 FT2FontEntry* aFontEntry, const gfxFontStyle* aFontStyle,
24 int aLoadFlags);
25 virtual ~gfxFT2Font();
27 FT2FontEntry* GetFontEntry();
29 already_AddRefed<mozilla::gfx::ScaledFont> GetScaledFont(
30 DrawTarget* aTarget) override;
32 bool ShouldHintMetrics() const override;
34 void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
35 FontCacheSizes* aSizes) const override;
36 void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
37 FontCacheSizes* aSizes) const override;
39 protected:
40 struct CachedGlyphData {
41 CachedGlyphData() : glyphIndex(0xffffffffU) {}
43 explicit CachedGlyphData(uint32_t gid) : glyphIndex(gid) {}
45 uint32_t glyphIndex;
46 int32_t lsbDelta;
47 int32_t rsbDelta;
48 int32_t xAdvance;
51 const CachedGlyphData* GetGlyphDataForChar(FT_Face aFace, uint32_t ch) {
52 CharGlyphMapEntryType* entry = mCharGlyphCache.PutEntry(ch);
54 if (!entry) return nullptr;
56 if (entry->GetData().glyphIndex == 0xffffffffU) {
57 // this is a new entry, fill it
58 FillGlyphDataForChar(aFace, ch, entry->GetModifiableData());
61 return &entry->GetData();
64 bool ShapeText(DrawTarget* aDrawTarget, const char16_t* aText,
65 uint32_t aOffset, uint32_t aLength, Script aScript,
66 nsAtom* aLanguage, bool aVertical, RoundingFlags aRounding,
67 gfxShapedText* aShapedText) override;
69 void FillGlyphDataForChar(FT_Face face, uint32_t ch, CachedGlyphData* gd);
71 void AddRange(const char16_t* aText, uint32_t aOffset, uint32_t aLength,
72 gfxShapedText* aShapedText);
74 typedef nsBaseHashtableET<nsUint32HashKey, CachedGlyphData>
75 CharGlyphMapEntryType;
76 typedef nsTHashtable<CharGlyphMapEntryType> CharGlyphMap;
77 CharGlyphMap mCharGlyphCache;
80 #endif /* GFX_FT2FONTS_H */