LCOV - code coverage report
Current view: top level - vcl/source/gdi - metric.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 72 0.0 %
Date: 2014-04-14 Functions: 0 19 0.0 %
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             : #include <impfont.hxx>
      21             : #include <vcl/metric.hxx>
      22             : 
      23             : #include <vector>
      24             : #include <set>
      25             : 
      26             : #include <cstdio>
      27             : 
      28           0 : ImplFontMetric::ImplFontMetric()
      29             : :   mnAscent( 0 ),
      30             :     mnDescent( 0 ),
      31             :     mnIntLeading( 0 ),
      32             :     mnExtLeading( 0 ),
      33             :     mnLineHeight( 0 ),
      34             :     mnSlant( 0 ),
      35             :     mnMiscFlags( 0 ),
      36           0 :     mnRefCount( 1 )
      37           0 : {}
      38             : 
      39           0 : inline void ImplFontMetric::AddReference()
      40             : {
      41             :     // TODO: disable refcounting on the default maps?
      42           0 :     ++mnRefCount;
      43           0 : }
      44             : 
      45           0 : inline void ImplFontMetric::DeReference()
      46             : {
      47             :     // TODO: disable refcounting on the default maps?
      48           0 :     if( --mnRefCount <= 0 )
      49           0 :         delete this;
      50           0 : }
      51             : 
      52           0 : bool ImplFontMetric::operator==( const ImplFontMetric& r ) const
      53             : {
      54           0 :     if( mnMiscFlags  != r.mnMiscFlags )
      55           0 :         return false;
      56           0 :     if( mnAscent     != r.mnAscent )
      57           0 :         return false;
      58           0 :     if( mnDescent    != r.mnDescent )
      59           0 :         return false;
      60           0 :     if( mnIntLeading != r.mnIntLeading )
      61           0 :         return false;
      62           0 :     if( mnExtLeading != r.mnExtLeading )
      63           0 :         return false;
      64           0 :     if( mnSlant      != r.mnSlant )
      65           0 :         return false;
      66             : 
      67           0 :     return true;
      68             : }
      69             : 
      70           0 : FontInfo::FontInfo()
      71           0 : :   mpImplMetric( new ImplFontMetric )
      72           0 : {}
      73             : 
      74           0 : FontInfo::FontInfo( const FontInfo& rInfo )
      75           0 : :  Font( rInfo )
      76             : {
      77           0 :     mpImplMetric = rInfo.mpImplMetric;
      78           0 :     mpImplMetric->AddReference();
      79           0 : }
      80             : 
      81           0 : FontInfo::~FontInfo()
      82             : {
      83           0 :     mpImplMetric->DeReference();
      84           0 : }
      85             : 
      86           0 : FontInfo& FontInfo::operator=( const FontInfo& rInfo )
      87             : {
      88           0 :     Font::operator=( rInfo );
      89             : 
      90           0 :     if( mpImplMetric != rInfo.mpImplMetric )
      91             :     {
      92           0 :         mpImplMetric->DeReference();
      93           0 :         mpImplMetric = rInfo.mpImplMetric;
      94           0 :         mpImplMetric->AddReference();
      95             :     }
      96             : 
      97           0 :     return *this;
      98             : }
      99             : 
     100           0 : bool FontInfo::operator==( const FontInfo& rInfo ) const
     101             : {
     102           0 :     if( !Font::operator==( rInfo ) )
     103           0 :         return false;
     104           0 :     if( mpImplMetric == rInfo.mpImplMetric )
     105           0 :         return true;
     106           0 :     if( *mpImplMetric == *rInfo.mpImplMetric  )
     107           0 :         return true;
     108           0 :     return false;
     109             : }
     110             : 
     111           0 : FontType FontInfo::GetType() const
     112             : {
     113           0 :     return (mpImplMetric->IsScalable() ? TYPE_SCALABLE : TYPE_RASTER);
     114             : }
     115             : 
     116           0 : FontMetric::FontMetric( const FontMetric& rMetric )
     117           0 : :    FontInfo( rMetric )
     118           0 : {}
     119             : 
     120           0 : long FontMetric::GetAscent() const
     121             : {
     122           0 :     return mpImplMetric->GetAscent();
     123             : }
     124             : 
     125           0 : long FontMetric::GetDescent() const
     126             : {
     127           0 :     return mpImplMetric->GetDescent();
     128             : }
     129             : 
     130           0 : long FontMetric::GetIntLeading() const
     131             : {
     132           0 :     return mpImplMetric->GetIntLeading();
     133             : }
     134             : 
     135           0 : long FontMetric::GetExtLeading() const
     136             : {
     137           0 :     return mpImplMetric->GetExtLeading();
     138             : }
     139             : 
     140           0 : long FontMetric::GetLineHeight() const
     141             : {
     142           0 :     return mpImplMetric->GetLineHeight();
     143             : }
     144             : 
     145           0 : long FontMetric::GetSlant() const
     146             : {
     147           0 :     return mpImplMetric->GetSlant();
     148             : }
     149             : 
     150           0 : FontMetric& FontMetric::operator =( const FontMetric& rMetric )
     151             : {
     152           0 :     FontInfo::operator=( rMetric );
     153           0 :     return *this;
     154             : }
     155             : 
     156           0 : bool FontMetric::operator==( const FontMetric& rMetric ) const
     157             : {
     158           0 :     return FontInfo::operator==( rMetric );
     159             : }
     160             : 
     161             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10