diff options
-rw-r--r-- | include/vcl/metric.hxx | 46 | ||||
-rw-r--r-- | vcl/inc/impfontmetric.hxx | 70 | ||||
-rw-r--r-- | vcl/source/font/fontmetric.cxx | 135 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 2 |
4 files changed, 41 insertions, 212 deletions
diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx index 55d26cede8fd..0eb584960c16 100644 --- a/include/vcl/metric.hxx +++ b/include/vcl/metric.hxx @@ -25,7 +25,6 @@ #include <tools/ref.hxx> #include <tools/gen.hxx> -class ImplFontMetric; class FontCharMap; typedef sal_uInt32 sal_UCS4; @@ -36,35 +35,44 @@ class VCL_DLLPUBLIC FontMetric : public vcl::Font public: explicit FontMetric(); FontMetric( const FontMetric& ); // TODO make this explicit - virtual ~FontMetric() override; + ~FontMetric() override; - long GetAscent() const; - long GetDescent() const; - long GetInternalLeading() const; - long GetExternalLeading() const; - long GetLineHeight() const; - long GetSlant() const; - long GetBulletOffset() const; + long GetAscent() const { return mnAscent; } + long GetDescent() const { return mnDescent; } + long GetInternalLeading() const { return mnIntLeading; } + long GetExternalLeading() const { return mnExtLeading; } + long GetLineHeight() const { return mnLineHeight; } // TODO this is ascent + descnt + long GetSlant() const { return mnSlant; } + long GetBulletOffset() const { return mnBulletOffset; } - void SetAscent(long); - void SetDescent(long); - void SetExternalLeading(long); - void SetInternalLeading(long); - void SetLineHeight(long); - void SetSlant(long); - void SetBulletOffset(long); + void SetAscent( long nAscent ) { mnAscent = nAscent; } + void SetDescent( long nDescent ) { mnDescent = nDescent; } + void SetExternalLeading( long nExtLeading ) { mnExtLeading = nExtLeading; } + void SetInternalLeading( long nIntLeading ) { mnIntLeading = nIntLeading; } + void SetLineHeight( long nHeight ) { mnLineHeight = nHeight; } // TODO this is ascent + descent + void SetSlant( long nSlant ) { mnSlant = nSlant; } + void SetBulletOffset( long nOffset ) { mnBulletOffset = nOffset; } - bool IsFullstopCentered() const; + bool IsFullstopCentered() const { return mbFullstopCentered; } - void SetFullstopCenteredFlag(bool); + void SetFullstopCenteredFlag( bool bCentered ) { mbFullstopCentered = bCentered; } + using Font::operator=; FontMetric& operator=( const FontMetric& rMetric ); FontMetric& operator=( FontMetric&& rMetric ); bool operator==( const FontMetric& rMetric ) const; bool operator!=( const FontMetric& rMetric ) const { return !operator==( rMetric ); } private: - tools::SvRef<ImplFontMetric> mxImplMetric; // Implementation + long mnAscent; // Ascent + long mnDescent; // Descent + long mnIntLeading; // Internal Leading + long mnExtLeading; // External Leading + long mnLineHeight; // Ascent+Descent+EmphasisMark + long mnSlant; // Slant + long mnBulletOffset; // Offset for non-printing character + + bool mbFullstopCentered; }; template< typename charT, typename traits > diff --git a/vcl/inc/impfontmetric.hxx b/vcl/inc/impfontmetric.hxx deleted file mode 100644 index 6267a30fddfd..000000000000 --- a/vcl/inc/impfontmetric.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_VCL_INC_IMPFONTMETRIC_HXX -#define INCLUDED_VCL_INC_IMPFONTMETRIC_HXX - -class ImplFontCharMap; -typedef tools::SvRef<ImplFontCharMap> ImplFontCharMapRef; - -class ImplFontMetric : public SvRefBase -{ -public: - explicit ImplFontMetric(); - - long GetAscent() const { return mnAscent; } - long GetDescent() const { return mnDescent; } - long GetInternalLeading() const { return mnIntLeading; } - long GetExternalLeading() const { return mnExtLeading; } - long GetLineHeight() const { return mnLineHeight; } // TODO this is ascent + descnt - long GetSlant() const { return mnSlant; } - long GetBulletOffset() const { return mnBulletOffset; } - - void SetAscent( long nAscent ) { mnAscent = nAscent; } - void SetDescent( long nDescent ) { mnDescent = nDescent; } - void SetInternalLeading( long nIntLeading ) { mnIntLeading = nIntLeading; } - void SetExternalLeading( long nExtLeading ) { mnExtLeading = nExtLeading; } - void SetLineHeight( long nHeight ) { mnLineHeight = nHeight; } // TODO this is ascent + descent - void SetSlant( long nSlant ) { mnSlant = nSlant; } - void SetBulletOffset( long nOffset ) { mnBulletOffset = nOffset; } - - bool IsFullstopCentered() const { return mbFullstopCentered; } - - void SetFullstopCenteredFlag( bool bCentered ) { mbFullstopCentered = bCentered; } - - bool operator==( const ImplFontMetric& ) const; - -private: - friend class FontMetric; - - long mnAscent; // Ascent - long mnDescent; // Descent - long mnIntLeading; // Internal Leading - long mnExtLeading; // External Leading - long mnLineHeight; // Ascent+Descent+EmphasisMark - long mnSlant; // Slant - long mnBulletOffset; // Offset for non-printing character - - bool mbFullstopCentered; - -}; - -#endif // INCLUDED_VCL_INC_IMPFONTMETRIC_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx index ac19917d9221..676e979208f8 100644 --- a/vcl/source/font/fontmetric.cxx +++ b/vcl/source/font/fontmetric.cxx @@ -27,7 +27,6 @@ #include <fontinstance.hxx> #include <fontselect.hxx> -#include <impfontmetric.hxx> #include <impfontmetricdata.hxx> #include <PhysicalFontFace.hxx> #include <sft.hxx> @@ -45,126 +44,6 @@ using namespace ::rtl; using namespace ::utl; FontMetric::FontMetric() -: mxImplMetric( new ImplFontMetric() ) -{} - -FontMetric::FontMetric( const FontMetric& rFontMetric ) - : Font( rFontMetric ) - , mxImplMetric( rFontMetric.mxImplMetric ) -{} - -FontMetric::~FontMetric() -{ - mxImplMetric = nullptr; -} - -FontMetric& FontMetric::operator=(const FontMetric& rFontMetric) -{ - Font::operator=(rFontMetric); - mxImplMetric = rFontMetric.mxImplMetric; - return *this; -} - -FontMetric& FontMetric::operator=(FontMetric&& rFontMetric) -{ - mxImplMetric = std::move(rFontMetric.mxImplMetric); - Font::operator=(std::move(rFontMetric)); - return *this; -} - -bool FontMetric::operator==( const FontMetric& rFontMetric ) const -{ - if( !Font::operator==( rFontMetric ) ) - return false; - if( mxImplMetric == rFontMetric.mxImplMetric ) - return true; - if( *mxImplMetric == *rFontMetric.mxImplMetric ) - return true; - return false; -} - -long FontMetric::GetAscent() const -{ - return mxImplMetric->GetAscent(); -} - -void FontMetric::SetAscent( long nAscent ) -{ - mxImplMetric->SetAscent( nAscent ); -} - -long FontMetric::GetDescent() const -{ - return mxImplMetric->GetDescent(); -} - -void FontMetric::SetDescent( long nDescent ) -{ - mxImplMetric->SetDescent( nDescent ); -} - -long FontMetric::GetInternalLeading() const -{ - return mxImplMetric->GetInternalLeading(); -} - -void FontMetric::SetInternalLeading( long nLeading ) -{ - mxImplMetric->SetInternalLeading( nLeading ); -} - -long FontMetric::GetExternalLeading() const -{ - return mxImplMetric->GetExternalLeading(); -} - -void FontMetric::SetExternalLeading( long nLeading ) -{ - mxImplMetric->SetExternalLeading( nLeading ); -} - -long FontMetric::GetLineHeight() const -{ - return mxImplMetric->GetLineHeight(); -} - -void FontMetric::SetLineHeight( long nHeight ) -{ - mxImplMetric->SetLineHeight( nHeight ); -} - -long FontMetric::GetSlant() const -{ - return mxImplMetric->GetSlant(); -} - -void FontMetric::SetSlant( long nSlant ) -{ - mxImplMetric->SetSlant( nSlant ); -} - -long FontMetric::GetBulletOffset() const -{ - return mxImplMetric->GetBulletOffset(); -} - -void FontMetric::SetBulletOffset( long nOffset ) -{ - mxImplMetric->SetBulletOffset( nOffset ); -} - -bool FontMetric::IsFullstopCentered() const -{ - return mxImplMetric->IsFullstopCentered(); -} - -void FontMetric::SetFullstopCenteredFlag(bool bScalable) -{ - mxImplMetric->SetFullstopCenteredFlag( bScalable ); -} - - -ImplFontMetric::ImplFontMetric() : mnAscent( 0 ), mnDescent( 0 ), mnIntLeading( 0 ), @@ -175,8 +54,20 @@ ImplFontMetric::ImplFontMetric() mbFullstopCentered( false ) {} -bool ImplFontMetric::operator==( const ImplFontMetric& r ) const +FontMetric::FontMetric( const FontMetric& rFontMetric ) = default; + +FontMetric::~FontMetric() { +} + +FontMetric& FontMetric::operator=(const FontMetric& rFontMetric) = default; + +FontMetric& FontMetric::operator=(FontMetric&& rFontMetric) = default; + +bool FontMetric::operator==( const FontMetric& r ) const +{ + if( Font::operator!=(r) ) + return false; if (mbFullstopCentered != r.mbFullstopCentered) return false; if( mnAscent != r.mnAscent ) diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 0467f2f7c1ae..48b82d4e856e 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -204,7 +204,7 @@ FontMetric OutputDevice::GetFontMetric() const ImplFontMetricDataRef xFontMetric = pFontInstance->mxFontMetric; // prepare metric - aMetric.Font::operator=( maFont ); + aMetric = maFont; // set aMetric with info from font aMetric.SetFamilyName( maFont.GetFamilyName() ); |