1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: implfont.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_cppcanvas.hxx"
34 #include <implfont.hxx>
35 #include <canvas/canvastools.hxx>
38 using namespace ::com::sun::star
;
40 /* Definition of Font class */
47 ImplFont::ImplFont( const uno::Reference
< rendering::XCanvas
>& rCanvas
,
48 const ::rtl::OUString
& rFontName
,
49 const double& rCellSize
) :
53 OSL_ENSURE( mxCanvas
.is(), "ImplFont::ImplFont(): Invalid Canvas" );
55 rendering::FontRequest aFontRequest
;
56 aFontRequest
.FontDescription
.FamilyName
= rFontName
;
57 aFontRequest
.CellSize
= rCellSize
;
59 geometry::Matrix2D aFontMatrix
;
60 ::canvas::tools::setIdentityMatrix2D( aFontMatrix
);
62 mxFont
= mxCanvas
->createFont( aFontRequest
,
63 uno::Sequence
< beans::PropertyValue
>(),
72 ::rtl::OUString
ImplFont::getName() const
74 OSL_ENSURE( mxFont
.is(), "ImplFont::getName(): Invalid Font" );
76 return mxFont
->getFontRequest().FontDescription
.FamilyName
;
79 double ImplFont::getCellSize() const
81 OSL_ENSURE( mxFont
.is(), "ImplFont::getCellSize(): Invalid Font" );
83 return mxFont
->getFontRequest().CellSize
;
86 uno::Reference
< rendering::XCanvasFont
> ImplFont::getUNOFont() const
88 OSL_ENSURE( mxFont
.is(), "ImplFont::getUNOFont(): Invalid Font" );