23#include <com/sun/star/rendering/PanoseProportion.hpp>
26#include <rtl/math.hxx>
41 const uno::Sequence< beans::PropertyValue >& rExtraFontProperties,
42 const geometry::Matrix2D& rFontMatrix,
44 maFont(
vcl::
Font( rFontRequest.FontDescription.FamilyName,
45 rFontRequest.FontDescription.StyleName,
47 maFontRequest( rFontRequest ),
48 mpRefDevice(
std::move( rDevice )),
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);
67 if( ::rtl::math::approxEqual( rFontMatrix.m00, rFontMatrix.m11) )
75 const bool bOldMapState( pOutDev->IsMapModeEnabled() );
76 pOutDev->EnableMapMode(
false);
78 const Size aSize = pOutDev->GetFontMetric( *maFont ).GetFontSize();
80 const double fDividend( rFontMatrix.m10 + rFontMatrix.m11 );
81 double fStretch = rFontMatrix.m00 + rFontMatrix.m01;
83 if( !::basegfx::fTools::equalZero( fDividend) )
84 fStretch /= fDividend;
88 maFont->SetAverageFontWidth( nNewWidth );
90 pOutDev->EnableMapMode(bOldMapState);
93 void CanvasFont::disposing(std::unique_lock<std::mutex>& rGuard)
103 uno::Reference< rendering::XTextLayout > SAL_CALL CanvasFont::createTextLayout(
const rendering::StringContext& aText,
sal_Int8 nDirection, sal_Int64 nRandomSeed )
107 if( !mpRefDevice.is() )
108 return uno::Reference< rendering::XTextLayout >();
117 rendering::FontRequest SAL_CALL CanvasFont::getFontRequest( )
121 return maFontRequest;
124 rendering::FontMetrics SAL_CALL CanvasFont::getFontMetrics( )
127 return rendering::FontMetrics();
130 uno::Sequence< double > SAL_CALL CanvasFont::getAvailableSizes( )
133 return uno::Sequence< double >();
136 uno::Sequence< beans::PropertyValue > SAL_CALL CanvasFont::getExtraFontProperties( )
139 return uno::Sequence< beans::PropertyValue >();
142 OUString SAL_CALL CanvasFont::getImplementationName()
144 return "CairoCanvas::CanvasFont";
147 sal_Bool SAL_CALL CanvasFont::supportsService(
const OUString& ServiceName )
152 uno::Sequence< OUString > SAL_CALL CanvasFont::getSupportedServiceNames()
154 return {
"com.sun.star.rendering.CanvasFont" };
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
constexpr tools::Long Width() const
CanvasFont(const CanvasFont &)=delete
make noncopyable
B2IRange fround(const B2DRange &rRange)
class SAL_LOPLUGIN_ANNOTATE("crosscast") SurfaceProvider typedef ::rtl::Reference< SurfaceProvider > SurfaceProviderRef
Target interface for XCachedPrimitive implementations.
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)