LCOV - code coverage report
Current view: top level - vcl/inc - cairotextrender.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 6 6 100.0 %
Date: 2015-06-13 12:38:46 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_VCL_INC_UNX_CAIROTEXTRENDER_HXX
      21             : #define INCLUDED_VCL_INC_UNX_CAIROTEXTRENDER_HXX
      22             : 
      23             : #include "textrender.hxx"
      24             : #include <vcl/region.hxx>
      25             : #include <deque>
      26             : 
      27             : typedef struct FT_FaceRec_* FT_Face;
      28             : 
      29             : class PspSalPrinter;
      30             : class PspSalInfoPrinter;
      31             : class ServerFont;
      32             : class GlyphCache;
      33             : class ImplLayoutArgs;
      34             : class ServerFontLayout;
      35             : class PhysicalFontCollection;
      36             : class PhysicalFontFace;
      37             : typedef struct _cairo cairo_t;
      38             : 
      39             : class VCL_DLLPUBLIC CairoFontsCache
      40             : {
      41             : public:
      42             :     struct CacheId
      43             :     {
      44             :         FT_Face maFace;
      45             :         const void *mpOptions;
      46             :         bool mbEmbolden;
      47             :         bool mbVerticalMetrics;
      48           2 :         bool operator ==(const CacheId& rOther) const
      49             :         {
      50           4 :             return maFace == rOther.maFace &&
      51           4 :                 mpOptions == rOther.mpOptions &&
      52           6 :                 mbEmbolden == rOther.mbEmbolden &&
      53           4 :                 mbVerticalMetrics == rOther.mbVerticalMetrics;
      54             :         }
      55             :     };
      56             : 
      57             : private:
      58             :     static int      mnRefCount;
      59             :     typedef         std::deque< std::pair<void *, CacheId> > LRUFonts;
      60             :     static LRUFonts maLRUFonts;
      61             : public:
      62             :                                 CairoFontsCache();
      63             :                                 ~CairoFontsCache();
      64             : 
      65             :     static void                 CacheFont(void *pFont, const CacheId &rId);
      66             :     static void*                FindCachedFont(const CacheId &rId);
      67             : };
      68             : 
      69         196 : class VCL_DLLPUBLIC CairoTextRender : public TextRenderImpl
      70             : {
      71             :     ServerFont*     mpServerFont[ MAX_FALLBACK ];
      72             : 
      73             :     SalColor        mnTextColor;
      74             :     CairoFontsCache m_aCairoFontsCache;
      75             : 
      76             :     bool            bDisableGraphite_;
      77             : 
      78             : protected:
      79             :     virtual GlyphCache&         getPlatformGlyphCache() = 0;
      80             :     virtual cairo_t*            getCairoContext() = 0;
      81             :     virtual void                getSurfaceOffset(double& nDX, double& nDY) = 0;
      82             :     virtual void                drawSurface(cairo_t* cr) = 0;
      83             : 
      84             :     bool                        setFont( const FontSelectPattern *pEntry, int nFallbackLevel );
      85             : 
      86             :     virtual void                clipRegion(cairo_t* cr) = 0;
      87             : 
      88             : public:
      89             :                                 CairoTextRender();
      90             : 
      91             : 
      92             :     virtual void                SetTextColor( SalColor nSalColor ) SAL_OVERRIDE;
      93             :     virtual sal_uInt16          SetFont( FontSelectPattern*, int nFallbackLevel ) SAL_OVERRIDE;
      94             :     virtual void                GetFontMetric( ImplFontMetricData*, int nFallbackLevel ) SAL_OVERRIDE;
      95             :     virtual const FontCharMapPtr GetFontCharMap() const SAL_OVERRIDE;
      96             :     virtual bool                GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const SAL_OVERRIDE;
      97             :     virtual void                GetDevFontList( PhysicalFontCollection* ) SAL_OVERRIDE;
      98             :     virtual void                ClearDevFontCache() SAL_OVERRIDE;
      99             :     virtual bool                AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) SAL_OVERRIDE;
     100             :     virtual bool                CreateFontSubset(
     101             :                                     const OUString& rToFile,
     102             :                                     const PhysicalFontFace*,
     103             :                                     const sal_GlyphId* pGlyphIDs,
     104             :                                     const sal_uInt8* pEncoding,
     105             :                                     sal_Int32* pWidths,
     106             :                                     int nGlyphs,
     107             :                                     FontSubsetInfo& rInfo) SAL_OVERRIDE;
     108             : 
     109             :     virtual const Ucs2SIntMap*  GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const**) SAL_OVERRIDE;
     110             :     virtual const void*         GetEmbedFontData(
     111             :                                     const PhysicalFontFace*,
     112             :                                     const sal_Ucs* pUnicodes,
     113             :                                     sal_Int32* pWidths,
     114             :                                     size_t nLen,
     115             :                                     FontSubsetInfo& rInfo,
     116             :                                     long* pDataLen ) SAL_OVERRIDE;
     117             : 
     118             :     virtual void                FreeEmbedFontData( const void* pData, long nDataLen ) SAL_OVERRIDE;
     119             :     virtual void                GetGlyphWidths(
     120             :                                     const PhysicalFontFace*,
     121             :                                     bool bVertical,
     122             :                                     Int32Vector& rWidths,
     123             :                                     Ucs2UIntMap& rUnicodeEnc ) SAL_OVERRIDE;
     124             : 
     125             :     virtual bool                GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ) SAL_OVERRIDE;
     126             :     virtual bool                GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ) SAL_OVERRIDE;
     127             :     virtual SalLayout*          GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) SAL_OVERRIDE;
     128             :     virtual void                DrawServerFontLayout( const ServerFontLayout& ) SAL_OVERRIDE;
     129             :     virtual SystemFontData      GetSysFontData( int nFallbackLevel ) const SAL_OVERRIDE;
     130             : };
     131             : 
     132             : #endif
     133             : 
     134             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11