1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <sal/config.h>
24 #include <tools/ref.hxx>
25 #include <tools/gen.hxx>
27 #include <vcl/dllapi.h>
28 #include <vcl/font.hxx>
31 namespace vcl::font
{ class PhysicalFontFace
; }
33 typedef tools::SvRef
<FontCharMap
> FontCharMapRef
;
35 class VCL_DLLPUBLIC FontMetric
: public vcl::Font
38 explicit FontMetric();
39 FontMetric( const FontMetric
& ); // TODO make this explicit
40 FontMetric(vcl::font::PhysicalFontFace
const& rFace
);
41 ~FontMetric() override
;
43 tools::Long
GetAscent() const { return mnAscent
; }
44 tools::Long
GetDescent() const { return mnDescent
; }
45 tools::Long
GetInternalLeading() const { return mnIntLeading
; }
46 tools::Long
GetExternalLeading() const { return mnExtLeading
; }
47 tools::Long
GetLineHeight() const { return mnLineHeight
; } // TODO this is ascent + descnt
48 tools::Long
GetSlant() const { return mnSlant
; }
49 tools::Long
GetBulletOffset() const { return mnBulletOffset
; }
51 void SetAscent( tools::Long nAscent
) { mnAscent
= nAscent
; }
52 void SetDescent( tools::Long nDescent
) { mnDescent
= nDescent
; }
53 void SetExternalLeading( tools::Long nExtLeading
) { mnExtLeading
= nExtLeading
; }
54 void SetInternalLeading( tools::Long nIntLeading
) { mnIntLeading
= nIntLeading
; }
55 void SetLineHeight( tools::Long nHeight
) { mnLineHeight
= nHeight
; } // TODO this is ascent + descent
56 void SetSlant( tools::Long nSlant
) { mnSlant
= nSlant
; }
57 void SetBulletOffset( tools::Long nOffset
) { mnBulletOffset
= nOffset
; }
59 bool IsFullstopCentered() const { return mbFullstopCentered
; }
61 void SetFullstopCenteredFlag( bool bCentered
) { mbFullstopCentered
= bCentered
; }
63 using Font::operator=;
64 FontMetric
& operator=( const FontMetric
& rMetric
);
65 FontMetric
& operator=( FontMetric
&& rMetric
);
66 bool operator==( const FontMetric
& rMetric
) const;
67 bool operator!=( const FontMetric
& rMetric
) const
68 { return !operator==( rMetric
); }
70 tools::Long mnAscent
; // Ascent
71 tools::Long mnDescent
; // Descent
72 tools::Long mnIntLeading
; // Internal Leading
73 tools::Long mnExtLeading
; // External Leading
74 tools::Long mnLineHeight
; // Ascent+Descent+EmphasisMark
75 tools::Long mnSlant
; // Slant
76 tools::Long mnBulletOffset
; // Offset for non-printing character
78 bool mbFullstopCentered
;
81 template< typename charT
, typename traits
>
82 inline std::basic_ostream
<charT
, traits
> & operator <<(
83 std::basic_ostream
<charT
, traits
> & stream
, const FontMetric
& rMetric
)
86 << "name=" << "\"" << rMetric
.GetFamilyName() << "\""
87 << ",size=(" << rMetric
.GetFontSize().Width() << "," << rMetric
.GetFontSize().Height() << ")"
88 << ",ascent=" << rMetric
.GetAscent()
89 << ",descent=" << rMetric
.GetDescent()
90 << ",intLeading=" << rMetric
.GetInternalLeading()
91 << ",extLeading=" << rMetric
.GetExternalLeading()
92 << ",lineHeight=" << rMetric
.GetLineHeight()
93 << ",slant=" << rMetric
.GetSlant()
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */