Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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 struct gr_face;
12 struct gr_font;
13 struct gr_segment;
15 class gfxGraphiteShaper : public gfxFontShaper {
16 public:
17 gfxGraphiteShaper(gfxFont *aFont);
18 virtual ~gfxGraphiteShaper();
20 virtual bool ShapeText(gfxContext *aContext,
21 const char16_t *aText,
22 uint32_t aOffset,
23 uint32_t aLength,
24 int32_t aScript,
25 gfxShapedText *aShapedText);
27 static void Shutdown();
29 protected:
30 nsresult SetGlyphsFromSegment(gfxContext *aContext,
31 gfxShapedText *aShapedText,
32 uint32_t aOffset,
33 uint32_t aLength,
34 const char16_t *aText,
35 gr_segment *aSegment);
37 static float GrGetAdvance(const void* appFontHandle, uint16_t glyphid);
39 gr_face *mGrFace; // owned by the font entry; shaper must call
40 // gfxFontEntry::ReleaseGrFace when finished with it
41 gr_font *mGrFont; // owned by the shaper itself
43 struct CallbackData {
44 gfxFont *mFont;
45 gfxGraphiteShaper *mShaper;
46 gfxContext *mContext;
47 };
49 CallbackData mCallbackData;
51 // Convert HTML 'lang' (BCP47) to Graphite language code
52 static uint32_t GetGraphiteTagForLang(const nsCString& aLang);
53 static nsTHashtable<nsUint32HashKey> *sLanguageTags;
54 };
56 #endif /* GFX_GRAPHITESHAPER_H */