Line data Source code
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_FONT_HXX
21 : #define INCLUDED_VCL_FONT_HXX
22 :
23 : #include <rtl/ustring.hxx>
24 : #include <sal/types.h>
25 : #include <vcl/dllapi.h>
26 : #include <i18nlangtag/languagetag.hxx>
27 : #include <tools/color.hxx>
28 : #include <vcl/vclenum.hxx>
29 : #include <vcl/fntstyle.hxx>
30 :
31 : class SvStream;
32 : #define FontAlign TextAlign
33 :
34 : class Impl_Font;
35 : class ImplFontAttributes;
36 : class Size;
37 :
38 :
39 : // - Font -
40 :
41 :
42 : class VCL_DLLPUBLIC Font
43 : {
44 : private:
45 : Impl_Font* mpImplFont;
46 : void MakeUnique();
47 :
48 : public:
49 : Font();
50 : Font( const Font& );
51 : Font( const OUString& rFamilyName, const Size& );
52 : Font( const OUString& rFamilyName, const OUString& rStyleName, const Size& );
53 : Font( FontFamily eFamily, const Size& );
54 : ~Font();
55 :
56 : // setting the color on the font is obsolete, the only remaining
57 : // valid use is for keeping backward compatibility with old MetaFiles
58 : void SetColor( const Color& );
59 : const Color& GetColor() const;
60 : void SetFillColor( const Color& );
61 : const Color& GetFillColor() const;
62 : void SetTransparent( bool bTransparent );
63 : bool IsTransparent() const;
64 : void SetAlign( FontAlign );
65 : FontAlign GetAlign() const;
66 :
67 : void SetName( const OUString& rFamilyName );
68 : const OUString& GetName() const;
69 : void SetStyleName( const OUString& rStyleName );
70 : const OUString& GetStyleName() const;
71 : void SetSize( const Size& );
72 : const Size& GetSize() const;
73 : void SetHeight( long nHeight );
74 : long GetHeight() const;
75 : void SetWidth( long nWidth );
76 : long GetWidth() const;
77 :
78 : void SetFamily( FontFamily );
79 : FontFamily GetFamily() const;
80 : void SetCharSet( rtl_TextEncoding );
81 : rtl_TextEncoding GetCharSet() const;
82 : // Prefer LanguageTag over LanguageType
83 : void SetLanguageTag( const LanguageTag & );
84 : const LanguageTag& GetLanguageTag() const;
85 : void SetCJKContextLanguageTag( const LanguageTag& );
86 : const LanguageTag& GetCJKContextLanguageTag() const;
87 : void SetLanguage( LanguageType );
88 : LanguageType GetLanguage() const;
89 : void SetCJKContextLanguage( LanguageType );
90 : LanguageType GetCJKContextLanguage() const;
91 : void SetPitch( FontPitch ePitch );
92 : FontPitch GetPitch() const;
93 :
94 : void SetOrientation( short nLineOrientation );
95 : short GetOrientation() const;
96 : void SetVertical( bool bVertical );
97 : bool IsVertical() const;
98 : void SetKerning( FontKerning nKerning );
99 : FontKerning GetKerning() const;
100 : bool IsKerning() const;
101 :
102 : void SetWeight( FontWeight );
103 : FontWeight GetWeight() const;
104 : void SetWidthType( FontWidth );
105 : FontWidth GetWidthType() const;
106 : void SetItalic( FontItalic );
107 : FontItalic GetItalic() const;
108 : void SetOutline( bool bOutline );
109 : bool IsOutline() const;
110 : void SetShadow( bool bShadow );
111 : bool IsShadow() const;
112 : void SetRelief( FontRelief );
113 : FontRelief GetRelief() const;
114 : void SetUnderline( FontUnderline );
115 : FontUnderline GetUnderline() const;
116 : void SetOverline( FontUnderline );
117 : FontUnderline GetOverline() const;
118 : void SetStrikeout( FontStrikeout );
119 : FontStrikeout GetStrikeout() const;
120 : void SetEmphasisMark( FontEmphasisMark );
121 : FontEmphasisMark GetEmphasisMark() const;
122 : void SetWordLineMode( bool bWordLine );
123 : bool IsWordLineMode() const;
124 :
125 : void Merge( const Font& rFont );
126 : void GetFontAttributes( ImplFontAttributes& rAttrs ) const;
127 :
128 : Font& operator=( const Font& );
129 : bool operator==( const Font& ) const;
130 0 : bool operator!=( const Font& rFont ) const
131 0 : { return !(Font::operator==( rFont )); }
132 : bool IsSameInstance( const Font& ) const;
133 :
134 : friend VCL_DLLPUBLIC SvStream& ReadFont( SvStream& rIStm, Font& );
135 : friend VCL_DLLPUBLIC SvStream& WriteFont( SvStream& rOStm, const Font& );
136 :
137 : static Font identifyFont( const void* pBuffer, sal_uInt32 nLen );
138 : };
139 :
140 : #endif // _VCL_FONT_HXX
141 :
142 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|