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