nss: upgrade to release 3.73
[LibreOffice.git] / vcl / inc / impfont.hxx
blob35150abc87c0d80a6969c2e9c2f27c3b57038f77
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_IMPFONT_HXX
21 #define INCLUDED_VCL_INC_IMPFONT_HXX
23 #include <rtl/ustring.hxx>
24 #include <tools/color.hxx>
25 #include <tools/fontenum.hxx>
26 #include <tools/gen.hxx>
27 #include <i18nlangtag/languagetag.hxx>
28 #include <vcl/fntstyle.hxx>
30 #include "fontselect.hxx"
32 /* The following class is extraordinarily similar to FontAttributes. */
34 class ImplFont
36 public:
37 explicit ImplFont();
38 explicit ImplFont( const ImplFont& );
40 // device independent font functions
41 const OUString& GetFamilyName() const { return maFamilyName; }
42 FontFamily GetFamilyType() { if(meFamily==FAMILY_DONTKNOW) AskConfig(); return meFamily; }
43 const OUString& GetStyleName() const { return maStyleName; }
45 FontWeight GetWeight() { if(meWeight==WEIGHT_DONTKNOW) AskConfig(); return meWeight; }
46 FontItalic GetItalic() { if(meItalic==ITALIC_DONTKNOW) AskConfig(); return meItalic; }
47 FontPitch GetPitch() { if(mePitch==PITCH_DONTKNOW) AskConfig(); return mePitch; }
48 FontWidth GetWidthType() { if(meWidthType==WIDTH_DONTKNOW) AskConfig(); return meWidthType; }
49 TextAlign GetAlignment() const { return meAlign; }
50 rtl_TextEncoding GetCharSet() const { return meCharSet; }
51 const Size& GetFontSize() const { return maAverageFontSize; }
53 bool IsSymbolFont() const { return mbSymbolFlag; }
55 void SetFamilyName( const OUString& sFamilyName ) { maFamilyName = sFamilyName; }
56 void SetStyleName( const OUString& sStyleName ) { maStyleName = sStyleName; }
57 void SetFamilyType( const FontFamily eFontFamily ) { meFamily = eFontFamily; }
59 void SetPitch( const FontPitch ePitch ) { mePitch = ePitch; }
60 void SetItalic( const FontItalic eItalic ) { meItalic = eItalic; }
61 void SetWeight( const FontWeight eWeight ) { meWeight = eWeight; }
62 void SetWidthType( const FontWidth eWidthType ) { meWidthType = eWidthType; }
63 void SetAlignment( const TextAlign eAlignment ) { meAlign = eAlignment; }
64 void SetCharSet( const rtl_TextEncoding eCharSet ) { meCharSet = eCharSet; }
65 void SetFontSize( const Size& rSize )
67 if(rSize.Height() != maAverageFontSize.Height())
69 // reset evtl. buffered calculated AverageFontSize, it depends
70 // on Font::Height
71 mnCalculatedAverageFontWidth = 0;
73 maAverageFontSize = rSize;
76 void SetSymbolFlag( const bool bSymbolFlag ) { mbSymbolFlag = bSymbolFlag; }
78 // straight properties, no getting them from AskConfig()
79 FontFamily GetFamilyTypeNoAsk() const { return meFamily; }
80 FontWeight GetWeightNoAsk() const { return meWeight; }
81 FontItalic GetItalicNoAsk() const { return meItalic; }
82 FontPitch GetPitchNoAsk() const { return mePitch; }
83 FontWidth GetWidthTypeNoAsk() const { return meWidthType; }
85 // device dependent functions
86 int GetQuality() const { return mnQuality; }
88 void SetQuality( int nQuality ) { mnQuality = nQuality; }
89 void IncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; }
90 void DecreaseQualityBy( int nQualityAmount ) { mnQuality -= nQualityAmount; }
92 tools::Long GetCalculatedAverageFontWidth() const { return mnCalculatedAverageFontWidth; }
93 void SetCalculatedAverageFontWidth(tools::Long nNew) { mnCalculatedAverageFontWidth = nNew; }
95 bool operator==( const ImplFont& ) const;
97 private:
98 friend class vcl::Font;
99 friend SvStream& ReadImplFont( SvStream& rIStm, ImplFont&, tools::Long& );
100 friend SvStream& WriteImplFont( SvStream& rOStm, const ImplFont&, const tools::Long& );
102 void AskConfig();
104 // Device independent variables
105 OUString maFamilyName;
106 OUString maStyleName;
107 FontWeight meWeight;
108 FontFamily meFamily;
109 FontPitch mePitch;
110 FontWidth meWidthType;
111 FontItalic meItalic;
112 TextAlign meAlign;
113 FontLineStyle meUnderline;
114 FontLineStyle meOverline;
115 FontStrikeout meStrikeout;
116 FontRelief meRelief;
117 FontEmphasisMark meEmphasisMark;
118 FontKerning meKerning;
119 Size maAverageFontSize;
120 rtl_TextEncoding meCharSet;
122 LanguageTag maLanguageTag;
123 LanguageTag maCJKLanguageTag;
125 // Flags - device independent
126 bool mbSymbolFlag:1,
127 mbOutline:1,
128 mbConfigLookup:1, // config lookup should only be done once
129 mbShadow:1,
130 mbVertical:1,
131 mbTransparent:1; // compatibility, now on output device
133 // deprecated variables - device independent
134 Color maColor; // compatibility, now on output device
135 Color maFillColor; // compatibility, now on output device
137 // Device dependent variables
138 bool mbWordLine:1;
140 // TODO: metric data, should be migrated to ImplFontMetric
141 Degree10 mnOrientation;
143 int mnQuality;
145 tools::Long mnCalculatedAverageFontWidth;
148 #endif // INCLUDED_VCL_INC_IMPFONT_HXX
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */