LCOV - code coverage report
Current view: top level - vcl/source/gdi - pdffontcache.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 31 0.0 %
Date: 2012-08-25 Functions: 0 3 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 58 0.0 %

           Branch data     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                 :            : 
      21                 :            : #include "pdffontcache.hxx"
      22                 :            : #include <salgdi.hxx>
      23                 :            : #include <outfont.hxx>
      24                 :            : #include <sallayout.hxx>
      25                 :            : 
      26                 :            : using namespace vcl;
      27                 :            : 
      28                 :          0 : PDFFontCache::FontIdentifier::FontIdentifier( const PhysicalFontFace* pFont, bool bVertical ) :
      29                 :          0 :     m_nFontId( pFont->GetFontId() ),
      30                 :          0 :     m_nMagic( pFont->GetFontMagic() ),
      31                 :          0 :     m_bVertical( bVertical )
      32                 :            : {
      33                 :          0 : }
      34                 :            : 
      35                 :          0 : PDFFontCache::FontData& PDFFontCache::getFont( const PhysicalFontFace* pFont, bool bVertical )
      36                 :            : {
      37         [ #  # ]:          0 :     FontIdentifier aId( pFont, bVertical );
      38         [ #  # ]:          0 :     FontToIndexMap::iterator it = m_aFontToIndex.find( aId );
      39         [ #  # ]:          0 :     if( it != m_aFontToIndex.end() )
      40                 :          0 :         return m_aFonts[ it->second ];
      41         [ #  # ]:          0 :     m_aFontToIndex[ aId ] = sal_uInt32(m_aFonts.size());
      42 [ #  # ][ #  # ]:          0 :     m_aFonts.push_back( FontData() );
      43         [ #  # ]:          0 :     return m_aFonts.back();
      44                 :            : }
      45                 :            : 
      46                 :          0 : sal_Int32 PDFFontCache::getGlyphWidth( const PhysicalFontFace* pFont, sal_GlyphId nGlyph, bool bVertical, SalGraphics* pGraphics )
      47                 :            : {
      48                 :          0 :     sal_Int32 nWidth = 0;
      49                 :          0 :     FontData& rFontData( getFont( pFont, bVertical ) );
      50         [ #  # ]:          0 :     if( rFontData.m_nWidths.empty() )
      51                 :            :     {
      52                 :          0 :         pGraphics->GetGlyphWidths( pFont, bVertical, rFontData.m_nWidths, rFontData.m_aGlyphIdToIndex );
      53                 :            :     }
      54         [ #  # ]:          0 :     if( ! rFontData.m_nWidths.empty() )
      55                 :            :     {
      56                 :          0 :         sal_GlyphId nIndex = nGlyph;
      57         [ #  # ]:          0 :         if( (nGlyph & GF_ISCHAR) != 0 )
      58                 :            :         {
      59                 :          0 :             const sal_Ucs cCode = static_cast<sal_Ucs>(nGlyph & GF_IDXMASK);
      60 [ #  # ][ #  # ]:          0 :             Ucs2UIntMap::const_iterator it = rFontData.m_aGlyphIdToIndex.find( cCode );
      61                 :            : 
      62                 :            :             // allow symbol aliasing U+00xx -> U+F0xx if there is no direct match
      63 [ #  # ][ #  # ]:          0 :             if( it == rFontData.m_aGlyphIdToIndex.end()
           [ #  #  #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
             #  #  #  # ]
      64                 :          0 :             &&  pFont->IsSymbolFont()
      65                 :            :             &&  (cCode < 0x0100) )
      66 [ #  # ][ #  # ]:          0 :                 it = rFontData.m_aGlyphIdToIndex.find( cCode+0xF000 );
      67                 :            : 
      68 [ #  # ][ #  # ]:          0 :             nIndex = (it != rFontData.m_aGlyphIdToIndex.end()) ? it->second : 0;
         [ #  # ][ #  # ]
      69                 :            :         }
      70                 :          0 :         nIndex &= GF_IDXMASK;
      71         [ #  # ]:          0 :         if( nIndex < rFontData.m_nWidths.size() )
      72                 :          0 :             nWidth = rFontData.m_nWidths[ nIndex ];
      73                 :            :     }
      74                 :          0 :     return nWidth;
      75                 :            : }
      76                 :            : 
      77                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10