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
11 #include "mozilla/gfx/2D.h"
17 class gfxGraphiteShaper
: public gfxFontShaper
{
19 explicit gfxGraphiteShaper(gfxFont
*aFont
);
20 virtual ~gfxGraphiteShaper();
22 bool ShapeText(DrawTarget
*aDrawTarget
,
23 const char16_t
*aText
,
28 RoundingFlags aRounding
,
29 gfxShapedText
*aShapedText
) override
;
31 static void Shutdown();
34 nsresult
SetGlyphsFromSegment(gfxShapedText
*aShapedText
,
37 const char16_t
*aText
,
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
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
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 */