1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/thebes/gfxFT2FontBase.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,47 @@ 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_FT2FONTBASE_H 1.10 +#define GFX_FT2FONTBASE_H 1.11 + 1.12 +#include "cairo.h" 1.13 +#include "gfxContext.h" 1.14 +#include "gfxFont.h" 1.15 +#include "mozilla/gfx/2D.h" 1.16 + 1.17 +class gfxFT2FontBase : public gfxFont { 1.18 +public: 1.19 + gfxFT2FontBase(cairo_scaled_font_t *aScaledFont, 1.20 + gfxFontEntry *aFontEntry, 1.21 + const gfxFontStyle *aFontStyle); 1.22 + virtual ~gfxFT2FontBase(); 1.23 + 1.24 + uint32_t GetGlyph(uint32_t aCharCode); 1.25 + void GetGlyphExtents(uint32_t aGlyph, 1.26 + cairo_text_extents_t* aExtents); 1.27 + virtual const gfxFont::Metrics& GetMetrics(); 1.28 + virtual uint32_t GetSpaceGlyph(); 1.29 + virtual bool ProvidesGetGlyph() const { return true; } 1.30 + virtual uint32_t GetGlyph(uint32_t unicode, uint32_t variation_selector); 1.31 + virtual bool ProvidesGlyphWidths() { return true; } 1.32 + virtual int32_t GetGlyphWidth(gfxContext *aCtx, uint16_t aGID); 1.33 + 1.34 + cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; }; 1.35 + virtual bool SetupCairoFont(gfxContext *aContext); 1.36 + 1.37 + virtual FontType GetType() const { return FONT_TYPE_FT2; } 1.38 + 1.39 + mozilla::gfx::FontOptions* GetFontOptions() { return &mFontOptions; } 1.40 +protected: 1.41 + uint32_t mSpaceGlyph; 1.42 + bool mHasMetrics; 1.43 + Metrics mMetrics; 1.44 + 1.45 + // Azure font description 1.46 + mozilla::gfx::FontOptions mFontOptions; 1.47 + void ConstructFontOptions(); 1.48 +}; 1.49 + 1.50 +#endif /* GFX_FT2FONTBASE_H */