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 ) { maAverageFontSize = rSize; }
66 
67  void SetSymbolFlag( const bool bSymbolFlag ) { mbSymbolFlag = bSymbolFlag; }
68 
69  // straight properties, no getting them from AskConfig()
71  FontWeight GetWeightNoAsk() const { return meWeight; }
72  FontItalic GetItalicNoAsk() const { return meItalic; }
73  FontPitch GetPitchNoAsk() const { return mePitch; }
75 
76  // device dependent functions
77  int GetQuality() const { return mnQuality; }
78 
79  void SetQuality( int nQuality ) { mnQuality = nQuality; }
80  void IncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; }
81  void DecreaseQualityBy( int nQualityAmount ) { mnQuality -= nQualityAmount; }
82 
83  bool operator==( const ImplFont& ) const;
84 
85 private:
86  friend class vcl::Font;
87  friend SvStream& ReadImplFont( SvStream& rIStm, ImplFont& );
88  friend SvStream& WriteImplFont( SvStream& rOStm, const ImplFont& );
89 
90  void AskConfig();
91 
92  // Device independent variables
93  OUString maFamilyName;
94  OUString maStyleName;
108  rtl_TextEncoding meCharSet;
109 
112 
113  // Flags - device independent
114  bool mbSymbolFlag:1,
115  mbOutline:1,
116  mbConfigLookup:1, // config lookup should only be done once
117  mbShadow:1,
118  mbVertical:1,
119  mbTransparent:1; // compatibility, now on output device
120 
121  // deprecated variables - device independent
122  Color maColor; // compatibility, now on output device
123  Color maFillColor; // compatibility, now on output device
124 
125  // Device dependent variables
126  bool mbWordLine:1;
127 
128  // TODO: metric data, should be migrated to ImplFontMetric
130 
132 
133 };
134 
135 #endif // INCLUDED_VCL_INC_IMPFONT_HXX
136 
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
rtl_TextEncoding GetCharSet() const
Definition: impfont.hxx:50
FontKerning meKerning
Definition: impfont.hxx:106
void SetAlignment(const TextAlign eAlignment)
Definition: impfont.hxx:63
FontStrikeout meStrikeout
Definition: impfont.hxx:103
int GetQuality() const
Definition: impfont.hxx:77
FontItalic meItalic
Definition: impfont.hxx:99
FontLineStyle meOverline
Definition: impfont.hxx:102
void SetCharSet(const rtl_TextEncoding eCharSet)
Definition: impfont.hxx:64
FontWidth meWidthType
Definition: impfont.hxx:98
TextAlign meAlign
Definition: impfont.hxx:100
FontWeight meWeight
Definition: impfont.hxx:95
const OUString & GetStyleName() const
Definition: impfont.hxx:43
Color maFillColor
Definition: impfont.hxx:123
FontWidth
FontItalic GetItalic()
Definition: impfont.hxx:46
const Size & GetFontSize() const
Definition: impfont.hxx:51
void SetQuality(int nQuality)
Definition: impfont.hxx:79
FAMILY_DONTKNOW
FontEmphasisMark
FontRelief meRelief
Definition: impfont.hxx:104
FontWeight GetWeightNoAsk() const
Definition: impfont.hxx:71
FontFamily meFamily
Definition: impfont.hxx:96
bool mbVertical
Definition: impfont.hxx:114
int mnQuality
Definition: impfont.hxx:131
friend SvStream & WriteImplFont(SvStream &rOStm, const ImplFont &)
Definition: font/font.cxx:408
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:74
void SetWeight(const FontWeight eWeight)
Definition: impfont.hxx:61
Size maAverageFontSize
Definition: impfont.hxx:107
void AskConfig()
Definition: font/font.cxx:821
bool IsSymbolFont() const
Definition: impfont.hxx:53
FontPitch GetPitchNoAsk() const
Definition: impfont.hxx:73
void IncreaseQualityBy(int nQualityAmount)
Definition: impfont.hxx:80
void SetPitch(const FontPitch ePitch)
Definition: impfont.hxx:59
LanguageTag maCJKLanguageTag
Definition: impfont.hxx:111
FontKerning
Definition: fntstyle.hxx:28
bool mbSymbolFlag
Definition: impfont.hxx:114
OUString maStyleName
Definition: impfont.hxx:94
FontFamily GetFamilyTypeNoAsk() const
Definition: impfont.hxx:70
FontWidth GetWidthType()
Definition: impfont.hxx:48
WEIGHT_DONTKNOW
void SetFamilyName(const OUString &sFamilyName)
Definition: impfont.hxx:55
void DecreaseQualityBy(int nQualityAmount)
Definition: impfont.hxx:81
bool operator==(const ImplFont &) const
Definition: font/font.cxx:778
FontEmphasisMark meEmphasisMark
Definition: impfont.hxx:105
rtl_TextEncoding meCharSet
Definition: impfont.hxx:108
LanguageTag maLanguageTag
Definition: impfont.hxx:110
bool mbConfigLookup
Definition: impfont.hxx:114
void SetSymbolFlag(const bool bSymbolFlag)
Definition: impfont.hxx:67
FontItalic GetItalicNoAsk() const
Definition: impfont.hxx:72
Color maColor
Definition: impfont.hxx:122
PITCH_DONTKNOW
TextAlign GetAlignment() const
Definition: impfont.hxx:49
FontPitch
short mnOrientation
Definition: impfont.hxx:129
FontWeight GetWeight()
Definition: impfont.hxx:45
bool mbShadow
Definition: impfont.hxx:114
FontFamily
friend SvStream & ReadImplFont(SvStream &rIStm, ImplFont &)
Definition: font/font.cxx:360
FontPitch GetPitch()
Definition: impfont.hxx:47
FontPitch mePitch
Definition: impfont.hxx:97
FontWeight
void SetStyleName(const OUString &sStyleName)
Definition: impfont.hxx:56
WIDTH_DONTKNOW
bool mbTransparent
Definition: impfont.hxx:114
ITALIC_DONTKNOW
void SetFamilyType(const FontFamily eFontFamily)
Definition: impfont.hxx:57
FontFamily GetFamilyType()
Definition: impfont.hxx:42
bool mbWordLine
Definition: impfont.hxx:126
OUString maFamilyName
Definition: impfont.hxx:93
void SetItalic(const FontItalic eItalic)
Definition: impfont.hxx:60
FontLineStyle
bool mbOutline
Definition: impfont.hxx:114
FontStrikeout
FontLineStyle meUnderline
Definition: impfont.hxx:101
TextAlign
FontRelief
Definition: fntstyle.hxx:26
FontItalic