Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / vcl / inc / impfontmetricdata.hxx
blobc8180fc2e10f5b3a308c623907f750c46978710d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef INCLUDED_VCL_INC_IMPFONTMETRICDATA_HXX
21 #define INCLUDED_VCL_INC_IMPFONTMETRICDATA_HXX
23 #include <vcl/dllapi.h>
25 #include "fontattributes.hxx"
27 #include <boost/intrusive_ptr.hpp>
29 class ImplFontMetricData;
30 typedef boost::intrusive_ptr< ImplFontMetricData > ImplFontMetricDataPtr;
32 class OutputDevice;
33 class FontSelectPattern;
35 class ImplFontMetricData : public FontAttributes
37 public:
38 explicit ImplFontMetricData( const FontSelectPattern& );
40 // font instance attributes from the font request
41 long GetWidth() { return mnWidth; }
42 short GetOrientation() { return mnOrientation; }
44 void SetWidth(long nWidth) { mnWidth=nWidth; }
45 void SetOrientation(short nOrientation) { mnOrientation=nOrientation; }
47 // font metrics measured for the font instance
48 long GetAscent() { return mnAscent; }
49 long GetDescent() { return mnDescent; }
50 long GetInternalLeading() { return mnIntLeading; }
51 long GetExternalLeading() { return mnExtLeading; }
52 int GetSlant() { return mnSlant; }
53 long GetMinKashida() { return mnMinKashida; }
55 void SetAscent(long nAscent) { mnAscent=nAscent; }
56 void SetDescent(long nDescent) { mnDescent=nDescent; }
57 void SetInternalLeading(long nIntLeading) { mnIntLeading = nIntLeading; }
58 void SetExternalLeading(long nExtLeading) { mnExtLeading = nExtLeading; }
59 void SetSlant(int nSlant) { mnSlant=nSlant; }
60 void SetMinKashida( long nMinKashida ) { mnMinKashida=nMinKashida; }
62 // font attributes queried from the font instance
63 bool IsScalable() { return mbScalableFont; }
64 bool IsTrueTypeFont() { return mbTrueTypeFont; }
65 bool IsKernable() { return mbKernableFont; }
66 bool IsFullstopCentered() { return mbFullstopCentered; }
67 long GetBulletOffset() { return mnBulletOffset; }
69 void SetScalableFlag(bool bScalable) { mbScalableFont = bScalable; }
70 void SetTrueTypeFlag(bool bTrueTypeFont) { mbTrueTypeFont = bTrueTypeFont; }
71 void SetKernableFlag(bool bKernable) { mbKernableFont = bKernable; }
72 void SetFullstopCenteredFlag(bool bFullstopCentered) { mbFullstopCentered = bFullstopCentered; }
73 void SetBulletOffset(long nBulletOffset) { mnBulletOffset = nBulletOffset; }
75 // font metrics that are usually derived from the measurements
76 long GetUnderlineSize() { return mnUnderlineSize; }
77 long GetUnderlineOffset() { return mnUnderlineOffset; }
78 long GetBoldUnderlineSize() { return mnBUnderlineSize; }
79 long GetBoldUnderlineOffset() { return mnBUnderlineOffset; }
80 long GetDoubleUnderlineSize() { return mnDUnderlineSize; }
81 long GetDoubleUnderlineOffset1() { return mnDUnderlineOffset1; }
82 long GetDoubleUnderlineOffset2() { return mnDUnderlineOffset2; }
83 long GetWavelineUnderlineSize() { return mnWUnderlineSize; }
84 long GetWavelineUnderlineOffset() { return mnWUnderlineOffset; }
85 long GetAboveUnderlineSize() { return mnAboveUnderlineSize; }
86 long GetAboveUnderlineOffset() { return mnAboveUnderlineOffset; }
87 long GetAboveBoldUnderlineSize() { return mnAboveBUnderlineSize; }
88 long GetAboveBoldUnderlineOffset() { return mnAboveBUnderlineOffset; }
89 long GetAboveDoubleUnderlineSize() { return mnAboveDUnderlineSize; }
90 long GetAboveDoubleUnderlineOffset1() { return mnAboveDUnderlineOffset1; }
91 long GetAboveDoubleUnderlineOffset2() { return mnAboveDUnderlineOffset2; }
92 long GetAboveWavelineUnderlineSize() { return mnAboveWUnderlineSize; }
93 long GetAboveWavelineUnderlineOffset() { return mnAboveWUnderlineOffset; }
94 long GetStrikeoutSize() { return mnStrikeoutSize; }
95 long GetStrikeoutOffset() { return mnStrikeoutOffset; }
96 long GetBoldStrikeoutSize() { return mnBStrikeoutSize; }
97 long GetBoldStrikeoutOffset() { return mnBStrikeoutOffset; }
98 long GetDoubleStrikeoutSize() { return mnDStrikeoutSize; }
99 long GetDoubleStrikeoutOffset1() { return mnDStrikeoutOffset1; }
100 long GetDoubleStrikeoutOffset2() { return mnDStrikeoutOffset2; }
102 void SetUnderlineSize( long nUnderlineSize ) { mnUnderlineSize = nUnderlineSize; }
103 void SetUnderlineOffset( long nUnderlineOffset ) { mnUnderlineOffset = nUnderlineOffset; }
104 void SetBoldUnderlineSize( long nBUnderlineSize ) { mnBUnderlineSize = nBUnderlineSize; }
105 void SetBoldUnderlineOffset( long nBUnderlineOffset ) { mnBUnderlineOffset = nBUnderlineOffset; }
106 void SetDoubleUnderlineSize( long nDUnderlineSize ) { mnDUnderlineSize = nDUnderlineSize; }
107 void SetDoubleUnderlineOffset1( long nDUnderlineOffset1 ) { mnDUnderlineOffset1 = nDUnderlineOffset1; }
108 void SetDoubleUnderlineOffset2( long nDUnderlineOffset2 ) { mnDUnderlineOffset2 = nDUnderlineOffset2; }
109 void SetWavelineUnderlineSize( long nWUnderlineSize ) { mnWUnderlineSize = nWUnderlineSize; }
110 void SetWavelineUnderlineOffset( long nWUnderlineOffset ) { mnWUnderlineOffset = nWUnderlineOffset; }
111 void SetAboveUnderlineSize( long nAboveUnderlineSize ) { mnAboveUnderlineSize = nAboveUnderlineSize; }
112 void SetAboveUnderlineOffset( long nAboveUnderlineOffset ) { mnAboveUnderlineOffset = nAboveUnderlineOffset; }
113 void SetAboveBoldUnderlineSize( long nAboveBUnderlineSize ) { mnAboveBUnderlineSize = nAboveBUnderlineSize; }
114 void SetAboveBoldUnderlineOffset( long nAboveBUnderlineOffset ) { mnAboveBUnderlineOffset = nAboveBUnderlineOffset; }
115 void SetAboveDoubleUnderlineSize( long nAboveDUnderlineSize ) { mnAboveDUnderlineSize = nAboveDUnderlineSize; }
116 void SetAboveDoubleUnderlineOffset1( long nAboveDUnderlineOffset1 ) { mnAboveDUnderlineOffset1 = nAboveDUnderlineOffset1; }
117 void SetAboveDoubleUnderlineOffset2( long nAboveDUnderlineOffset2 ) { mnAboveDUnderlineOffset2 = nAboveDUnderlineOffset2; }
118 void SetAboveWavelineUnderlineSize( long nAboveWUnderlineSize ) { mnAboveWUnderlineSize = nAboveWUnderlineSize; }
119 void SetAboveWavelineUnderlineOffset( long nAboveWUnderlineOffset ) { mnAboveWUnderlineOffset = nAboveWUnderlineOffset; }
120 void SetStrikeoutSize( long nStrikeoutSize ) { mnStrikeoutSize = nStrikeoutSize; }
121 void SetStrikeoutOffset( long nStrikeoutOffset ) { mnStrikeoutOffset = nStrikeoutOffset; }
122 void SetBoldStrikeoutSize( long nBStrikeoutSize ) { mnBStrikeoutSize = nBStrikeoutSize; }
123 void SetBoldStrikeoutOffset( long nBStrikeoutOffset ) { mnBStrikeoutOffset = nBStrikeoutOffset; }
124 void SetDoubleStrikeoutSize( long nDStrikeoutSize ) { mnDStrikeoutSize = nDStrikeoutSize; }
125 void SetDoubleStrikeoutOffset1( long nDStrikeoutOffset1 ) { mnDStrikeoutOffset1 = nDStrikeoutOffset1; }
126 void SetDoubleStrikeoutOffset2( long nDStrikeoutOffset2 ) { mnDStrikeoutOffset2 = nDStrikeoutOffset2; }
128 void ImplInitTextLineSize( const OutputDevice* pDev );
129 void ImplInitAboveTextLineSize();
131 private:
132 friend void intrusive_ptr_add_ref(ImplFontMetricData* pImplFontMetricData);
133 friend void intrusive_ptr_release(ImplFontMetricData* pImplFontMetricData);
135 long mnRefCount;
137 // font instance attributes from the font request
138 long mnWidth; // Reference Width
139 short mnOrientation; // Rotation in 1/10 degrees
141 // font metrics measured for the font instance
142 long mnAscent; // Ascent
143 long mnDescent; // Descent
144 long mnIntLeading; // Internal Leading
145 long mnExtLeading; // External Leading
146 int mnSlant; // Slant (Italic/Oblique)
147 long mnMinKashida; // Minimal width of kashida (Arabic)
149 // font attributes queried from the font instance
150 bool mbScalableFont;
151 bool mbTrueTypeFont;
152 bool mbKernableFont;
153 bool mbFullstopCentered;
154 long mnBulletOffset; // Offset to position non-print character
156 // font metrics that are usually derived from the measurements
157 long mnUnderlineSize; // Lineheight of Underline
158 long mnUnderlineOffset; // Offset from Underline to Baseline
159 long mnBUnderlineSize; // Height of bold underline
160 long mnBUnderlineOffset; // Offset from bold underline to baseline
161 long mnDUnderlineSize; // Height of double underline
162 long mnDUnderlineOffset1; // Offset from double underline to baseline
163 long mnDUnderlineOffset2; // Offset from double underline to baseline
164 long mnWUnderlineSize; // Height of WaveLine underline
165 long mnWUnderlineOffset; // Offset from WaveLine underline to baseline, but centrered to WaveLine
166 long mnAboveUnderlineSize; // Height of single underline (for Vertical Right)
167 long mnAboveUnderlineOffset; // Offset from single underline to baseline (for Vertical Right)
168 long mnAboveBUnderlineSize; // Height of bold underline (for Vertical Right)
169 long mnAboveBUnderlineOffset; // Offset from bold underline to baseline (for Vertical Right)
170 long mnAboveDUnderlineSize; // Height of double underline (for Vertical Right)
171 long mnAboveDUnderlineOffset1; // Offset from double underline to baseline (for Vertical Right)
172 long mnAboveDUnderlineOffset2; // Offset from double underline to baseline (for Vertical Right)
173 long mnAboveWUnderlineSize; // Height of WaveLine-strike-out (for Vertical Right)
174 long mnAboveWUnderlineOffset; // Offset from WaveLine-strike-out to baseline, but centrered to the WaveLine (for Vertical Right)
175 long mnStrikeoutSize; // Height of single strike-out
176 long mnStrikeoutOffset; // Offset from single strike-out to baseline
177 long mnBStrikeoutSize; // Height of bold strike-out
178 long mnBStrikeoutOffset; // Offset of bold strike-out to baseline
179 long mnDStrikeoutSize; // Height of double strike-out
180 long mnDStrikeoutOffset1; // Offset of double strike-out to baseline
181 long mnDStrikeoutOffset2; // Offset of double strike-out to baseline
185 inline void intrusive_ptr_add_ref(ImplFontMetricData* pImplFontMetricData)
187 ++pImplFontMetricData->mnRefCount;
190 inline void intrusive_ptr_release(ImplFontMetricData* pImplFontMetricData)
192 if (--pImplFontMetricData->mnRefCount == 0)
193 delete pImplFontMetricData;
196 #endif // INCLUDED_VCL_INC_IMPFONTMETRICDATA_HXX
198 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */