LCOV - code coverage report
Current view: top level - gfx/2d - ScaledFontFontconfig.h (source / functions) Hit Total Coverage
Test: output.info Lines: 2 3 66.7 %
Date: 2017-07-14 16:53:18 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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/. */
       5             : 
       6             : #ifndef MOZILLA_GFX_SCALEDFONTFONTCONFIG_H_
       7             : #define MOZILLA_GFX_SCALEDFONTFONTCONFIG_H_
       8             : 
       9             : #include "ScaledFontBase.h"
      10             : 
      11             : #include <cairo-ft.h>
      12             : 
      13             : namespace mozilla {
      14             : namespace gfx {
      15             : 
      16             : class NativeFontResourceFontconfig;
      17             : class UnscaledFontFontconfig;
      18             : 
      19             : class ScaledFontFontconfig : public ScaledFontBase
      20             : {
      21             : public:
      22          63 :   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontFontconfig, override)
      23             :   ScaledFontFontconfig(cairo_scaled_font_t* aScaledFont, FcPattern* aPattern,
      24             :                        const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize);
      25             :   ~ScaledFontFontconfig();
      26             : 
      27          63 :   FontType GetType() const override { return FontType::FONTCONFIG; }
      28             : 
      29             : #ifdef USE_SKIA
      30             :   SkTypeface* GetSkTypeface() override;
      31             : #endif
      32             : 
      33           0 :   bool CanSerialize() override { return true; }
      34             : 
      35             :   bool GetFontInstanceData(FontInstanceDataOutput aCb, void* aBaton) override;
      36             : 
      37             : private:
      38             :   friend class NativeFontResourceFontconfig;
      39             :   friend class UnscaledFontFontconfig;
      40             : 
      41             :   struct InstanceData
      42             :   {
      43             :     enum {
      44             :       ANTIALIAS       = 1 << 0,
      45             :       AUTOHINT        = 1 << 1,
      46             :       EMBEDDED_BITMAP = 1 << 2,
      47             :       EMBOLDEN        = 1 << 3,
      48             :       VERTICAL_LAYOUT = 1 << 4,
      49             :       HINT_METRICS    = 1 << 5
      50             :     };
      51             : 
      52             :     InstanceData(cairo_scaled_font_t* aScaledFont, FcPattern* aPattern);
      53             : 
      54             :     void SetupPattern(FcPattern* aPattern) const;
      55             :     void SetupFontOptions(cairo_font_options_t* aFontOptions) const;
      56             :     void SetupFontMatrix(cairo_matrix_t* aFontMatrix) const;
      57             : 
      58             :     uint8_t mFlags;
      59             :     uint8_t mHintStyle;
      60             :     uint8_t mSubpixelOrder;
      61             :     uint8_t mLcdFilter;
      62             :     Float mScale;
      63             :     Float mSkew;
      64             :   };
      65             : 
      66             :   static already_AddRefed<ScaledFont>
      67             :     CreateFromInstanceData(const InstanceData& aInstanceData,
      68             :                            UnscaledFontFontconfig* aUnscaledFont,
      69             :                            Float aSize,
      70             :                            NativeFontResource* aNativeFontResource = nullptr);
      71             : 
      72             :   FcPattern* mPattern;
      73             : };
      74             : 
      75             : }
      76             : }
      77             : 
      78             : #endif /* MOZILLA_GFX_SCALEDFONTFONTCONFIG_H_ */

Generated by: LCOV version 1.13