/src/libreoffice/vcl/inc/font/FontMetricData.hxx
Line | Count | Source |
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 | | #pragma once |
21 | | |
22 | | #include <sal/config.h> |
23 | | |
24 | | #include <vcl/dllapi.h> |
25 | | #include <tools/degree.hxx> |
26 | | #include <tools/long.hxx> |
27 | | #include <tools/ref.hxx> |
28 | | #include <fontattributes.hxx> |
29 | | |
30 | | class FontMetricData; |
31 | | typedef tools::SvRef<FontMetricData> FontMetricDataRef; |
32 | | |
33 | | class OutputDevice; |
34 | | namespace vcl::font |
35 | | { |
36 | | class FontSelectPattern; |
37 | | } |
38 | | class LogicalFontInstance; |
39 | | |
40 | | class VCL_DLLPUBLIC FontMetricData final : public FontAttributes, public SvRefBase |
41 | | { |
42 | | public: |
43 | | SAL_DLLPRIVATE explicit FontMetricData( const vcl::font::FontSelectPattern& ); |
44 | | |
45 | | // font instance attributes from the font request |
46 | 57.3M | tools::Long GetWidth() const { return mnWidth; } |
47 | 38.5M | Degree10 GetOrientation() const { return mnOrientation; } |
48 | | |
49 | 273k | void SetWidth(tools::Long nWidth) { mnWidth=nWidth; } |
50 | 547k | void SetOrientation(Degree10 nOrientation) { mnOrientation=nOrientation; } |
51 | | |
52 | | // font metrics measured for the font instance |
53 | 119M | tools::Long GetAscent() const { return mnAscent; } |
54 | 115M | tools::Long GetDescent() const { return mnDescent; } |
55 | 76.5M | tools::Long GetInternalLeading() const { return mnIntLeading; } |
56 | 38.2M | tools::Long GetExternalLeading() const { return mnExtLeading; } |
57 | 38.2M | int GetSlant() const { return mnSlant; } |
58 | 5.07k | double GetMinKashida() const { return mnMinKashida; } |
59 | 38.2M | tools::Long GetHangingBaseline() const { return mnHangingBaseline; } |
60 | 38.2M | double GetUnitEm() const { return mdEmSize; } |
61 | 38.2M | double GetHorCJKAdvance() const { return mdHorCJKAdvanceSize; } |
62 | 38.2M | double GetVertCJKAdvance() const { return mdVertCJKAdvanceSize; } |
63 | | |
64 | 273k | void SetSlant(int nSlant) { mnSlant=nSlant; } |
65 | 273k | void SetMinKashida(double nMinKashida ) { mnMinKashida=nMinKashida; } |
66 | | |
67 | | // font attributes queried from the font instance |
68 | 38.2M | bool IsFullstopCentered() const { return mbFullstopCentered; } |
69 | 38.2M | tools::Long GetBulletOffset() const { return mnBulletOffset; } |
70 | | |
71 | 273k | void SetFullstopCenteredFlag(bool bFullstopCentered) { mbFullstopCentered = bFullstopCentered; } |
72 | | |
73 | | // font metrics that are usually derived from the measurements |
74 | 93.4k | tools::Long GetUnderlineSize() const { return mnUnderlineSize; } |
75 | 93.4k | tools::Long GetUnderlineOffset() const { return mnUnderlineOffset; } |
76 | 5.38k | tools::Long GetBoldUnderlineSize() const { return mnBUnderlineSize; } |
77 | 5.38k | tools::Long GetBoldUnderlineOffset() const { return mnBUnderlineOffset; } |
78 | 889 | tools::Long GetDoubleUnderlineSize() const { return mnDUnderlineSize; } |
79 | 889 | tools::Long GetDoubleUnderlineOffset1() const { return mnDUnderlineOffset1; } |
80 | 889 | tools::Long GetDoubleUnderlineOffset2() const { return mnDUnderlineOffset2; } |
81 | 196 | tools::Long GetWavelineUnderlineSize() const { return mnWUnderlineSize; } |
82 | 196 | tools::Long GetWavelineUnderlineOffset() const { return mnWUnderlineOffset; } |
83 | 62.3k | tools::Long GetAboveUnderlineSize() const { return mnAboveUnderlineSize; } |
84 | 62.3k | tools::Long GetAboveUnderlineOffset() const { return mnAboveUnderlineOffset; } |
85 | 7.93k | tools::Long GetAboveBoldUnderlineSize() const { return mnAboveBUnderlineSize; } |
86 | 7.93k | tools::Long GetAboveBoldUnderlineOffset() const { return mnAboveBUnderlineOffset; } |
87 | 129 | tools::Long GetAboveDoubleUnderlineSize() const { return mnAboveDUnderlineSize; } |
88 | 129 | tools::Long GetAboveDoubleUnderlineOffset1() const { return mnAboveDUnderlineOffset1; } |
89 | 129 | tools::Long GetAboveDoubleUnderlineOffset2() const { return mnAboveDUnderlineOffset2; } |
90 | 451 | tools::Long GetAboveWavelineUnderlineSize() const { return mnAboveWUnderlineSize; } |
91 | 451 | tools::Long GetAboveWavelineUnderlineOffset() const { return mnAboveWUnderlineOffset; } |
92 | 134k | tools::Long GetStrikeoutSize() const { return mnStrikeoutSize; } |
93 | 134k | tools::Long GetStrikeoutOffset() const { return mnStrikeoutOffset; } |
94 | 5 | tools::Long GetBoldStrikeoutSize() const { return mnBStrikeoutSize; } |
95 | 5 | tools::Long GetBoldStrikeoutOffset() const { return mnBStrikeoutOffset; } |
96 | 480 | tools::Long GetDoubleStrikeoutSize() const { return mnDStrikeoutSize; } |
97 | 480 | tools::Long GetDoubleStrikeoutOffset1() const { return mnDStrikeoutOffset1; } |
98 | 480 | tools::Long GetDoubleStrikeoutOffset2() const { return mnDStrikeoutOffset2; } |
99 | | |
100 | | SAL_DLLPRIVATE void ImplInitTextLineSize( const OutputDevice* pDev ); |
101 | | SAL_DLLPRIVATE void ImplInitAboveTextLineSize( const OutputDevice* pDev ); |
102 | | SAL_DLLPRIVATE void ImplInitFlags( const OutputDevice* pDev ); |
103 | | void ImplCalcLineSpacing(LogicalFontInstance *pFontInstance); |
104 | | void ImplInitBaselines(LogicalFontInstance *pFontInstance); |
105 | | |
106 | | private: |
107 | | SAL_DLLPRIVATE bool ShouldNotUseUnderlineMetrics() const; |
108 | | SAL_DLLPRIVATE bool ImplInitTextLineSizeHarfBuzz(LogicalFontInstance *pFontInstance); |
109 | | SAL_DLLPRIVATE bool ShouldUseWinMetrics(int, int, int, int, int, int) const; |
110 | | |
111 | | // font instance attributes from the font request |
112 | | tools::Long mnHeight; // Font size |
113 | | tools::Long mnWidth; // Reference Width |
114 | | Degree10 mnOrientation; // Rotation in 1/10 degrees |
115 | | |
116 | | // font metrics measured for the font instance |
117 | | tools::Long mnAscent; // Ascent |
118 | | tools::Long mnDescent; // Descent |
119 | | tools::Long mnIntLeading; // Internal Leading |
120 | | tools::Long mnExtLeading; // External Leading |
121 | | int mnSlant; // Slant (Italic/Oblique) |
122 | | double mnMinKashida; // Minimal width of kashida (Arabic) |
123 | | tools::Long mnHangingBaseline; // Offset of hanging baseline to Romn baseline |
124 | | double mdEmSize; // Size of an 'em' |
125 | | double mdHorCJKAdvanceSize; // Size of an 'ic' in horizontal text |
126 | | double mdVertCJKAdvanceSize; // Size of an 'ic' in vertical text |
127 | | |
128 | | // font attributes queried from the font instance |
129 | | bool mbFullstopCentered; |
130 | | tools::Long mnBulletOffset; // Offset to position non-print character |
131 | | |
132 | | // font metrics that are usually derived from the measurements |
133 | | tools::Long mnUnderlineSize; // Lineheight of Underline |
134 | | tools::Long mnUnderlineOffset; // Offset from Underline to Baseline |
135 | | tools::Long mnBUnderlineSize; // Height of bold underline |
136 | | tools::Long mnBUnderlineOffset; // Offset from bold underline to baseline |
137 | | tools::Long mnDUnderlineSize; // Height of double underline |
138 | | tools::Long mnDUnderlineOffset1; // Offset from double underline to baseline |
139 | | tools::Long mnDUnderlineOffset2; // Offset from double underline to baseline |
140 | | tools::Long mnWUnderlineSize; // Height of WaveLine underline |
141 | | tools::Long mnWUnderlineOffset; // Offset from WaveLine underline to baseline, but centrered to WaveLine |
142 | | tools::Long mnAboveUnderlineSize; // Height of single underline (for Vertical Right) |
143 | | tools::Long mnAboveUnderlineOffset; // Offset from single underline to baseline (for Vertical Right) |
144 | | tools::Long mnAboveBUnderlineSize; // Height of bold underline (for Vertical Right) |
145 | | tools::Long mnAboveBUnderlineOffset; // Offset from bold underline to baseline (for Vertical Right) |
146 | | tools::Long mnAboveDUnderlineSize; // Height of double underline (for Vertical Right) |
147 | | tools::Long mnAboveDUnderlineOffset1; // Offset from double underline to baseline (for Vertical Right) |
148 | | tools::Long mnAboveDUnderlineOffset2; // Offset from double underline to baseline (for Vertical Right) |
149 | | tools::Long mnAboveWUnderlineSize; // Height of WaveLine-strike-out (for Vertical Right) |
150 | | tools::Long mnAboveWUnderlineOffset; // Offset from WaveLine-strike-out to baseline, but centrered to the WaveLine (for Vertical Right) |
151 | | tools::Long mnStrikeoutSize; // Height of single strike-out |
152 | | tools::Long mnStrikeoutOffset; // Offset from single strike-out to baseline |
153 | | tools::Long mnBStrikeoutSize; // Height of bold strike-out |
154 | | tools::Long mnBStrikeoutOffset; // Offset of bold strike-out to baseline |
155 | | tools::Long mnDStrikeoutSize; // Height of double strike-out |
156 | | tools::Long mnDStrikeoutOffset1; // Offset of double strike-out to baseline |
157 | | tools::Long mnDStrikeoutOffset2; // Offset of double strike-out to baseline |
158 | | |
159 | | }; |
160 | | |
161 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |