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