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