Bug 1567650 [wpt PR 17950] - [ElementTiming] Replace responseEnd with loadTime, a...
[gecko.git] / gfx / thebes / gfxGraphiteShaper.h
blobd360bba6a87502163384480835d1f08a590c1835
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_GRAPHITESHAPER_H
7 #define GFX_GRAPHITESHAPER_H
9 #include "gfxFont.h"
11 #include "mozilla/gfx/2D.h"
13 struct gr_face;
14 struct gr_font;
15 struct gr_segment;
17 class gfxGraphiteShaper : public gfxFontShaper {
18 public:
19 explicit gfxGraphiteShaper(gfxFont* aFont);
20 virtual ~gfxGraphiteShaper();
22 bool ShapeText(DrawTarget* aDrawTarget, const char16_t* aText,
23 uint32_t aOffset, uint32_t aLength, Script aScript,
24 bool aVertical, RoundingFlags aRounding,
25 gfxShapedText* aShapedText) override;
27 static void Shutdown();
29 protected:
30 nsresult SetGlyphsFromSegment(gfxShapedText* aShapedText, uint32_t aOffset,
31 uint32_t aLength, const char16_t* aText,
32 gr_segment* aSegment, RoundingFlags aRounding);
34 static float GrGetAdvance(const void* appFontHandle, uint16_t glyphid);
36 gr_face* mGrFace; // owned by the font entry; shaper must call
37 // gfxFontEntry::ReleaseGrFace when finished with it
38 gr_font* mGrFont; // owned by the shaper itself
40 struct CallbackData {
41 // mFont is a pointer to the font that owns this shaper, so it will
42 // remain valid throughout our lifetime
43 gfxFont* MOZ_NON_OWNING_REF mFont;
46 CallbackData mCallbackData;
47 bool mFallbackToSmallCaps; // special fallback for the petite-caps case
49 // Convert HTML 'lang' (BCP47) to Graphite language code
50 static uint32_t GetGraphiteTagForLang(const nsCString& aLang);
51 static nsTHashtable<nsUint32HashKey>* sLanguageTags;
54 #endif /* GFX_GRAPHITESHAPER_H */