LibreOffice Module vcl (master)  1
impfontmetricdata.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_VCL_INC_IMPFONTMETRICDATA_HXX
21 #define INCLUDED_VCL_INC_IMPFONTMETRICDATA_HXX
22 
23 #include <vcl/dllapi.h>
24 #include <tools/ref.hxx>
25 #include "fontattributes.hxx"
26 #include "sft.hxx"
27 
28 #include <vector>
29 
32 
33 class OutputDevice;
34 class FontSelectPattern;
36 
38 {
39 public:
40  explicit ImplFontMetricData( const FontSelectPattern& );
41 
42  // font instance attributes from the font request
43  long GetWidth() const { return mnWidth; }
44  short GetOrientation() const { return mnOrientation; }
45 
46  void SetWidth(long nWidth) { mnWidth=nWidth; }
47  void SetOrientation(short nOrientation) { mnOrientation=nOrientation; }
48 
49  // font metrics measured for the font instance
50  long GetAscent() const { return mnAscent; }
51  long GetDescent() const { return mnDescent; }
52  long GetInternalLeading() const { return mnIntLeading; }
53  long GetExternalLeading() const { return mnExtLeading; }
54  int GetSlant() const { return mnSlant; }
55  long GetMinKashida() const { return mnMinKashida; }
56 
57  void SetSlant(int nSlant) { mnSlant=nSlant; }
58  void SetMinKashida( long nMinKashida ) { mnMinKashida=nMinKashida; }
59 
60  // font attributes queried from the font instance
61  bool IsFullstopCentered() const { return mbFullstopCentered; }
62  long GetBulletOffset() const { return mnBulletOffset; }
63 
64  void SetFullstopCenteredFlag(bool bFullstopCentered) { mbFullstopCentered = bFullstopCentered; }
65 
66  // font metrics that are usually derived from the measurements
67  long GetUnderlineSize() const { return mnUnderlineSize; }
68  long GetUnderlineOffset() const { return mnUnderlineOffset; }
69  long GetBoldUnderlineSize() const { return mnBUnderlineSize; }
70  long GetBoldUnderlineOffset() const { return mnBUnderlineOffset; }
71  long GetDoubleUnderlineSize() const { return mnDUnderlineSize; }
72  long GetDoubleUnderlineOffset1() const { return mnDUnderlineOffset1; }
73  long GetDoubleUnderlineOffset2() const { return mnDUnderlineOffset2; }
74  long GetWavelineUnderlineSize() const { return mnWUnderlineSize; }
75  long GetWavelineUnderlineOffset() const { return mnWUnderlineOffset; }
76  long GetAboveUnderlineSize() const { return mnAboveUnderlineSize; }
77  long GetAboveUnderlineOffset() const { return mnAboveUnderlineOffset; }
78  long GetAboveBoldUnderlineSize() const { return mnAboveBUnderlineSize; }
79  long GetAboveBoldUnderlineOffset() const { return mnAboveBUnderlineOffset; }
80  long GetAboveDoubleUnderlineSize() const { return mnAboveDUnderlineSize; }
81  long GetAboveDoubleUnderlineOffset1() const { return mnAboveDUnderlineOffset1; }
82  long GetAboveDoubleUnderlineOffset2() const { return mnAboveDUnderlineOffset2; }
83  long GetAboveWavelineUnderlineSize() const { return mnAboveWUnderlineSize; }
84  long GetAboveWavelineUnderlineOffset() const { return mnAboveWUnderlineOffset; }
85  long GetStrikeoutSize() const { return mnStrikeoutSize; }
86  long GetStrikeoutOffset() const { return mnStrikeoutOffset; }
87  long GetBoldStrikeoutSize() const { return mnBStrikeoutSize; }
88  long GetBoldStrikeoutOffset() const { return mnBStrikeoutOffset; }
89  long GetDoubleStrikeoutSize() const { return mnDStrikeoutSize; }
90  long GetDoubleStrikeoutOffset1() const { return mnDStrikeoutOffset1; }
91  long GetDoubleStrikeoutOffset2() const { return mnDStrikeoutOffset2; }
92 
93  void ImplInitTextLineSize( const OutputDevice* pDev );
94  void ImplInitAboveTextLineSize();
95  void ImplInitFlags( const OutputDevice* pDev );
96  void ImplCalcLineSpacing(LogicalFontInstance *pFontInstance);
97 
98 private:
99  bool ShouldUseWinMetrics(const vcl::TTGlobalFontInfo& rInfo);
100 
101  // font instance attributes from the font request
102  long const mnHeight; // Font size
103  long mnWidth; // Reference Width
104  short mnOrientation; // Rotation in 1/10 degrees
105 
106  // font metrics measured for the font instance
107  long mnAscent; // Ascent
108  long mnDescent; // Descent
109  long mnIntLeading; // Internal Leading
110  long mnExtLeading; // External Leading
111  int mnSlant; // Slant (Italic/Oblique)
112  long mnMinKashida; // Minimal width of kashida (Arabic)
113 
114  // font attributes queried from the font instance
116  long mnBulletOffset; // Offset to position non-print character
117 
118  // font metrics that are usually derived from the measurements
119  long mnUnderlineSize; // Lineheight of Underline
120  long mnUnderlineOffset; // Offset from Underline to Baseline
121  long mnBUnderlineSize; // Height of bold underline
122  long mnBUnderlineOffset; // Offset from bold underline to baseline
123  long mnDUnderlineSize; // Height of double underline
124  long mnDUnderlineOffset1; // Offset from double underline to baseline
125  long mnDUnderlineOffset2; // Offset from double underline to baseline
126  long mnWUnderlineSize; // Height of WaveLine underline
127  long mnWUnderlineOffset; // Offset from WaveLine underline to baseline, but centrered to WaveLine
128  long mnAboveUnderlineSize; // Height of single underline (for Vertical Right)
129  long mnAboveUnderlineOffset; // Offset from single underline to baseline (for Vertical Right)
130  long mnAboveBUnderlineSize; // Height of bold underline (for Vertical Right)
131  long mnAboveBUnderlineOffset; // Offset from bold underline to baseline (for Vertical Right)
132  long mnAboveDUnderlineSize; // Height of double underline (for Vertical Right)
133  long mnAboveDUnderlineOffset1; // Offset from double underline to baseline (for Vertical Right)
134  long mnAboveDUnderlineOffset2; // Offset from double underline to baseline (for Vertical Right)
135  long mnAboveWUnderlineSize; // Height of WaveLine-strike-out (for Vertical Right)
136  long mnAboveWUnderlineOffset; // Offset from WaveLine-strike-out to baseline, but centrered to the WaveLine (for Vertical Right)
137  long mnStrikeoutSize; // Height of single strike-out
138  long mnStrikeoutOffset; // Offset from single strike-out to baseline
139  long mnBStrikeoutSize; // Height of bold strike-out
140  long mnBStrikeoutOffset; // Offset of bold strike-out to baseline
141  long mnDStrikeoutSize; // Height of double strike-out
142  long mnDStrikeoutOffset1; // Offset of double strike-out to baseline
143  long mnDStrikeoutOffset2; // Offset of double strike-out to baseline
144 
145 };
146 
147 #endif // INCLUDED_VCL_INC_IMPFONTMETRICDATA_HXX
148 
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long GetAboveDoubleUnderlineSize() const
long GetMinKashida() const
void SetWidth(long nWidth)
long GetBoldStrikeoutSize() const
long GetAboveDoubleUnderlineOffset1() const
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
long GetAboveWavelineUnderlineSize() const
long GetStrikeoutOffset() const
Return value of GetTTGlobalFontInfo()
Definition: sft.hxx:146
long GetDoubleStrikeoutOffset2() const
long GetAboveBoldUnderlineOffset() const
long GetAboveBoldUnderlineSize() const
long GetAboveWavelineUnderlineOffset() const
long GetAboveDoubleUnderlineOffset2() const
long GetBoldUnderlineSize() const
long GetAboveUnderlineSize() const
long GetDoubleStrikeoutOffset1() const
long GetDoubleUnderlineSize() const
void SetOrientation(short nOrientation)
long GetDescent() const
long GetUnderlineSize() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
long GetBoldUnderlineOffset() const
long GetExternalLeading() const
long GetWavelineUnderlineSize() const
long GetWavelineUnderlineOffset() const
void SetSlant(int nSlant)
long GetStrikeoutSize() const
long GetDoubleUnderlineOffset1() const
long GetUnderlineOffset() const
bool IsFullstopCentered() const
Sun Font Tools.
double mnWidth
short GetOrientation() const
long GetBulletOffset() const
long GetDoubleUnderlineOffset2() const
void SetMinKashida(long nMinKashida)
long GetAboveUnderlineOffset() const
tools::SvRef< ImplFontMetricData > ImplFontMetricDataRef
long GetBoldStrikeoutOffset() const
long GetInternalLeading() const
void SetFullstopCenteredFlag(bool bFullstopCentered)
long GetDoubleStrikeoutSize() const