diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-05 13:09:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-05 15:11:12 +0200 |
commit | 4b557c96597a9bbb51677fd83bac98a2edbb9db1 (patch) | |
tree | da031b299e570520a682127e60e83fd7082b8867 /vcl | |
parent | 1e529c9338ab663aa2b19b967a947dbf68fd8082 (diff) |
flatten and simplify FontMetric
Change-Id: I9cce47c132345e40d3500ba69178e871d68bf764
Reviewed-on: https://gerrit.libreoffice.org/75130
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-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 |
3 files changed, 14 insertions, 193 deletions
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() ); |