Bug 1444940 [wpt PR 9917] - Writable streams: test changes to abort() under error...
[gecko.git] / gfx / thebes / gfxGraphiteShaper.h
blob24dec9a61e3b1aa4731e31eaeeb33cc9fe957b08
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
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,
23 const char16_t *aText,
24 uint32_t aOffset,
25 uint32_t aLength,
26 Script aScript,
27 bool aVertical,
28 RoundingFlags aRounding,
29 gfxShapedText *aShapedText) override;
31 static void Shutdown();
33 protected:
34 nsresult SetGlyphsFromSegment(gfxShapedText *aShapedText,
35 uint32_t aOffset,
36 uint32_t aLength,
37 const char16_t *aText,
38 gr_segment *aSegment,
39 RoundingFlags aRounding);
41 static float GrGetAdvance(const void* appFontHandle, uint16_t glyphid);
43 gr_face *mGrFace; // owned by the font entry; shaper must call
44 // gfxFontEntry::ReleaseGrFace when finished with it
45 gr_font *mGrFont; // owned by the shaper itself
47 struct CallbackData {
48 // mFont is a pointer to the font that owns this shaper, so it will
49 // remain valid throughout our lifetime
50 gfxFont* MOZ_NON_OWNING_REF mFont;
51 // initialized to a DrawTarget owned by our caller on every call to
52 // ShapeText
53 mozilla::gfx::DrawTarget* MOZ_NON_OWNING_REF mDrawTarget;
56 CallbackData mCallbackData;
57 bool mFallbackToSmallCaps; // special fallback for the petite-caps case
59 // Convert HTML 'lang' (BCP47) to Graphite language code
60 static uint32_t GetGraphiteTagForLang(const nsCString& aLang);
61 static nsTHashtable<nsUint32HashKey> *sLanguageTags;
64 #endif /* GFX_GRAPHITESHAPER_H */