1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/thebes/gfxGraphiteShaper.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef GFX_GRAPHITESHAPER_H 1.10 +#define GFX_GRAPHITESHAPER_H 1.11 + 1.12 +#include "gfxFont.h" 1.13 + 1.14 +struct gr_face; 1.15 +struct gr_font; 1.16 +struct gr_segment; 1.17 + 1.18 +class gfxGraphiteShaper : public gfxFontShaper { 1.19 +public: 1.20 + gfxGraphiteShaper(gfxFont *aFont); 1.21 + virtual ~gfxGraphiteShaper(); 1.22 + 1.23 + virtual bool ShapeText(gfxContext *aContext, 1.24 + const char16_t *aText, 1.25 + uint32_t aOffset, 1.26 + uint32_t aLength, 1.27 + int32_t aScript, 1.28 + gfxShapedText *aShapedText); 1.29 + 1.30 + static void Shutdown(); 1.31 + 1.32 +protected: 1.33 + nsresult SetGlyphsFromSegment(gfxContext *aContext, 1.34 + gfxShapedText *aShapedText, 1.35 + uint32_t aOffset, 1.36 + uint32_t aLength, 1.37 + const char16_t *aText, 1.38 + gr_segment *aSegment); 1.39 + 1.40 + static float GrGetAdvance(const void* appFontHandle, uint16_t glyphid); 1.41 + 1.42 + gr_face *mGrFace; // owned by the font entry; shaper must call 1.43 + // gfxFontEntry::ReleaseGrFace when finished with it 1.44 + gr_font *mGrFont; // owned by the shaper itself 1.45 + 1.46 + struct CallbackData { 1.47 + gfxFont *mFont; 1.48 + gfxGraphiteShaper *mShaper; 1.49 + gfxContext *mContext; 1.50 + }; 1.51 + 1.52 + CallbackData mCallbackData; 1.53 + 1.54 + // Convert HTML 'lang' (BCP47) to Graphite language code 1.55 + static uint32_t GetGraphiteTagForLang(const nsCString& aLang); 1.56 + static nsTHashtable<nsUint32HashKey> *sLanguageTags; 1.57 +}; 1.58 + 1.59 +#endif /* GFX_GRAPHITESHAPER_H */