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
11 #include "mozilla/gfx/2D.h"
17 class gfxGraphiteShaper
: public gfxFontShaper
{
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();
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
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 */