1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_vcl.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "unotools/fontcfg.hxx" 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include "tools/stream.hxx" 34*cdf0e10cSrcweir #include "tools/vcompat.hxx" 35*cdf0e10cSrcweir #include "tools/debug.hxx" 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #include "vcl/font.hxx" 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include "impfont.hxx" 40*cdf0e10cSrcweir #include "outfont.hxx" 41*cdf0e10cSrcweir #include "sft.hxx" 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir #include <algorithm> 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir using namespace vcl; 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir // ======================================================================= 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir DBG_NAME( Font ) 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir // ----------------------------------------------------------------------- 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir Impl_Font::Impl_Font() : 55*cdf0e10cSrcweir maColor( COL_TRANSPARENT ), 56*cdf0e10cSrcweir maFillColor( COL_TRANSPARENT ) 57*cdf0e10cSrcweir { 58*cdf0e10cSrcweir mnRefCount = 1; 59*cdf0e10cSrcweir meCharSet = RTL_TEXTENCODING_DONTKNOW; 60*cdf0e10cSrcweir meLanguage = LANGUAGE_DONTKNOW; 61*cdf0e10cSrcweir meCJKLanguage = LANGUAGE_DONTKNOW; 62*cdf0e10cSrcweir meFamily = FAMILY_DONTKNOW; 63*cdf0e10cSrcweir mePitch = PITCH_DONTKNOW; 64*cdf0e10cSrcweir meAlign = ALIGN_TOP; 65*cdf0e10cSrcweir meWeight = WEIGHT_DONTKNOW; 66*cdf0e10cSrcweir meWidthType = WIDTH_DONTKNOW; 67*cdf0e10cSrcweir meItalic = ITALIC_NONE; 68*cdf0e10cSrcweir meUnderline = UNDERLINE_NONE; 69*cdf0e10cSrcweir meOverline = UNDERLINE_NONE; 70*cdf0e10cSrcweir meStrikeout = STRIKEOUT_NONE; 71*cdf0e10cSrcweir meRelief = RELIEF_NONE; 72*cdf0e10cSrcweir meEmphasisMark = EMPHASISMARK_NONE; 73*cdf0e10cSrcweir mnOrientation = 0; 74*cdf0e10cSrcweir mnKerning = 0; 75*cdf0e10cSrcweir mbWordLine = false; 76*cdf0e10cSrcweir mbOutline = false; 77*cdf0e10cSrcweir mbShadow = false; 78*cdf0e10cSrcweir mbVertical = false; 79*cdf0e10cSrcweir mbTransparent = true; 80*cdf0e10cSrcweir mbConfigLookup = false; 81*cdf0e10cSrcweir } 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir // ----------------------------------------------------------------------- 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir Impl_Font::Impl_Font( const Impl_Font& rImplFont ) 86*cdf0e10cSrcweir : maFamilyName( rImplFont.maFamilyName ), 87*cdf0e10cSrcweir maStyleName( rImplFont.maStyleName ), 88*cdf0e10cSrcweir maSize( rImplFont.maSize ), 89*cdf0e10cSrcweir maColor( rImplFont.maColor ), 90*cdf0e10cSrcweir maFillColor( rImplFont.maFillColor ) 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir mnRefCount = 1; 93*cdf0e10cSrcweir meCharSet = rImplFont.meCharSet; 94*cdf0e10cSrcweir meLanguage = rImplFont.meLanguage; 95*cdf0e10cSrcweir meCJKLanguage = rImplFont.meCJKLanguage; 96*cdf0e10cSrcweir meFamily = rImplFont.meFamily; 97*cdf0e10cSrcweir mePitch = rImplFont.mePitch; 98*cdf0e10cSrcweir meAlign = rImplFont.meAlign; 99*cdf0e10cSrcweir meWeight = rImplFont.meWeight; 100*cdf0e10cSrcweir meWidthType = rImplFont.meWidthType; 101*cdf0e10cSrcweir meItalic = rImplFont.meItalic; 102*cdf0e10cSrcweir meUnderline = rImplFont.meUnderline; 103*cdf0e10cSrcweir meOverline = rImplFont.meOverline; 104*cdf0e10cSrcweir meStrikeout = rImplFont.meStrikeout; 105*cdf0e10cSrcweir meRelief = rImplFont.meRelief; 106*cdf0e10cSrcweir meEmphasisMark = rImplFont.meEmphasisMark; 107*cdf0e10cSrcweir mnOrientation = rImplFont.mnOrientation; 108*cdf0e10cSrcweir mnKerning = rImplFont.mnKerning; 109*cdf0e10cSrcweir mbWordLine = rImplFont.mbWordLine; 110*cdf0e10cSrcweir mbOutline = rImplFont.mbOutline; 111*cdf0e10cSrcweir mbShadow = rImplFont.mbShadow; 112*cdf0e10cSrcweir mbVertical = rImplFont.mbVertical; 113*cdf0e10cSrcweir mbTransparent = rImplFont.mbTransparent; 114*cdf0e10cSrcweir mbConfigLookup = rImplFont.mbConfigLookup; 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir // ----------------------------------------------------------------------- 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir bool Impl_Font::operator==( const Impl_Font& rOther ) const 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir // equality tests split up for easier debugging 122*cdf0e10cSrcweir if( (meWeight != rOther.meWeight) 123*cdf0e10cSrcweir || (meItalic != rOther.meItalic) 124*cdf0e10cSrcweir || (meFamily != rOther.meFamily) 125*cdf0e10cSrcweir || (mePitch != rOther.mePitch) ) 126*cdf0e10cSrcweir return false; 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir if( (meCharSet != rOther.meCharSet) 129*cdf0e10cSrcweir || (meLanguage != rOther.meLanguage) 130*cdf0e10cSrcweir || (meCJKLanguage != rOther.meCJKLanguage) 131*cdf0e10cSrcweir || (meAlign != rOther.meAlign) ) 132*cdf0e10cSrcweir return false; 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir if( (maSize != rOther.maSize) 135*cdf0e10cSrcweir || (mnOrientation != rOther.mnOrientation) 136*cdf0e10cSrcweir || (mbVertical != rOther.mbVertical) ) 137*cdf0e10cSrcweir return false; 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir if( (maFamilyName != rOther.maFamilyName) 140*cdf0e10cSrcweir || (maStyleName != rOther.maStyleName) ) 141*cdf0e10cSrcweir return false; 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir if( (maColor != rOther.maColor) 144*cdf0e10cSrcweir || (maFillColor != rOther.maFillColor) ) 145*cdf0e10cSrcweir return false; 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir if( (meUnderline != rOther.meUnderline) 148*cdf0e10cSrcweir || (meOverline != rOther.meOverline) 149*cdf0e10cSrcweir || (meStrikeout != rOther.meStrikeout) 150*cdf0e10cSrcweir || (meRelief != rOther.meRelief) 151*cdf0e10cSrcweir || (meEmphasisMark != rOther.meEmphasisMark) 152*cdf0e10cSrcweir || (mbWordLine != rOther.mbWordLine) 153*cdf0e10cSrcweir || (mbOutline != rOther.mbOutline) 154*cdf0e10cSrcweir || (mbShadow != rOther.mbShadow) 155*cdf0e10cSrcweir || (mnKerning != rOther.mnKerning) 156*cdf0e10cSrcweir || (mbTransparent != rOther.mbTransparent) ) 157*cdf0e10cSrcweir return false; 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir return true; 160*cdf0e10cSrcweir } 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir // ----------------------------------------------------------------------- 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir void Impl_Font::AskConfig() 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir if( mbConfigLookup ) 167*cdf0e10cSrcweir return; 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir mbConfigLookup = true; 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir // prepare the FontSubst configuration lookup 172*cdf0e10cSrcweir const utl::FontSubstConfiguration* pFontSubst = utl::FontSubstConfiguration::get(); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir String aShortName; 175*cdf0e10cSrcweir String aFamilyName; 176*cdf0e10cSrcweir sal_uLong nType = 0; 177*cdf0e10cSrcweir FontWeight eWeight = WEIGHT_DONTKNOW; 178*cdf0e10cSrcweir FontWidth eWidthType = WIDTH_DONTKNOW; 179*cdf0e10cSrcweir String aMapName = maFamilyName; 180*cdf0e10cSrcweir GetEnglishSearchFontName( aMapName ); 181*cdf0e10cSrcweir utl::FontSubstConfiguration::getMapName( aMapName, 182*cdf0e10cSrcweir aShortName, aFamilyName, eWeight, eWidthType, nType ); 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir // lookup the font name in the configuration 185*cdf0e10cSrcweir const utl::FontNameAttr* pFontAttr = pFontSubst->getSubstInfo( aMapName ); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir // if the direct lookup failed try again with an alias name 188*cdf0e10cSrcweir if ( !pFontAttr && (aShortName != aMapName) ) 189*cdf0e10cSrcweir pFontAttr = pFontSubst->getSubstInfo( aShortName ); 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir if( pFontAttr ) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir // the font was found in the configuration 194*cdf0e10cSrcweir if( meFamily == FAMILY_DONTKNOW ) 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir if ( pFontAttr->Type & IMPL_FONT_ATTR_SERIF ) 197*cdf0e10cSrcweir meFamily = FAMILY_ROMAN; 198*cdf0e10cSrcweir else if ( pFontAttr->Type & IMPL_FONT_ATTR_SANSSERIF ) 199*cdf0e10cSrcweir meFamily = FAMILY_SWISS; 200*cdf0e10cSrcweir else if ( pFontAttr->Type & IMPL_FONT_ATTR_TYPEWRITER ) 201*cdf0e10cSrcweir meFamily = FAMILY_MODERN; 202*cdf0e10cSrcweir else if ( pFontAttr->Type & IMPL_FONT_ATTR_ITALIC ) 203*cdf0e10cSrcweir meFamily = FAMILY_SCRIPT; 204*cdf0e10cSrcweir else if ( pFontAttr->Type & IMPL_FONT_ATTR_DECORATIVE ) 205*cdf0e10cSrcweir meFamily = FAMILY_DECORATIVE; 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir if( mePitch == PITCH_DONTKNOW ) 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir if ( pFontAttr->Type & IMPL_FONT_ATTR_FIXED ) 211*cdf0e10cSrcweir mePitch = PITCH_FIXED; 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir } 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir // if some attributes are still unknown then use the FontSubst magic 216*cdf0e10cSrcweir if( meFamily == FAMILY_DONTKNOW ) 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir if( nType & IMPL_FONT_ATTR_SERIF ) 219*cdf0e10cSrcweir meFamily = FAMILY_ROMAN; 220*cdf0e10cSrcweir else if( nType & IMPL_FONT_ATTR_SANSSERIF ) 221*cdf0e10cSrcweir meFamily = FAMILY_SWISS; 222*cdf0e10cSrcweir else if( nType & IMPL_FONT_ATTR_TYPEWRITER ) 223*cdf0e10cSrcweir meFamily = FAMILY_MODERN; 224*cdf0e10cSrcweir else if( nType & IMPL_FONT_ATTR_ITALIC ) 225*cdf0e10cSrcweir meFamily = FAMILY_SCRIPT; 226*cdf0e10cSrcweir else if( nType & IMPL_FONT_ATTR_DECORATIVE ) 227*cdf0e10cSrcweir meFamily = FAMILY_DECORATIVE; 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir if( meWeight == WEIGHT_DONTKNOW ) 231*cdf0e10cSrcweir meWeight = eWeight; 232*cdf0e10cSrcweir if( meWidthType == WIDTH_DONTKNOW ) 233*cdf0e10cSrcweir meWidthType = eWidthType; 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir // ======================================================================= 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir void Font::MakeUnique() 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir // create a copy if others still reference it 241*cdf0e10cSrcweir if ( mpImplFont->mnRefCount != 1 ) 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir if ( mpImplFont->mnRefCount ) 244*cdf0e10cSrcweir mpImplFont->mnRefCount--; 245*cdf0e10cSrcweir mpImplFont = new Impl_Font( *mpImplFont ); 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir // ----------------------------------------------------------------------- 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir Font::Font() 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir DBG_CTOR( Font, NULL ); 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir static Impl_Font aStaticImplFont; 256*cdf0e10cSrcweir // RefCount is zero for static objects 257*cdf0e10cSrcweir aStaticImplFont.mnRefCount = 0; 258*cdf0e10cSrcweir mpImplFont = &aStaticImplFont; 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir // ----------------------------------------------------------------------- 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir Font::Font( const Font& rFont ) 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir DBG_CTOR( Font, NULL ); 266*cdf0e10cSrcweir DBG_CHKOBJ( &rFont, Font, NULL ); 267*cdf0e10cSrcweir DBG_ASSERT( rFont.mpImplFont->mnRefCount < 0xFFFE, "Font: RefCount overflow" ); 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir mpImplFont = rFont.mpImplFont; 270*cdf0e10cSrcweir // do not count static objects (where RefCount is zero) 271*cdf0e10cSrcweir if ( mpImplFont->mnRefCount ) 272*cdf0e10cSrcweir mpImplFont->mnRefCount++; 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir // ----------------------------------------------------------------------- 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir Font::Font( const String& rFamilyName, const Size& rSize ) 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir DBG_CTOR( Font, NULL ); 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir mpImplFont = new Impl_Font; 282*cdf0e10cSrcweir mpImplFont->maFamilyName= rFamilyName; 283*cdf0e10cSrcweir mpImplFont->maSize = rSize; 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir // ----------------------------------------------------------------------- 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir Font::Font( const String& rFamilyName, const String& rStyleName, const Size& rSize ) 289*cdf0e10cSrcweir { 290*cdf0e10cSrcweir DBG_CTOR( Font, NULL ); 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir mpImplFont = new Impl_Font; 293*cdf0e10cSrcweir mpImplFont->maFamilyName= rFamilyName; 294*cdf0e10cSrcweir mpImplFont->maStyleName = rStyleName; 295*cdf0e10cSrcweir mpImplFont->maSize = rSize; 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir // ----------------------------------------------------------------------- 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir Font::Font( FontFamily eFamily, const Size& rSize ) 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir DBG_CTOR( Font, NULL ); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir mpImplFont = new Impl_Font; 305*cdf0e10cSrcweir mpImplFont->meFamily = eFamily; 306*cdf0e10cSrcweir mpImplFont->maSize = rSize; 307*cdf0e10cSrcweir } 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir // ----------------------------------------------------------------------- 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir Font::~Font() 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir DBG_DTOR( Font, NULL ); 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir // decrement reference counter and delete if last reference 316*cdf0e10cSrcweir // if the object is not static (Refcounter==0) 317*cdf0e10cSrcweir if ( mpImplFont->mnRefCount ) 318*cdf0e10cSrcweir { 319*cdf0e10cSrcweir if ( mpImplFont->mnRefCount == 1 ) 320*cdf0e10cSrcweir delete mpImplFont; 321*cdf0e10cSrcweir else 322*cdf0e10cSrcweir mpImplFont->mnRefCount--; 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir // ----------------------------------------------------------------------- 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir void Font::SetColor( const Color& rColor ) 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir if( mpImplFont->maColor != rColor ) 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir MakeUnique(); 335*cdf0e10cSrcweir mpImplFont->maColor = rColor; 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir // ----------------------------------------------------------------------- 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir void Font::SetFillColor( const Color& rColor ) 342*cdf0e10cSrcweir { 343*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir MakeUnique(); 346*cdf0e10cSrcweir mpImplFont->maFillColor = rColor; 347*cdf0e10cSrcweir if ( rColor.GetTransparency() ) 348*cdf0e10cSrcweir mpImplFont->mbTransparent = true; 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir // ----------------------------------------------------------------------- 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir void Font::SetTransparent( sal_Bool bTransparent ) 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir if( mpImplFont->mbTransparent != bTransparent ) 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir MakeUnique(); 360*cdf0e10cSrcweir mpImplFont->mbTransparent = bTransparent; 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir // ----------------------------------------------------------------------- 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir void Font::SetAlign( FontAlign eAlign ) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir if( mpImplFont->meAlign != eAlign ) 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir MakeUnique(); 373*cdf0e10cSrcweir mpImplFont->meAlign = eAlign; 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir } 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir // ----------------------------------------------------------------------- 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir void Font::SetName( const String& rFamilyName ) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir MakeUnique(); 384*cdf0e10cSrcweir mpImplFont->maFamilyName = rFamilyName; 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir // ----------------------------------------------------------------------- 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir void Font::SetStyleName( const String& rStyleName ) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir MakeUnique(); 394*cdf0e10cSrcweir mpImplFont->maStyleName = rStyleName; 395*cdf0e10cSrcweir } 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir // ----------------------------------------------------------------------- 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir void Font::SetSize( const Size& rSize ) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir if( mpImplFont->maSize != rSize ) 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir MakeUnique(); 406*cdf0e10cSrcweir mpImplFont->maSize = rSize; 407*cdf0e10cSrcweir } 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir // ----------------------------------------------------------------------- 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir void Font::SetFamily( FontFamily eFamily ) 413*cdf0e10cSrcweir { 414*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir if( mpImplFont->meFamily != eFamily ) 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir MakeUnique(); 419*cdf0e10cSrcweir mpImplFont->meFamily = eFamily; 420*cdf0e10cSrcweir } 421*cdf0e10cSrcweir } 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir // ----------------------------------------------------------------------- 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir void Font::SetCharSet( CharSet eCharSet ) 426*cdf0e10cSrcweir { 427*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir if( mpImplFont->meCharSet != eCharSet ) 430*cdf0e10cSrcweir { 431*cdf0e10cSrcweir MakeUnique(); 432*cdf0e10cSrcweir mpImplFont->meCharSet = eCharSet; 433*cdf0e10cSrcweir } 434*cdf0e10cSrcweir } 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir // ----------------------------------------------------------------------- 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir void Font::SetLanguage( LanguageType eLanguage ) 439*cdf0e10cSrcweir { 440*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir if( mpImplFont->meLanguage != eLanguage ) 443*cdf0e10cSrcweir { 444*cdf0e10cSrcweir MakeUnique(); 445*cdf0e10cSrcweir mpImplFont->meLanguage = eLanguage; 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir // ----------------------------------------------------------------------- 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir void Font::SetCJKContextLanguage( LanguageType eLanguage ) 452*cdf0e10cSrcweir { 453*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir if( mpImplFont->meCJKLanguage != eLanguage ) 456*cdf0e10cSrcweir { 457*cdf0e10cSrcweir MakeUnique(); 458*cdf0e10cSrcweir mpImplFont->meCJKLanguage = eLanguage; 459*cdf0e10cSrcweir } 460*cdf0e10cSrcweir } 461*cdf0e10cSrcweir 462*cdf0e10cSrcweir // ----------------------------------------------------------------------- 463*cdf0e10cSrcweir 464*cdf0e10cSrcweir void Font::SetPitch( FontPitch ePitch ) 465*cdf0e10cSrcweir { 466*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir if( mpImplFont->mePitch != ePitch ) 469*cdf0e10cSrcweir { 470*cdf0e10cSrcweir MakeUnique(); 471*cdf0e10cSrcweir mpImplFont->mePitch = ePitch; 472*cdf0e10cSrcweir } 473*cdf0e10cSrcweir } 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir // ----------------------------------------------------------------------- 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir void Font::SetOrientation( short nOrientation ) 478*cdf0e10cSrcweir { 479*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 480*cdf0e10cSrcweir 481*cdf0e10cSrcweir if( mpImplFont->mnOrientation != nOrientation ) 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir MakeUnique(); 484*cdf0e10cSrcweir mpImplFont->mnOrientation = nOrientation; 485*cdf0e10cSrcweir } 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir 488*cdf0e10cSrcweir // ----------------------------------------------------------------------- 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir void Font::SetVertical( sal_Bool bVertical ) 491*cdf0e10cSrcweir { 492*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir if( mpImplFont->mbVertical != bVertical ) 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir MakeUnique(); 497*cdf0e10cSrcweir mpImplFont->mbVertical = bVertical; 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir } 500*cdf0e10cSrcweir 501*cdf0e10cSrcweir // ----------------------------------------------------------------------- 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir void Font::SetKerning( FontKerning nKerning ) 504*cdf0e10cSrcweir { 505*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir if( mpImplFont->mnKerning != nKerning ) 508*cdf0e10cSrcweir { 509*cdf0e10cSrcweir MakeUnique(); 510*cdf0e10cSrcweir mpImplFont->mnKerning = nKerning; 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir } 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir // ----------------------------------------------------------------------- 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir sal_Bool Font::IsKerning() const 517*cdf0e10cSrcweir { 518*cdf0e10cSrcweir return (mpImplFont->mnKerning & KERNING_FONTSPECIFIC) != 0; 519*cdf0e10cSrcweir } 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir // ----------------------------------------------------------------------- 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir void Font::SetWeight( FontWeight eWeight ) 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 526*cdf0e10cSrcweir 527*cdf0e10cSrcweir if( mpImplFont->meWeight != eWeight ) 528*cdf0e10cSrcweir { 529*cdf0e10cSrcweir MakeUnique(); 530*cdf0e10cSrcweir mpImplFont->meWeight = eWeight; 531*cdf0e10cSrcweir } 532*cdf0e10cSrcweir } 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir // ----------------------------------------------------------------------- 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir void Font::SetWidthType( FontWidth eWidth ) 537*cdf0e10cSrcweir { 538*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir if( mpImplFont->meWidthType != eWidth ) 541*cdf0e10cSrcweir { 542*cdf0e10cSrcweir MakeUnique(); 543*cdf0e10cSrcweir mpImplFont->meWidthType = eWidth; 544*cdf0e10cSrcweir } 545*cdf0e10cSrcweir } 546*cdf0e10cSrcweir 547*cdf0e10cSrcweir // ----------------------------------------------------------------------- 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir void Font::SetItalic( FontItalic eItalic ) 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir if( mpImplFont->meItalic != eItalic ) 554*cdf0e10cSrcweir { 555*cdf0e10cSrcweir MakeUnique(); 556*cdf0e10cSrcweir mpImplFont->meItalic = eItalic; 557*cdf0e10cSrcweir } 558*cdf0e10cSrcweir } 559*cdf0e10cSrcweir 560*cdf0e10cSrcweir // ----------------------------------------------------------------------- 561*cdf0e10cSrcweir 562*cdf0e10cSrcweir void Font::SetOutline( sal_Bool bOutline ) 563*cdf0e10cSrcweir { 564*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 565*cdf0e10cSrcweir 566*cdf0e10cSrcweir if( mpImplFont->mbOutline != bOutline ) 567*cdf0e10cSrcweir { 568*cdf0e10cSrcweir MakeUnique(); 569*cdf0e10cSrcweir mpImplFont->mbOutline = bOutline; 570*cdf0e10cSrcweir } 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir // ----------------------------------------------------------------------- 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir void Font::SetShadow( sal_Bool bShadow ) 576*cdf0e10cSrcweir { 577*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir if( mpImplFont->mbShadow != bShadow ) 580*cdf0e10cSrcweir { 581*cdf0e10cSrcweir MakeUnique(); 582*cdf0e10cSrcweir mpImplFont->mbShadow = bShadow; 583*cdf0e10cSrcweir } 584*cdf0e10cSrcweir } 585*cdf0e10cSrcweir 586*cdf0e10cSrcweir // ----------------------------------------------------------------------- 587*cdf0e10cSrcweir 588*cdf0e10cSrcweir void Font::SetUnderline( FontUnderline eUnderline ) 589*cdf0e10cSrcweir { 590*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 591*cdf0e10cSrcweir 592*cdf0e10cSrcweir if( mpImplFont->meUnderline != eUnderline ) 593*cdf0e10cSrcweir { 594*cdf0e10cSrcweir MakeUnique(); 595*cdf0e10cSrcweir mpImplFont->meUnderline = eUnderline; 596*cdf0e10cSrcweir } 597*cdf0e10cSrcweir } 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir // ----------------------------------------------------------------------- 600*cdf0e10cSrcweir 601*cdf0e10cSrcweir void Font::SetOverline( FontUnderline eOverline ) 602*cdf0e10cSrcweir { 603*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 604*cdf0e10cSrcweir 605*cdf0e10cSrcweir if( mpImplFont->meOverline != eOverline ) 606*cdf0e10cSrcweir { 607*cdf0e10cSrcweir MakeUnique(); 608*cdf0e10cSrcweir mpImplFont->meOverline = eOverline; 609*cdf0e10cSrcweir } 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir 612*cdf0e10cSrcweir // ----------------------------------------------------------------------- 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir void Font::SetStrikeout( FontStrikeout eStrikeout ) 615*cdf0e10cSrcweir { 616*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir if( mpImplFont->meStrikeout != eStrikeout ) 619*cdf0e10cSrcweir { 620*cdf0e10cSrcweir MakeUnique(); 621*cdf0e10cSrcweir mpImplFont->meStrikeout = eStrikeout; 622*cdf0e10cSrcweir } 623*cdf0e10cSrcweir } 624*cdf0e10cSrcweir 625*cdf0e10cSrcweir // ----------------------------------------------------------------------- 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir void Font::SetRelief( FontRelief eRelief ) 628*cdf0e10cSrcweir { 629*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 630*cdf0e10cSrcweir 631*cdf0e10cSrcweir if( mpImplFont->meRelief != eRelief ) 632*cdf0e10cSrcweir { 633*cdf0e10cSrcweir MakeUnique(); 634*cdf0e10cSrcweir mpImplFont->meRelief = eRelief; 635*cdf0e10cSrcweir } 636*cdf0e10cSrcweir } 637*cdf0e10cSrcweir 638*cdf0e10cSrcweir // ----------------------------------------------------------------------- 639*cdf0e10cSrcweir 640*cdf0e10cSrcweir void Font::SetEmphasisMark( FontEmphasisMark eEmphasisMark ) 641*cdf0e10cSrcweir { 642*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir if( mpImplFont->meEmphasisMark != eEmphasisMark ) 645*cdf0e10cSrcweir { 646*cdf0e10cSrcweir MakeUnique(); 647*cdf0e10cSrcweir mpImplFont->meEmphasisMark = eEmphasisMark; 648*cdf0e10cSrcweir } 649*cdf0e10cSrcweir } 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir // ----------------------------------------------------------------------- 652*cdf0e10cSrcweir 653*cdf0e10cSrcweir void Font::SetWordLineMode( sal_Bool bWordLine ) 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir if( mpImplFont->mbWordLine != bWordLine ) 658*cdf0e10cSrcweir { 659*cdf0e10cSrcweir MakeUnique(); 660*cdf0e10cSrcweir mpImplFont->mbWordLine = bWordLine; 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir } 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir // ----------------------------------------------------------------------- 665*cdf0e10cSrcweir 666*cdf0e10cSrcweir Font& Font::operator=( const Font& rFont ) 667*cdf0e10cSrcweir { 668*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 669*cdf0e10cSrcweir DBG_CHKOBJ( &rFont, Font, NULL ); 670*cdf0e10cSrcweir DBG_ASSERT( rFont.mpImplFont->mnRefCount < 0xFFFE, "Font: RefCount overflow" ); 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann 673*cdf0e10cSrcweir // RefCount == 0 fuer statische Objekte 674*cdf0e10cSrcweir if ( rFont.mpImplFont->mnRefCount ) 675*cdf0e10cSrcweir rFont.mpImplFont->mnRefCount++; 676*cdf0e10cSrcweir 677*cdf0e10cSrcweir // Wenn es keine statischen ImplDaten sind, dann loeschen, wenn es 678*cdf0e10cSrcweir // die letzte Referenz ist, sonst Referenzcounter decrementieren 679*cdf0e10cSrcweir if ( mpImplFont->mnRefCount ) 680*cdf0e10cSrcweir { 681*cdf0e10cSrcweir if ( mpImplFont->mnRefCount == 1 ) 682*cdf0e10cSrcweir delete mpImplFont; 683*cdf0e10cSrcweir else 684*cdf0e10cSrcweir mpImplFont->mnRefCount--; 685*cdf0e10cSrcweir } 686*cdf0e10cSrcweir 687*cdf0e10cSrcweir mpImplFont = rFont.mpImplFont; 688*cdf0e10cSrcweir 689*cdf0e10cSrcweir return *this; 690*cdf0e10cSrcweir } 691*cdf0e10cSrcweir 692*cdf0e10cSrcweir // ----------------------------------------------------------------------- 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir sal_Bool Font::operator==( const Font& rFont ) const 695*cdf0e10cSrcweir { 696*cdf0e10cSrcweir DBG_CHKTHIS( Font, NULL ); 697*cdf0e10cSrcweir DBG_CHKOBJ( &rFont, Font, NULL ); 698*cdf0e10cSrcweir 699*cdf0e10cSrcweir if( mpImplFont == rFont.mpImplFont ) 700*cdf0e10cSrcweir return sal_True; 701*cdf0e10cSrcweir if( *mpImplFont == *rFont.mpImplFont ) 702*cdf0e10cSrcweir return sal_True; 703*cdf0e10cSrcweir 704*cdf0e10cSrcweir return sal_False; 705*cdf0e10cSrcweir } 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir // ----------------------------------------------------------------------- 708*cdf0e10cSrcweir 709*cdf0e10cSrcweir void Font::Merge( const Font& rFont ) 710*cdf0e10cSrcweir { 711*cdf0e10cSrcweir if ( rFont.GetName().Len() ) 712*cdf0e10cSrcweir { 713*cdf0e10cSrcweir SetName( rFont.GetName() ); 714*cdf0e10cSrcweir SetStyleName( rFont.GetStyleName() ); 715*cdf0e10cSrcweir SetCharSet( GetCharSet() ); 716*cdf0e10cSrcweir SetLanguage( rFont.GetLanguage() ); 717*cdf0e10cSrcweir SetCJKContextLanguage( rFont.GetCJKContextLanguage() ); 718*cdf0e10cSrcweir // don't use access methods here, might lead to AskConfig(), if DONTKNOW 719*cdf0e10cSrcweir SetFamily( rFont.mpImplFont->meFamily ); 720*cdf0e10cSrcweir SetPitch( rFont.mpImplFont->mePitch ); 721*cdf0e10cSrcweir } 722*cdf0e10cSrcweir 723*cdf0e10cSrcweir // don't use access methods here, might lead to AskConfig(), if DONTKNOW 724*cdf0e10cSrcweir if ( rFont.mpImplFont->meWeight != WEIGHT_DONTKNOW ) 725*cdf0e10cSrcweir SetWeight( rFont.GetWeight() ); 726*cdf0e10cSrcweir if ( rFont.mpImplFont->meItalic != ITALIC_DONTKNOW ) 727*cdf0e10cSrcweir SetItalic( rFont.GetItalic() ); 728*cdf0e10cSrcweir if ( rFont.mpImplFont->meWidthType != WIDTH_DONTKNOW ) 729*cdf0e10cSrcweir SetWidthType( rFont.GetWidthType() ); 730*cdf0e10cSrcweir 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir if ( rFont.GetSize().Height() ) 733*cdf0e10cSrcweir SetSize( rFont.GetSize() ); 734*cdf0e10cSrcweir if ( rFont.GetUnderline() != UNDERLINE_DONTKNOW ) 735*cdf0e10cSrcweir { 736*cdf0e10cSrcweir SetUnderline( rFont.GetUnderline() ); 737*cdf0e10cSrcweir SetWordLineMode( rFont.IsWordLineMode() ); 738*cdf0e10cSrcweir } 739*cdf0e10cSrcweir if ( rFont.GetOverline() != UNDERLINE_DONTKNOW ) 740*cdf0e10cSrcweir { 741*cdf0e10cSrcweir SetOverline( rFont.GetOverline() ); 742*cdf0e10cSrcweir SetWordLineMode( rFont.IsWordLineMode() ); 743*cdf0e10cSrcweir } 744*cdf0e10cSrcweir if ( rFont.GetStrikeout() != STRIKEOUT_DONTKNOW ) 745*cdf0e10cSrcweir { 746*cdf0e10cSrcweir SetStrikeout( rFont.GetStrikeout() ); 747*cdf0e10cSrcweir SetWordLineMode( rFont.IsWordLineMode() ); 748*cdf0e10cSrcweir } 749*cdf0e10cSrcweir 750*cdf0e10cSrcweir // Defaults? 751*cdf0e10cSrcweir SetOrientation( rFont.GetOrientation() ); 752*cdf0e10cSrcweir SetVertical( rFont.IsVertical() ); 753*cdf0e10cSrcweir SetEmphasisMark( rFont.GetEmphasisMark() ); 754*cdf0e10cSrcweir SetKerning( rFont.IsKerning() ); 755*cdf0e10cSrcweir SetOutline( rFont.IsOutline() ); 756*cdf0e10cSrcweir SetShadow( rFont.IsShadow() ); 757*cdf0e10cSrcweir SetRelief( rFont.GetRelief() ); 758*cdf0e10cSrcweir } 759*cdf0e10cSrcweir 760*cdf0e10cSrcweir void Font::GetFontAttributes( ImplFontAttributes& rAttrs ) const 761*cdf0e10cSrcweir { 762*cdf0e10cSrcweir // #i56788# Use members directly, don't risc config access. 763*cdf0e10cSrcweir rAttrs.maName = mpImplFont->maFamilyName; 764*cdf0e10cSrcweir rAttrs.maStyleName = mpImplFont->maStyleName; 765*cdf0e10cSrcweir rAttrs.meFamily = mpImplFont->meFamily; 766*cdf0e10cSrcweir rAttrs.mePitch = mpImplFont->mePitch; 767*cdf0e10cSrcweir rAttrs.meItalic = mpImplFont->meItalic; 768*cdf0e10cSrcweir rAttrs.meWeight = mpImplFont->meWeight; 769*cdf0e10cSrcweir rAttrs.meWidthType = WIDTH_DONTKNOW; 770*cdf0e10cSrcweir rAttrs.mbSymbolFlag= (mpImplFont->meCharSet == RTL_TEXTENCODING_SYMBOL); 771*cdf0e10cSrcweir } 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir 774*cdf0e10cSrcweir // ----------------------------------------------------------------------- 775*cdf0e10cSrcweir 776*cdf0e10cSrcweir SvStream& operator>>( SvStream& rIStm, Impl_Font& rImpl_Font ) 777*cdf0e10cSrcweir { 778*cdf0e10cSrcweir VersionCompat aCompat( rIStm, STREAM_READ ); 779*cdf0e10cSrcweir sal_uInt16 nTmp16; 780*cdf0e10cSrcweir sal_Bool bTmp; 781*cdf0e10cSrcweir sal_uInt8 nTmp8; 782*cdf0e10cSrcweir 783*cdf0e10cSrcweir rIStm.ReadByteString( rImpl_Font.maFamilyName, rIStm.GetStreamCharSet() ); 784*cdf0e10cSrcweir rIStm.ReadByteString( rImpl_Font.maStyleName, rIStm.GetStreamCharSet() ); 785*cdf0e10cSrcweir rIStm >> rImpl_Font.maSize; 786*cdf0e10cSrcweir 787*cdf0e10cSrcweir rIStm >> nTmp16; rImpl_Font.meCharSet = (rtl_TextEncoding) nTmp16; 788*cdf0e10cSrcweir rIStm >> nTmp16; rImpl_Font.meFamily = (FontFamily) nTmp16; 789*cdf0e10cSrcweir rIStm >> nTmp16; rImpl_Font.mePitch = (FontPitch) nTmp16; 790*cdf0e10cSrcweir rIStm >> nTmp16; rImpl_Font.meWeight = (FontWeight) nTmp16; 791*cdf0e10cSrcweir rIStm >> nTmp16; rImpl_Font.meUnderline = (FontUnderline) nTmp16; 792*cdf0e10cSrcweir rIStm >> nTmp16; rImpl_Font.meStrikeout = (FontStrikeout) nTmp16; 793*cdf0e10cSrcweir rIStm >> nTmp16; rImpl_Font.meItalic = (FontItalic) nTmp16; 794*cdf0e10cSrcweir rIStm >> nTmp16; rImpl_Font.meLanguage = (LanguageType) nTmp16; 795*cdf0e10cSrcweir rIStm >> nTmp16; rImpl_Font.meWidthType = (FontWidth) nTmp16; 796*cdf0e10cSrcweir 797*cdf0e10cSrcweir rIStm >> rImpl_Font.mnOrientation; 798*cdf0e10cSrcweir 799*cdf0e10cSrcweir rIStm >> bTmp; rImpl_Font.mbWordLine = bTmp; 800*cdf0e10cSrcweir rIStm >> bTmp; rImpl_Font.mbOutline = bTmp; 801*cdf0e10cSrcweir rIStm >> bTmp; rImpl_Font.mbShadow = bTmp; 802*cdf0e10cSrcweir rIStm >> nTmp8; rImpl_Font.mnKerning = nTmp8; 803*cdf0e10cSrcweir 804*cdf0e10cSrcweir if( aCompat.GetVersion() >= 2 ) 805*cdf0e10cSrcweir { 806*cdf0e10cSrcweir rIStm >> nTmp8; rImpl_Font.meRelief = (FontRelief)nTmp8; 807*cdf0e10cSrcweir rIStm >> nTmp16; rImpl_Font.meCJKLanguage = (LanguageType)nTmp16; 808*cdf0e10cSrcweir rIStm >> bTmp; rImpl_Font.mbVertical = bTmp; 809*cdf0e10cSrcweir rIStm >> nTmp16; rImpl_Font.meEmphasisMark = (FontEmphasisMark)nTmp16; 810*cdf0e10cSrcweir } 811*cdf0e10cSrcweir if( aCompat.GetVersion() >= 3 ) 812*cdf0e10cSrcweir { 813*cdf0e10cSrcweir rIStm >> nTmp16; rImpl_Font.meOverline = (FontUnderline) nTmp16; 814*cdf0e10cSrcweir } 815*cdf0e10cSrcweir // Relief 816*cdf0e10cSrcweir // CJKContextLanguage 817*cdf0e10cSrcweir 818*cdf0e10cSrcweir return rIStm; 819*cdf0e10cSrcweir } 820*cdf0e10cSrcweir 821*cdf0e10cSrcweir // ----------------------------------------------------------------------- 822*cdf0e10cSrcweir 823*cdf0e10cSrcweir SvStream& operator<<( SvStream& rOStm, const Impl_Font& rImpl_Font ) 824*cdf0e10cSrcweir { 825*cdf0e10cSrcweir VersionCompat aCompat( rOStm, STREAM_WRITE, 3 ); 826*cdf0e10cSrcweir rOStm.WriteByteString( rImpl_Font.maFamilyName, rOStm.GetStreamCharSet() ); 827*cdf0e10cSrcweir rOStm.WriteByteString( rImpl_Font.maStyleName, rOStm.GetStreamCharSet() ); 828*cdf0e10cSrcweir rOStm << rImpl_Font.maSize; 829*cdf0e10cSrcweir 830*cdf0e10cSrcweir rOStm << (sal_uInt16) GetStoreCharSet( rImpl_Font.meCharSet ); 831*cdf0e10cSrcweir rOStm << (sal_uInt16) rImpl_Font.meFamily; 832*cdf0e10cSrcweir rOStm << (sal_uInt16) rImpl_Font.mePitch; 833*cdf0e10cSrcweir rOStm << (sal_uInt16) rImpl_Font.meWeight; 834*cdf0e10cSrcweir rOStm << (sal_uInt16) rImpl_Font.meUnderline; 835*cdf0e10cSrcweir rOStm << (sal_uInt16) rImpl_Font.meStrikeout; 836*cdf0e10cSrcweir rOStm << (sal_uInt16) rImpl_Font.meItalic; 837*cdf0e10cSrcweir rOStm << (sal_uInt16) rImpl_Font.meLanguage; 838*cdf0e10cSrcweir rOStm << (sal_uInt16) rImpl_Font.meWidthType; 839*cdf0e10cSrcweir 840*cdf0e10cSrcweir rOStm << rImpl_Font.mnOrientation; 841*cdf0e10cSrcweir 842*cdf0e10cSrcweir rOStm << (sal_Bool) rImpl_Font.mbWordLine; 843*cdf0e10cSrcweir rOStm << (sal_Bool) rImpl_Font.mbOutline; 844*cdf0e10cSrcweir rOStm << (sal_Bool) rImpl_Font.mbShadow; 845*cdf0e10cSrcweir rOStm << (sal_uInt8) rImpl_Font.mnKerning; 846*cdf0e10cSrcweir 847*cdf0e10cSrcweir // new in version 2 848*cdf0e10cSrcweir rOStm << (sal_uInt8) rImpl_Font.meRelief; 849*cdf0e10cSrcweir rOStm << (sal_uInt16) rImpl_Font.meCJKLanguage; 850*cdf0e10cSrcweir rOStm << (sal_Bool) rImpl_Font.mbVertical; 851*cdf0e10cSrcweir rOStm << (sal_uInt16) rImpl_Font.meEmphasisMark; 852*cdf0e10cSrcweir 853*cdf0e10cSrcweir // new in version 3 854*cdf0e10cSrcweir rOStm << (sal_uInt16) rImpl_Font.meOverline; 855*cdf0e10cSrcweir 856*cdf0e10cSrcweir return rOStm; 857*cdf0e10cSrcweir } 858*cdf0e10cSrcweir 859*cdf0e10cSrcweir // ----------------------------------------------------------------------- 860*cdf0e10cSrcweir 861*cdf0e10cSrcweir SvStream& operator>>( SvStream& rIStm, Font& rFont ) 862*cdf0e10cSrcweir { 863*cdf0e10cSrcweir rFont.MakeUnique(); 864*cdf0e10cSrcweir return( rIStm >> *rFont.mpImplFont ); 865*cdf0e10cSrcweir } 866*cdf0e10cSrcweir 867*cdf0e10cSrcweir // ----------------------------------------------------------------------- 868*cdf0e10cSrcweir 869*cdf0e10cSrcweir SvStream& operator<<( SvStream& rOStm, const Font& rFont ) 870*cdf0e10cSrcweir { 871*cdf0e10cSrcweir return( rOStm << *rFont.mpImplFont ); 872*cdf0e10cSrcweir } 873*cdf0e10cSrcweir 874*cdf0e10cSrcweir // ----------------------------------------------------------------------- 875*cdf0e10cSrcweir namespace 876*cdf0e10cSrcweir { 877*cdf0e10cSrcweir bool identifyTrueTypeFont( const void* i_pBuffer, sal_uInt32 i_nSize, Font& o_rResult ) 878*cdf0e10cSrcweir { 879*cdf0e10cSrcweir bool bResult = false; 880*cdf0e10cSrcweir TrueTypeFont* pTTF = NULL; 881*cdf0e10cSrcweir if( OpenTTFontBuffer( const_cast<void*>(i_pBuffer), i_nSize, 0, &pTTF ) == SF_OK ) 882*cdf0e10cSrcweir { 883*cdf0e10cSrcweir TTGlobalFontInfo aInfo; 884*cdf0e10cSrcweir GetTTGlobalFontInfo( pTTF, &aInfo ); 885*cdf0e10cSrcweir // most important: the family name 886*cdf0e10cSrcweir if( aInfo.ufamily ) 887*cdf0e10cSrcweir o_rResult.SetName( aInfo.ufamily ); 888*cdf0e10cSrcweir else if( aInfo.family ) 889*cdf0e10cSrcweir o_rResult.SetName( rtl::OStringToOUString( aInfo.family, RTL_TEXTENCODING_ASCII_US ) ); 890*cdf0e10cSrcweir // set weight 891*cdf0e10cSrcweir if( aInfo.weight ) 892*cdf0e10cSrcweir { 893*cdf0e10cSrcweir if( aInfo.weight < FW_EXTRALIGHT ) 894*cdf0e10cSrcweir o_rResult.SetWeight( WEIGHT_THIN ); 895*cdf0e10cSrcweir else if( aInfo.weight < FW_LIGHT ) 896*cdf0e10cSrcweir o_rResult.SetWeight( WEIGHT_ULTRALIGHT ); 897*cdf0e10cSrcweir else if( aInfo.weight < FW_NORMAL ) 898*cdf0e10cSrcweir o_rResult.SetWeight( WEIGHT_LIGHT ); 899*cdf0e10cSrcweir else if( aInfo.weight < FW_MEDIUM ) 900*cdf0e10cSrcweir o_rResult.SetWeight( WEIGHT_NORMAL ); 901*cdf0e10cSrcweir else if( aInfo.weight < FW_SEMIBOLD ) 902*cdf0e10cSrcweir o_rResult.SetWeight( WEIGHT_MEDIUM ); 903*cdf0e10cSrcweir else if( aInfo.weight < FW_BOLD ) 904*cdf0e10cSrcweir o_rResult.SetWeight( WEIGHT_SEMIBOLD ); 905*cdf0e10cSrcweir else if( aInfo.weight < FW_EXTRABOLD ) 906*cdf0e10cSrcweir o_rResult.SetWeight( WEIGHT_BOLD ); 907*cdf0e10cSrcweir else if( aInfo.weight < FW_BLACK ) 908*cdf0e10cSrcweir o_rResult.SetWeight( WEIGHT_ULTRABOLD ); 909*cdf0e10cSrcweir else 910*cdf0e10cSrcweir o_rResult.SetWeight( WEIGHT_BLACK ); 911*cdf0e10cSrcweir } 912*cdf0e10cSrcweir else 913*cdf0e10cSrcweir o_rResult.SetWeight( (aInfo.macStyle & 1) ? WEIGHT_BOLD : WEIGHT_NORMAL ); 914*cdf0e10cSrcweir // set width 915*cdf0e10cSrcweir if( aInfo.width ) 916*cdf0e10cSrcweir { 917*cdf0e10cSrcweir if( aInfo.width == FWIDTH_ULTRA_CONDENSED ) 918*cdf0e10cSrcweir o_rResult.SetWidth( WIDTH_ULTRA_CONDENSED ); 919*cdf0e10cSrcweir else if( aInfo.width == FWIDTH_EXTRA_CONDENSED ) 920*cdf0e10cSrcweir o_rResult.SetWidth( WIDTH_EXTRA_CONDENSED ); 921*cdf0e10cSrcweir else if( aInfo.width == FWIDTH_CONDENSED ) 922*cdf0e10cSrcweir o_rResult.SetWidth( WIDTH_CONDENSED ); 923*cdf0e10cSrcweir else if( aInfo.width == FWIDTH_SEMI_CONDENSED ) 924*cdf0e10cSrcweir o_rResult.SetWidth( WIDTH_SEMI_CONDENSED ); 925*cdf0e10cSrcweir else if( aInfo.width == FWIDTH_NORMAL ) 926*cdf0e10cSrcweir o_rResult.SetWidth( WIDTH_NORMAL ); 927*cdf0e10cSrcweir else if( aInfo.width == FWIDTH_SEMI_EXPANDED ) 928*cdf0e10cSrcweir o_rResult.SetWidth( WIDTH_SEMI_EXPANDED ); 929*cdf0e10cSrcweir else if( aInfo.width == FWIDTH_EXPANDED ) 930*cdf0e10cSrcweir o_rResult.SetWidth( WIDTH_EXPANDED ); 931*cdf0e10cSrcweir else if( aInfo.width == FWIDTH_EXTRA_EXPANDED ) 932*cdf0e10cSrcweir o_rResult.SetWidth( WIDTH_EXTRA_EXPANDED ); 933*cdf0e10cSrcweir else if( aInfo.width >= FWIDTH_ULTRA_EXPANDED ) 934*cdf0e10cSrcweir o_rResult.SetWidth( WIDTH_ULTRA_EXPANDED ); 935*cdf0e10cSrcweir } 936*cdf0e10cSrcweir // set italic 937*cdf0e10cSrcweir o_rResult.SetItalic( (aInfo.italicAngle != 0) ? ITALIC_NORMAL : ITALIC_NONE ); 938*cdf0e10cSrcweir 939*cdf0e10cSrcweir // set pitch 940*cdf0e10cSrcweir o_rResult.SetPitch( (aInfo.pitch == 0) ? PITCH_VARIABLE : PITCH_FIXED ); 941*cdf0e10cSrcweir 942*cdf0e10cSrcweir // set style name 943*cdf0e10cSrcweir if( aInfo.usubfamily ) 944*cdf0e10cSrcweir o_rResult.SetStyleName( rtl::OUString( aInfo.usubfamily ) ); 945*cdf0e10cSrcweir else if( aInfo.subfamily ) 946*cdf0e10cSrcweir o_rResult.SetStyleName( rtl::OUString::createFromAscii( aInfo.subfamily ) ); 947*cdf0e10cSrcweir 948*cdf0e10cSrcweir // cleanup 949*cdf0e10cSrcweir CloseTTFont( pTTF ); 950*cdf0e10cSrcweir // success 951*cdf0e10cSrcweir bResult = true; 952*cdf0e10cSrcweir } 953*cdf0e10cSrcweir return bResult; 954*cdf0e10cSrcweir } 955*cdf0e10cSrcweir 956*cdf0e10cSrcweir struct WeightSearchEntry 957*cdf0e10cSrcweir { 958*cdf0e10cSrcweir const char* string; 959*cdf0e10cSrcweir int string_len; 960*cdf0e10cSrcweir FontWeight weight; 961*cdf0e10cSrcweir 962*cdf0e10cSrcweir bool operator<( const WeightSearchEntry& rRight ) const 963*cdf0e10cSrcweir { 964*cdf0e10cSrcweir return rtl_str_compareIgnoreAsciiCase_WithLength( string, string_len, rRight.string, rRight.string_len ) < 0; 965*cdf0e10cSrcweir } 966*cdf0e10cSrcweir } 967*cdf0e10cSrcweir weight_table[] = 968*cdf0e10cSrcweir { 969*cdf0e10cSrcweir { "black", 5, WEIGHT_BLACK }, 970*cdf0e10cSrcweir { "bold", 4, WEIGHT_BOLD }, 971*cdf0e10cSrcweir { "book", 4, WEIGHT_LIGHT }, 972*cdf0e10cSrcweir { "demi", 4, WEIGHT_SEMIBOLD }, 973*cdf0e10cSrcweir { "heavy", 5, WEIGHT_BLACK }, 974*cdf0e10cSrcweir { "light", 5, WEIGHT_LIGHT }, 975*cdf0e10cSrcweir { "medium", 6, WEIGHT_MEDIUM }, 976*cdf0e10cSrcweir { "regular", 7, WEIGHT_NORMAL }, 977*cdf0e10cSrcweir { "super", 5, WEIGHT_ULTRABOLD }, 978*cdf0e10cSrcweir { "thin", 4, WEIGHT_THIN } 979*cdf0e10cSrcweir }; 980*cdf0e10cSrcweir 981*cdf0e10cSrcweir bool identifyType1Font( const char* i_pBuffer, sal_uInt32 i_nSize, Font& o_rResult ) 982*cdf0e10cSrcweir { 983*cdf0e10cSrcweir bool bResult = false; 984*cdf0e10cSrcweir // might be a type1, find eexec 985*cdf0e10cSrcweir const char* pStream = i_pBuffer; 986*cdf0e10cSrcweir const char* pExec = "eexec"; 987*cdf0e10cSrcweir const char* pExecPos = std::search( pStream, pStream+i_nSize, pExec, pExec+5 ); 988*cdf0e10cSrcweir if( pExecPos != pStream+i_nSize) 989*cdf0e10cSrcweir { 990*cdf0e10cSrcweir // find /FamilyName entry 991*cdf0e10cSrcweir static const char* pFam = "/FamilyName"; 992*cdf0e10cSrcweir const char* pFamPos = std::search( pStream, pExecPos, pFam, pFam+11 ); 993*cdf0e10cSrcweir if( pFamPos != pExecPos ) 994*cdf0e10cSrcweir { 995*cdf0e10cSrcweir // extract the string value behind /FamilyName 996*cdf0e10cSrcweir const char* pOpen = pFamPos+11; 997*cdf0e10cSrcweir while( pOpen < pExecPos && *pOpen != '(' ) 998*cdf0e10cSrcweir pOpen++; 999*cdf0e10cSrcweir const char* pClose = pOpen; 1000*cdf0e10cSrcweir while( pClose < pExecPos && *pClose != ')' ) 1001*cdf0e10cSrcweir pClose++; 1002*cdf0e10cSrcweir if( pClose - pOpen > 1 ) 1003*cdf0e10cSrcweir { 1004*cdf0e10cSrcweir o_rResult.SetName( rtl::OStringToOUString( rtl::OString( pOpen+1, pClose-pOpen-1 ), RTL_TEXTENCODING_ASCII_US ) ); 1005*cdf0e10cSrcweir } 1006*cdf0e10cSrcweir } 1007*cdf0e10cSrcweir 1008*cdf0e10cSrcweir // parse /ItalicAngle 1009*cdf0e10cSrcweir static const char* pItalic = "/ItalicAngle"; 1010*cdf0e10cSrcweir const char* pItalicPos = std::search( pStream, pExecPos, pItalic, pItalic+12 ); 1011*cdf0e10cSrcweir if( pItalicPos != pExecPos ) 1012*cdf0e10cSrcweir { 1013*cdf0e10cSrcweir sal_Int32 nItalic = rtl_str_toInt32( pItalicPos+12, 10 ); 1014*cdf0e10cSrcweir o_rResult.SetItalic( (nItalic != 0) ? ITALIC_NORMAL : ITALIC_NONE ); 1015*cdf0e10cSrcweir } 1016*cdf0e10cSrcweir 1017*cdf0e10cSrcweir // parse /Weight 1018*cdf0e10cSrcweir static const char* pWeight = "/Weight"; 1019*cdf0e10cSrcweir const char* pWeightPos = std::search( pStream, pExecPos, pWeight, pWeight+7 ); 1020*cdf0e10cSrcweir if( pWeightPos != pExecPos ) 1021*cdf0e10cSrcweir { 1022*cdf0e10cSrcweir // extract the string value behind /Weight 1023*cdf0e10cSrcweir const char* pOpen = pWeightPos+7; 1024*cdf0e10cSrcweir while( pOpen < pExecPos && *pOpen != '(' ) 1025*cdf0e10cSrcweir pOpen++; 1026*cdf0e10cSrcweir const char* pClose = pOpen; 1027*cdf0e10cSrcweir while( pClose < pExecPos && *pClose != ')' ) 1028*cdf0e10cSrcweir pClose++; 1029*cdf0e10cSrcweir if( pClose - pOpen > 1 ) 1030*cdf0e10cSrcweir { 1031*cdf0e10cSrcweir WeightSearchEntry aEnt; 1032*cdf0e10cSrcweir aEnt.string = pOpen+1; 1033*cdf0e10cSrcweir aEnt.string_len = (pClose-pOpen)-1; 1034*cdf0e10cSrcweir aEnt.weight = WEIGHT_NORMAL; 1035*cdf0e10cSrcweir const int nEnt = sizeof( weight_table ) / sizeof( weight_table[0] ); 1036*cdf0e10cSrcweir WeightSearchEntry* pFound = std::lower_bound( weight_table, weight_table+nEnt, aEnt ); 1037*cdf0e10cSrcweir if( pFound != (weight_table+nEnt) ) 1038*cdf0e10cSrcweir o_rResult.SetWeight( pFound->weight ); 1039*cdf0e10cSrcweir } 1040*cdf0e10cSrcweir } 1041*cdf0e10cSrcweir 1042*cdf0e10cSrcweir // parse isFixedPitch 1043*cdf0e10cSrcweir static const char* pFixed = "/isFixedPitch"; 1044*cdf0e10cSrcweir const char* pFixedPos = std::search( pStream, pExecPos, pFixed, pFixed+13 ); 1045*cdf0e10cSrcweir if( pFixedPos != pExecPos ) 1046*cdf0e10cSrcweir { 1047*cdf0e10cSrcweir // skip whitespace 1048*cdf0e10cSrcweir while( pFixedPos < pExecPos-4 && 1049*cdf0e10cSrcweir ( *pFixedPos == ' ' || 1050*cdf0e10cSrcweir *pFixedPos == '\t' || 1051*cdf0e10cSrcweir *pFixedPos == '\r' || 1052*cdf0e10cSrcweir *pFixedPos == '\n' ) ) 1053*cdf0e10cSrcweir { 1054*cdf0e10cSrcweir pFixedPos++; 1055*cdf0e10cSrcweir } 1056*cdf0e10cSrcweir // find "true" value 1057*cdf0e10cSrcweir if( rtl_str_compareIgnoreAsciiCase_WithLength( pFixedPos, 4, "true", 4 ) == 0 ) 1058*cdf0e10cSrcweir o_rResult.SetPitch( PITCH_FIXED ); 1059*cdf0e10cSrcweir else 1060*cdf0e10cSrcweir o_rResult.SetPitch( PITCH_VARIABLE ); 1061*cdf0e10cSrcweir } 1062*cdf0e10cSrcweir } 1063*cdf0e10cSrcweir return bResult; 1064*cdf0e10cSrcweir } 1065*cdf0e10cSrcweir } 1066*cdf0e10cSrcweir 1067*cdf0e10cSrcweir Font Font::identifyFont( const void* i_pBuffer, sal_uInt32 i_nSize ) 1068*cdf0e10cSrcweir { 1069*cdf0e10cSrcweir Font aResult; 1070*cdf0e10cSrcweir if( ! identifyTrueTypeFont( i_pBuffer, i_nSize, aResult ) ) 1071*cdf0e10cSrcweir { 1072*cdf0e10cSrcweir const char* pStream = reinterpret_cast<const char*>(i_pBuffer); 1073*cdf0e10cSrcweir if( pStream && i_nSize > 100 && 1074*cdf0e10cSrcweir *pStream == '%' && pStream[1] == '!' ) 1075*cdf0e10cSrcweir { 1076*cdf0e10cSrcweir identifyType1Font( pStream, i_nSize, aResult ); 1077*cdf0e10cSrcweir } 1078*cdf0e10cSrcweir } 1079*cdf0e10cSrcweir 1080*cdf0e10cSrcweir return aResult; 1081*cdf0e10cSrcweir } 1082*cdf0e10cSrcweir 1083*cdf0e10cSrcweir // the inlines from the font.hxx header are now instantiated for pImpl-ification 1084*cdf0e10cSrcweir // TODO: reformat 1085*cdf0e10cSrcweir const Color& Font::GetColor() const { return mpImplFont->maColor; } 1086*cdf0e10cSrcweir const Color& Font::GetFillColor() const { return mpImplFont->maFillColor; } 1087*cdf0e10cSrcweir sal_Bool Font::IsTransparent() const { return mpImplFont->mbTransparent; } 1088*cdf0e10cSrcweir FontAlign Font::GetAlign() const { return mpImplFont->meAlign; } 1089*cdf0e10cSrcweir const String& Font::GetName() const { return mpImplFont->maFamilyName; } 1090*cdf0e10cSrcweir const String& Font::GetStyleName() const { return mpImplFont->maStyleName; } 1091*cdf0e10cSrcweir const Size& Font::GetSize() const { return mpImplFont->maSize; } 1092*cdf0e10cSrcweir void Font::SetHeight( long nHeight ) { SetSize( Size( mpImplFont->maSize.Width(), nHeight ) ); } 1093*cdf0e10cSrcweir long Font::GetHeight() const { return mpImplFont->maSize.Height(); } 1094*cdf0e10cSrcweir void Font::SetWidth( long nWidth ) { SetSize( Size( nWidth, mpImplFont->maSize.Height() ) ); } 1095*cdf0e10cSrcweir long Font::GetWidth() const { return mpImplFont->maSize.Width(); } 1096*cdf0e10cSrcweir rtl_TextEncoding Font::GetCharSet() const { return mpImplFont->meCharSet; } 1097*cdf0e10cSrcweir LanguageType Font::GetLanguage() const { return mpImplFont->meLanguage; } 1098*cdf0e10cSrcweir LanguageType Font::GetCJKContextLanguage() const { return mpImplFont->meCJKLanguage; } 1099*cdf0e10cSrcweir short Font::GetOrientation() const { return mpImplFont->mnOrientation; } 1100*cdf0e10cSrcweir sal_Bool Font::IsVertical() const { return mpImplFont->mbVertical; } 1101*cdf0e10cSrcweir FontKerning Font::GetKerning() const { return mpImplFont->mnKerning; } 1102*cdf0e10cSrcweir FontPitch Font::GetPitch() const { return mpImplFont->GetPitch(); } 1103*cdf0e10cSrcweir FontWeight Font::GetWeight() const { return mpImplFont->GetWeight(); } 1104*cdf0e10cSrcweir FontWidth Font::GetWidthType() const { return mpImplFont->GetWidthType(); } 1105*cdf0e10cSrcweir FontItalic Font::GetItalic() const { return mpImplFont->GetItalic(); } 1106*cdf0e10cSrcweir FontFamily Font::GetFamily() const { return mpImplFont->GetFamily(); } 1107*cdf0e10cSrcweir sal_Bool Font::IsOutline() const { return mpImplFont->mbOutline; } 1108*cdf0e10cSrcweir sal_Bool Font::IsShadow() const { return mpImplFont->mbShadow; } 1109*cdf0e10cSrcweir FontRelief Font::GetRelief() const { return mpImplFont->meRelief; } 1110*cdf0e10cSrcweir FontUnderline Font::GetUnderline() const { return mpImplFont->meUnderline; } 1111*cdf0e10cSrcweir FontUnderline Font::GetOverline() const { return mpImplFont->meOverline; } 1112*cdf0e10cSrcweir FontStrikeout Font::GetStrikeout() const { return mpImplFont->meStrikeout; } 1113*cdf0e10cSrcweir FontEmphasisMark Font::GetEmphasisMark() const { return mpImplFont->meEmphasisMark; } 1114*cdf0e10cSrcweir sal_Bool Font::IsWordLineMode() const { return mpImplFont->mbWordLine; } 1115*cdf0e10cSrcweir sal_Bool Font::IsSameInstance( const Font& rFont ) const { return (mpImplFont == rFont.mpImplFont); } 1116