1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SV_FONT_HXX 25 #define _SV_FONT_HXX 26 27 #include <vcl/dllapi.h> 28 #include <tools/gen.hxx> 29 #include <tools/string.hxx> 30 #include <i18npool/lang.h> 31 #include <tools/color.hxx> 32 #include <vcl/vclenum.hxx> 33 #include <vcl/fntstyle.hxx> 34 35 class SvStream; 36 #define FontAlign TextAlign 37 38 class Impl_Font; 39 class ImplFontAttributes; 40 41 // -------- 42 // - Font - 43 // -------- 44 45 class VCL_DLLPUBLIC Font 46 { 47 private: 48 Impl_Font* mpImplFont; 49 void MakeUnique(); 50 51 public: 52 Font(); 53 Font( const Font& ); 54 Font( const String& rFamilyName, const Size& ); 55 Font( const String& rFamilyName, const String& rStyleName, const Size& ); 56 Font( FontFamily eFamily, const Size& ); 57 ~Font(); 58 59 void SetColor( const Color& ); 60 const Color& GetColor() const; 61 void SetFillColor( const Color& ); 62 const Color& GetFillColor() const; 63 void SetTransparent( sal_Bool bTransparent ); 64 sal_Bool IsTransparent() const; 65 void SetAlign( FontAlign ); 66 FontAlign GetAlign() const; 67 68 void SetName( const String& rFamilyName ); 69 const String& GetName() const; 70 void SetStyleName( const String& rStyleName ); 71 const String& GetStyleName() const; 72 void SetSize( const Size& ); 73 const Size& GetSize() const; 74 void SetHeight( long nHeight ); 75 long GetHeight() const; 76 void SetWidth( long nWidth ); 77 long GetWidth() const; 78 79 void SetFamily( FontFamily ); 80 FontFamily GetFamily() const; 81 void SetCharSet( rtl_TextEncoding ); 82 rtl_TextEncoding GetCharSet() const; 83 void SetLanguage( LanguageType ); 84 LanguageType GetLanguage() const; 85 void SetCJKContextLanguage( LanguageType ); 86 LanguageType GetCJKContextLanguage() const; 87 void SetPitch( FontPitch ePitch ); 88 FontPitch GetPitch() const; 89 90 void SetOrientation( short nLineOrientation ); 91 short GetOrientation() const; 92 void SetVertical( sal_Bool bVertical ); 93 sal_Bool IsVertical() const; 94 void SetKerning( FontKerning nKerning ); 95 FontKerning GetKerning() const; 96 sal_Bool IsKerning() const; 97 98 void SetWeight( FontWeight ); 99 FontWeight GetWeight() const; 100 void SetWidthType( FontWidth ); 101 FontWidth GetWidthType() const; 102 void SetItalic( FontItalic ); 103 FontItalic GetItalic() const; 104 void SetOutline( sal_Bool bOutline ); 105 sal_Bool IsOutline() const; 106 void SetShadow( sal_Bool bShadow ); 107 sal_Bool IsShadow() const; 108 void SetRelief( FontRelief ); 109 FontRelief GetRelief() const; 110 void SetUnderline( FontUnderline ); 111 FontUnderline GetUnderline() const; 112 void SetOverline( FontUnderline ); 113 FontUnderline GetOverline() const; 114 void SetStrikeout( FontStrikeout ); 115 FontStrikeout GetStrikeout() const; 116 void SetEmphasisMark( FontEmphasisMark ); 117 FontEmphasisMark GetEmphasisMark() const; 118 void SetWordLineMode( sal_Bool bWordLine ); 119 sal_Bool IsWordLineMode() const; 120 121 void Merge( const Font& rFont ); 122 void GetFontAttributes( ImplFontAttributes& rAttrs ) const; 123 124 Font& operator=( const Font& ); 125 sal_Bool operator==( const Font& ) const; 126 sal_Bool operator!=( const Font& rFont ) const 127 { return !(Font::operator==( rFont )); } 128 sal_Bool IsSameInstance( const Font& ) const; 129 130 friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Font& ); 131 friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Font& ); 132 133 static Font identifyFont( const void* pBuffer, sal_uInt32 nLen ); 134 }; 135 136 #endif // _VCL_FONT_HXX 137