24#include <com/sun/star/rendering/PanoseProportion.hpp>
27#include <rtl/math.hxx>
40 const uno::Sequence< beans::PropertyValue >& rExtraFontProperties,
41 const geometry::Matrix2D& rFontMatrix,
42 rendering::XGraphicDevice& rDevice,
45 maFont(
vcl::
Font( rFontRequest.FontDescription.FamilyName,
46 rFontRequest.FontDescription.StyleName,
48 maFontRequest( rFontRequest ),
49 mpRefDevice( &rDevice ),
50 mpOutDevProvider( rOutDevProvider ),
51 maFontMatrix( rFontMatrix )
53 maFont->SetAlignment( ALIGN_BASELINE );
54 maFont->SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==css::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE );
55 maFont->SetVertical( rFontRequest.FontDescription.IsVertical==css::util::TriState_YES );
58 maFont->SetWeight(
static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) );
59 maFont->SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL );
61 rFontRequest.FontDescription.FontDescription.Proportion == rendering::PanoseProportion::MONO_SPACED
62 ? PITCH_FIXED : PITCH_VARIABLE);
69 sal_uInt32 nEmphasisMark = 0;
77 void SAL_CALL CanvasFont::disposing()
81 mpOutDevProvider.reset();
85 uno::Reference< rendering::XTextLayout > SAL_CALL CanvasFont::createTextLayout(
const rendering::StringContext& aText,
sal_Int8 nDirection, sal_Int64 )
89 if( !mpRefDevice.is() )
90 return uno::Reference< rendering::XTextLayout >();
99 rendering::FontRequest SAL_CALL CanvasFont::getFontRequest( )
103 return maFontRequest;
106 rendering::FontMetrics SAL_CALL CanvasFont::getFontMetrics( )
112 pVDev->SetFont(getVCLFont());
113 const ::FontMetric& aMetric( pVDev->GetFontMetric() );
115 return rendering::FontMetrics(
117 aMetric.GetDescent(),
118 aMetric.GetInternalLeading(),
119 aMetric.GetExternalLeading(),
121 aMetric.GetDescent() / 2.0,
122 aMetric.GetAscent() / 2.0);
125 uno::Sequence< double > SAL_CALL CanvasFont::getAvailableSizes( )
128 return uno::Sequence< double >();
131 uno::Sequence< beans::PropertyValue > SAL_CALL CanvasFont::getExtraFontProperties( )
134 return uno::Sequence< beans::PropertyValue >();
137 OUString SAL_CALL CanvasFont::getImplementationName()
139 return "VCLCanvas::CanvasFont";
142 sal_Bool SAL_CALL CanvasFont::supportsService(
const OUString& ServiceName )
147 uno::Sequence< OUString > SAL_CALL CanvasFont::getSupportedServiceNames()
149 return {
"com.sun.star.rendering.CanvasFont" };
157 const css::geometry::Matrix2D& CanvasFont::getFontMatrix()
const
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
CanvasFont(const CanvasFont &)=delete
make noncopyable
B2IRange fround(const B2DRange &rRange)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::shared_ptr< OutDevProvider > OutDevProviderSharedPtr
::cppu::WeakComponentImplHelper< css::rendering::XCanvasFont, css::lang::XServiceInfo > CanvasFont_Base