update credits
[LibreOffice.git] / canvas / source / cairo / cairo_textlayout.cxx
blob8924b4f9614c841699bc73a5486d1a710b191191
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <math.h>
22 #include <canvas/debug.hxx>
23 #include <canvas/verbosetrace.hxx>
24 #include <tools/diagnose_ex.h>
26 #include <vcl/metric.hxx>
27 #include <vcl/virdev.hxx>
29 #ifdef WNT
30 #ifdef max
31 #undef max
32 #endif
33 #ifdef min
34 #undef min
35 #endif
36 #endif
37 #include <vcl/sysdata.hxx>
39 #include <basegfx/matrix/b2dhommatrix.hxx>
40 #include <basegfx/numeric/ftools.hxx>
42 #include <boost/scoped_array.hpp>
44 #include "cairo_textlayout.hxx"
45 #include "cairo_spritecanvas.hxx"
47 #ifdef CAIRO_HAS_QUARTZ_SURFACE
48 # include "cairo_quartz_cairo.hxx"
49 #elif defined CAIRO_HAS_WIN32_SURFACE
50 # include "cairo_win32_cairo.hxx"
51 # include <cairo-win32.h>
52 #elif defined CAIRO_HAS_XLIB_SURFACE
53 # include "cairo_xlib_cairo.hxx"
54 # include <cairo-ft.h>
55 #else
56 # error Native API needed.
57 #endif
59 #ifdef IOS
60 #include <CoreText/CoreText.h>
61 #endif
63 using namespace ::cairo;
64 using namespace ::com::sun::star;
66 namespace cairocanvas
68 namespace
70 void setupLayoutMode( OutputDevice& rOutDev,
71 sal_Int8 nTextDirection )
73 // TODO(P3): avoid if already correctly set
74 sal_uLong nLayoutMode;
75 switch( nTextDirection )
77 default:
78 nLayoutMode = 0;
79 break;
80 case rendering::TextDirection::WEAK_LEFT_TO_RIGHT:
81 nLayoutMode = TEXT_LAYOUT_BIDI_LTR;
82 break;
83 case rendering::TextDirection::STRONG_LEFT_TO_RIGHT:
84 nLayoutMode = TEXT_LAYOUT_BIDI_LTR | TEXT_LAYOUT_BIDI_STRONG;
85 break;
86 case rendering::TextDirection::WEAK_RIGHT_TO_LEFT:
87 nLayoutMode = TEXT_LAYOUT_BIDI_RTL;
88 break;
89 case rendering::TextDirection::STRONG_RIGHT_TO_LEFT:
90 nLayoutMode = TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_BIDI_STRONG;
91 break;
94 // set calculated layout mode. Origin is always the left edge,
95 // as required at the API spec
96 rOutDev.SetLayoutMode( nLayoutMode | TEXT_LAYOUT_TEXTORIGIN_LEFT );
99 bool compareFallbacks(const SystemGlyphData&rA, const SystemGlyphData &rB)
101 return rA.fallbacklevel < rB.fallbacklevel;
105 TextLayout::TextLayout( const rendering::StringContext& aText,
106 sal_Int8 nDirection,
107 sal_Int64 /*nRandomSeed*/,
108 const CanvasFont::Reference& rFont,
109 const SurfaceProviderRef& rRefDevice ) :
110 TextLayout_Base( m_aMutex ),
111 maText( aText ),
112 maLogicalAdvancements(),
113 mpFont( rFont ),
114 mpRefDevice( rRefDevice ),
115 mnTextDirection( nDirection )
119 TextLayout::~TextLayout()
123 void SAL_CALL TextLayout::disposing()
125 ::osl::MutexGuard aGuard( m_aMutex );
127 mpFont.reset();
128 mpRefDevice.clear();
131 // XTextLayout
132 uno::Sequence< uno::Reference< rendering::XPolyPolygon2D > > SAL_CALL TextLayout::queryTextShapes( ) throw (uno::RuntimeException)
134 ::osl::MutexGuard aGuard( m_aMutex );
136 // TODO
137 return uno::Sequence< uno::Reference< rendering::XPolyPolygon2D > >();
140 uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryInkMeasures( ) throw (uno::RuntimeException)
142 ::osl::MutexGuard aGuard( m_aMutex );
144 // TODO
145 return uno::Sequence< geometry::RealRectangle2D >();
148 uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryMeasures( ) throw (uno::RuntimeException)
150 ::osl::MutexGuard aGuard( m_aMutex );
152 // TODO
153 return uno::Sequence< geometry::RealRectangle2D >();
156 uno::Sequence< double > SAL_CALL TextLayout::queryLogicalAdvancements( ) throw (uno::RuntimeException)
158 ::osl::MutexGuard aGuard( m_aMutex );
160 return maLogicalAdvancements;
163 void SAL_CALL TextLayout::applyLogicalAdvancements( const uno::Sequence< double >& aAdvancements ) throw (lang::IllegalArgumentException, uno::RuntimeException)
165 ::osl::MutexGuard aGuard( m_aMutex );
167 if( aAdvancements.getLength() != maText.Length )
169 OSL_TRACE( "TextLayout::applyLogicalAdvancements(): mismatching number of advancements" );
170 throw lang::IllegalArgumentException();
173 maLogicalAdvancements = aAdvancements;
176 geometry::RealRectangle2D SAL_CALL TextLayout::queryTextBounds( ) throw (uno::RuntimeException)
178 ::osl::MutexGuard aGuard( m_aMutex );
180 OutputDevice* pOutDev = mpRefDevice->getOutputDevice();
181 if( !pOutDev )
182 return geometry::RealRectangle2D();
184 VirtualDevice aVDev( *pOutDev );
185 aVDev.SetFont( mpFont->getVCLFont() );
187 // need metrics for Y offset, the XCanvas always renders
188 // relative to baseline
189 const ::FontMetric& aMetric( aVDev.GetFontMetric() );
191 setupLayoutMode( aVDev, mnTextDirection );
193 const sal_Int32 nAboveBaseline( -aMetric.GetIntLeading() - aMetric.GetAscent() );
194 const sal_Int32 nBelowBaseline( aMetric.GetDescent() );
196 if( maLogicalAdvancements.getLength() )
198 return geometry::RealRectangle2D( 0, nAboveBaseline,
199 maLogicalAdvancements[ maLogicalAdvancements.getLength()-1 ],
200 nBelowBaseline );
202 else
204 return geometry::RealRectangle2D( 0, nAboveBaseline,
205 aVDev.GetTextWidth(
206 maText.Text,
207 ::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition),
208 ::canvas::tools::numeric_cast<sal_uInt16>(maText.Length) ),
209 nBelowBaseline );
213 double SAL_CALL TextLayout::justify( double /*nSize*/ ) throw (lang::IllegalArgumentException, uno::RuntimeException)
215 ::osl::MutexGuard aGuard( m_aMutex );
217 // TODO
218 return 0.0;
221 double SAL_CALL TextLayout::combinedJustify( const uno::Sequence< uno::Reference< rendering::XTextLayout > >& /*aNextLayouts*/,
222 double /*nSize*/ ) throw (lang::IllegalArgumentException, uno::RuntimeException)
224 ::osl::MutexGuard aGuard( m_aMutex );
226 // TODO
227 return 0.0;
230 rendering::TextHit SAL_CALL TextLayout::getTextHit( const geometry::RealPoint2D& /*aHitPoint*/ ) throw (uno::RuntimeException)
232 ::osl::MutexGuard aGuard( m_aMutex );
234 // TODO
235 return rendering::TextHit();
238 rendering::Caret SAL_CALL TextLayout::getCaret( sal_Int32 /*nInsertionIndex*/,
239 sal_Bool /*bExcludeLigatures*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
241 ::osl::MutexGuard aGuard( m_aMutex );
243 // TODO
244 return rendering::Caret();
247 sal_Int32 SAL_CALL TextLayout::getNextInsertionIndex( sal_Int32 /*nStartIndex*/,
248 sal_Int32 /*nCaretAdvancement*/,
249 sal_Bool /*bExcludeLigatures*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
251 ::osl::MutexGuard aGuard( m_aMutex );
253 // TODO
254 return 0;
257 uno::Reference< rendering::XPolyPolygon2D > SAL_CALL TextLayout::queryVisualHighlighting( sal_Int32 /*nStartIndex*/,
258 sal_Int32 /*nEndIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
260 ::osl::MutexGuard aGuard( m_aMutex );
262 // TODO
263 return uno::Reference< rendering::XPolyPolygon2D >();
266 uno::Reference< rendering::XPolyPolygon2D > SAL_CALL TextLayout::queryLogicalHighlighting( sal_Int32 /*nStartIndex*/,
267 sal_Int32 /*nEndIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
269 ::osl::MutexGuard aGuard( m_aMutex );
271 // TODO
272 return uno::Reference< rendering::XPolyPolygon2D >();
275 double SAL_CALL TextLayout::getBaselineOffset( ) throw (uno::RuntimeException)
277 ::osl::MutexGuard aGuard( m_aMutex );
279 // TODO
280 return 0.0;
283 sal_Int8 SAL_CALL TextLayout::getMainTextDirection( ) throw (uno::RuntimeException)
285 ::osl::MutexGuard aGuard( m_aMutex );
287 return mnTextDirection;
290 uno::Reference< rendering::XCanvasFont > SAL_CALL TextLayout::getFont( ) throw (uno::RuntimeException)
292 ::osl::MutexGuard aGuard( m_aMutex );
294 return mpFont.getRef();
297 rendering::StringContext SAL_CALL TextLayout::getText( ) throw (uno::RuntimeException)
299 ::osl::MutexGuard aGuard( m_aMutex );
301 return maText;
305 * TextLayout::isCairoRenderable
307 * Features currenly not supported by Cairo (VCL rendering is used as fallback):
308 * - vertical glyphs
310 * @return true, if text/font can be rendered with cairo
312 bool TextLayout::isCairoRenderable(SystemFontData aSysFontData) const
314 #if defined UNX && !defined MACOSX && !defined IOS
315 // is font usable?
316 if (!aSysFontData.nFontId)
317 return false;
318 #endif
320 // vertical glyph rendering is not supported in cairo for now
321 if (aSysFontData.bVerticalCharacterType)
323 OSL_TRACE(":cairocanvas::TextLayout::isCairoRenderable(): ***************** VERTICAL CHARACTER STYLE!!! ****************");
324 return false;
327 return true;
331 * TextLayout::draw
333 * Cairo-based text rendering. Draw text directly on the cairo surface with cairo fonts.
334 * Avoid using VCL VirtualDevices for that, bypassing VCL DrawText functions, when possible
336 * Note: some text effects are not rendered due to lacking generic canvas or cairo canvas
337 * implementation. See issues 92657, 92658, 92659, 92660, 97529
339 * @return true, if successful
341 bool TextLayout::draw( SurfaceSharedPtr& pSurface,
342 OutputDevice& rOutDev,
343 const Point& rOutpos,
344 const rendering::ViewState& viewState,
345 const rendering::RenderState& renderState ) const
347 ::osl::MutexGuard aGuard( m_aMutex );
348 SystemTextLayoutData aSysLayoutData;
349 #if (defined CAIRO_HAS_WIN32_SURFACE) && (OSL_DEBUG_LEVEL > 1)
350 LOGFONTW logfont;
351 #endif
352 setupLayoutMode( rOutDev, mnTextDirection );
354 // TODO(P2): cache that
355 ::boost::scoped_array< sal_Int32 > aOffsets(new sal_Int32[maLogicalAdvancements.getLength()]);
357 if( maLogicalAdvancements.getLength() )
359 setupTextOffsets( aOffsets.get(), maLogicalAdvancements, viewState, renderState );
361 // TODO(F3): ensure correct length and termination for DX
362 // array (last entry _must_ contain the overall width)
365 aSysLayoutData = rOutDev.GetSysTextLayoutData(rOutpos, maText.Text,
366 ::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition),
367 ::canvas::tools::numeric_cast<sal_uInt16>(maText.Length),
368 maLogicalAdvancements.getLength() ? aOffsets.get() : NULL);
370 // Sort them so that all glyphs on the same glyph fallback level are consecutive
371 std::sort(aSysLayoutData.rGlyphData.begin(), aSysLayoutData.rGlyphData.end(), compareFallbacks);
372 bool bCairoRenderable = true;
374 //Pull all the fonts we need to render the text
375 typedef std::pair<SystemFontData,int> FontLevel;
376 typedef std::vector<FontLevel> FontLevelVector;
377 FontLevelVector aFontData;
378 SystemGlyphDataVector::const_iterator aGlyphIter=aSysLayoutData.rGlyphData.begin();
379 const SystemGlyphDataVector::const_iterator aGlyphEnd=aSysLayoutData.rGlyphData.end();
380 for( ; aGlyphIter != aGlyphEnd; ++aGlyphIter )
382 if( aFontData.empty() || aGlyphIter->fallbacklevel != aFontData.back().second )
384 aFontData.push_back(FontLevel(rOutDev.GetSysFontData(aGlyphIter->fallbacklevel),
385 aGlyphIter->fallbacklevel));
386 if( !isCairoRenderable(aFontData.back().first) )
388 bCairoRenderable = false;
389 OSL_TRACE(":cairocanvas::TextLayout::draw(S,O,p,v,r): VCL FALLBACK %s%s%s%s - %s",
390 maLogicalAdvancements.getLength() ? "ADV " : "",
391 aFontData.back().first.bAntialias ? "AA " : "",
392 aFontData.back().first.bFakeBold ? "FB " : "",
393 aFontData.back().first.bFakeItalic ? "FI " : "",
394 OUStringToOString( maText.Text.copy( maText.StartPosition, maText.Length ),
395 RTL_TEXTENCODING_UTF8 ).getStr());
396 break;
401 // The ::GetSysTextLayoutData(), i.e. layouting of text to glyphs can change the font being used.
402 // The fallback checks need to be done after final font is known.
403 if (!bCairoRenderable) // VCL FALLBACKS
405 if (maLogicalAdvancements.getLength()) // VCL FALLBACK - with glyph advances
407 rOutDev.DrawTextArray( rOutpos, maText.Text, aOffsets.get(),
408 ::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition),
409 ::canvas::tools::numeric_cast<sal_uInt16>(maText.Length) );
410 return true;
412 else // VCL FALLBACK - without advances
414 rOutDev.DrawText( rOutpos, maText.Text,
415 ::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition),
416 ::canvas::tools::numeric_cast<sal_uInt16>(maText.Length) );
417 return true;
421 if (aSysLayoutData.rGlyphData.empty())
422 return false; //??? false?
425 * Setup platform independent glyph vector into cairo-based glyphs vector.
428 // Loop through the fonts used and render the matching glyphs for each
429 FontLevelVector::const_iterator aFontDataIter = aFontData.begin();
430 const FontLevelVector::const_iterator aFontDataEnd = aFontData.end();
431 for( ; aFontDataIter != aFontDataEnd; ++aFontDataIter )
433 const SystemFontData &rSysFontData = aFontDataIter->first;
435 // setup glyphs
436 std::vector<cairo_glyph_t> cairo_glyphs;
437 cairo_glyphs.reserve( 256 );
439 aGlyphIter=aSysLayoutData.rGlyphData.begin();
440 for( ; aGlyphIter != aGlyphEnd; ++aGlyphIter )
442 SystemGlyphData systemGlyph = *aGlyphIter;
443 if( systemGlyph.fallbacklevel != aFontDataIter->second )
444 continue;
446 cairo_glyph_t aGlyph;
447 aGlyph.index = systemGlyph.index;
448 #ifdef CAIRO_HAS_WIN32_SURFACE
449 // Cairo requires standard glyph indexes (ETO_GLYPH_INDEX), while vcl/win/* uses ucs4 chars.
450 // Convert to standard indexes
451 aGlyph.index = cairo::ucs4toindex((unsigned int) aGlyph.index, rSysFontData.hFont);
452 #endif
453 aGlyph.x = systemGlyph.x;
454 aGlyph.y = systemGlyph.y;
455 cairo_glyphs.push_back(aGlyph);
458 if (cairo_glyphs.empty())
459 continue;
462 * Setup font
464 cairo_font_face_t* font_face = NULL;
466 #ifdef CAIRO_HAS_QUARTZ_SURFACE
467 # ifdef MACOSX
468 // TODO: use cairo_quartz_font_face_create_for_cgfont(cgFont)
469 // when CGFont (Mac OS X 10.5 API) is provided by the AQUA VCL backend.
470 font_face = cairo_quartz_font_face_create_for_atsu_font_id((ATSUFontID) rSysFontData.aATSUFontID);
471 # else // iOS
472 font_face = cairo_quartz_font_face_create_for_cgfont( CTFontCopyGraphicsFont( rSysFontData.rCTFont, NULL ) );
473 # endif
475 #elif defined CAIRO_HAS_WIN32_SURFACE
476 # if (OSL_DEBUG_LEVEL > 1)
477 GetObjectW( rSysFontData.hFont, sizeof(logfont), &logfont );
478 # endif
479 // Note: cairo library uses logfont fallbacks when lfEscapement, lfOrientation and lfWidth are not zero.
480 // VCL always has non-zero value for lfWidth
481 font_face = cairo_win32_font_face_create_for_hfont(rSysFontData.hFont);
483 #elif defined CAIRO_HAS_XLIB_SURFACE
484 font_face = cairo_ft_font_face_create_for_ft_face((FT_Face)rSysFontData.nFontId,
485 rSysFontData.nFontFlags);
486 #else
487 # error Native API needed.
488 #endif
490 CairoSharedPtr pSCairo = pSurface->getCairo();
492 cairo_set_font_face( pSCairo.get(), font_face);
494 // create default font options. cairo_get_font_options() does not retrieve the surface defaults,
495 // only what has been set before with cairo_set_font_options()
496 cairo_font_options_t* options = cairo_font_options_create();
497 if (rSysFontData.bAntialias)
499 // CAIRO_ANTIALIAS_GRAY provides more similar result to VCL Canvas,
500 // so we're not using CAIRO_ANTIALIAS_SUBPIXEL
501 cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_GRAY);
503 cairo_set_font_options( pSCairo.get(), options);
505 // Font color
506 Color mTextColor = rOutDev.GetTextColor();
507 cairo_set_source_rgb(pSCairo.get(),
508 mTextColor.GetRed()/255.0,
509 mTextColor.GetGreen()/255.0,
510 mTextColor.GetBlue()/255.0);
512 // Font rotation and scaling
513 cairo_matrix_t m;
514 Font aFont = rOutDev.GetFont();
516 cairo_matrix_init_identity(&m);
518 if (aSysLayoutData.orientation)
519 cairo_matrix_rotate(&m, (3600 - aSysLayoutData.orientation) * M_PI / 1800.0);
521 long nWidth = aFont.GetWidth();
522 long nHeight = aFont.GetHeight();
523 if (nWidth == 0)
524 nWidth = nHeight;
525 cairo_matrix_scale(&m, nWidth, nHeight);
527 //faux italics
528 if (rSysFontData.bFakeItalic)
529 m.xy = -m.xx * 0x6000L / 0x10000L;
531 cairo_set_font_matrix(pSCairo.get(), &m);
533 #if (defined CAIRO_HAS_WIN32_SURFACE) && (OSL_DEBUG_LEVEL > 1)
534 # define TEMP_TRACE_FONT OUStringToOString( reinterpret_cast<const sal_Unicode*> (logfont.lfFaceName), RTL_TEXTENCODING_UTF8 ).getStr()
535 #else
536 # define TEMP_TRACE_FONT OUStringToOString( aFont.GetName(), RTL_TEXTENCODING_UTF8 ).getStr()
537 #endif
538 OSL_TRACE("\r\n:cairocanvas::TextLayout::draw(S,O,p,v,r): Size:(%d,%d), Pos (%d,%d), G(%d,%d,%d) %s%s%s%s || Name:%s - %s",
539 aFont.GetWidth(),
540 aFont.GetHeight(),
541 (int) rOutpos.X(),
542 (int) rOutpos.Y(),
543 cairo_glyphs.size() > 0 ? cairo_glyphs[0].index : -1,
544 cairo_glyphs.size() > 1 ? cairo_glyphs[1].index : -1,
545 cairo_glyphs.size() > 2 ? cairo_glyphs[2].index : -1,
546 maLogicalAdvancements.getLength() ? "ADV " : "",
547 rSysFontData.bAntialias ? "AA " : "",
548 rSysFontData.bFakeBold ? "FB " : "",
549 rSysFontData.bFakeItalic ? "FI " : "",
550 TEMP_TRACE_FONT,
551 OUStringToOString( maText.Text.copy( maText.StartPosition, maText.Length ),
552 RTL_TEXTENCODING_UTF8 ).getStr()
554 #undef TEMP_TRACE_FONT
556 cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size());
558 //faux bold
559 if (rSysFontData.bFakeBold)
561 double bold_dx = 0.5 * sqrt( 0.7 * aFont.GetHeight() );
562 int total_steps = 1 * ((int) (bold_dx + 0.5));
564 // loop to draw the text for every half pixel of displacement
565 for (int nSteps = 0; nSteps < total_steps; nSteps++)
567 for(int nGlyphIdx = 0; nGlyphIdx < (int) cairo_glyphs.size(); nGlyphIdx++)
569 cairo_glyphs[nGlyphIdx].x += (bold_dx * nSteps / total_steps) / 4;
570 cairo_glyphs[nGlyphIdx].y -= (bold_dx * nSteps / total_steps) / 4;
572 cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size());
574 OSL_TRACE(":cairocanvas::TextLayout::draw(S,O,p,v,r): FAKEBOLD - dx:%d", (int) bold_dx);
577 cairo_restore( pSCairo.get() );
578 cairo_font_face_destroy(font_face);
579 cairo_font_options_destroy(options);
581 return true;
585 namespace
587 class OffsetTransformer
589 public:
590 OffsetTransformer( const ::basegfx::B2DHomMatrix& rMat ) :
591 maMatrix( rMat )
595 sal_Int32 operator()( const double& rOffset )
597 // This is an optimization of the normal rMat*[x,0]
598 // transformation of the advancement vector (in x
599 // direction), followed by a length calculation of the
600 // resulting vector: advancement' =
601 // ||rMat*[x,0]||. Since advancements are vectors, we
602 // can ignore translational components, thus if [x,0],
603 // it follows that rMat*[x,0]=[x',0] holds. Thus, we
604 // just have to calc the transformation of the x
605 // component.
607 // TODO(F2): Handle non-horizontal advancements!
608 return ::basegfx::fround( hypot(maMatrix.get(0,0)*rOffset,
609 maMatrix.get(1,0)*rOffset) );
612 private:
613 ::basegfx::B2DHomMatrix maMatrix;
617 void TextLayout::setupTextOffsets( sal_Int32* outputOffsets,
618 const uno::Sequence< double >& inputOffsets,
619 const rendering::ViewState& viewState,
620 const rendering::RenderState& renderState ) const
622 ENSURE_OR_THROW( outputOffsets!=NULL,
623 "TextLayout::setupTextOffsets offsets NULL" );
625 ::basegfx::B2DHomMatrix aMatrix;
627 ::canvas::tools::mergeViewAndRenderTransform(aMatrix,
628 viewState,
629 renderState);
631 // fill integer offsets
632 ::std::transform( const_cast< uno::Sequence< double >& >(inputOffsets).getConstArray(),
633 const_cast< uno::Sequence< double >& >(inputOffsets).getConstArray()+inputOffsets.getLength(),
634 outputOffsets,
635 OffsetTransformer( aMatrix ) );
638 #define SERVICE_NAME "com.sun.star.rendering.TextLayout"
639 #define IMPLEMENTATION_NAME "CairoCanvas::TextLayout"
641 OUString SAL_CALL TextLayout::getImplementationName() throw( uno::RuntimeException )
643 return OUString( IMPLEMENTATION_NAME );
646 sal_Bool SAL_CALL TextLayout::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
648 return ServiceName == SERVICE_NAME;
651 uno::Sequence< OUString > SAL_CALL TextLayout::getSupportedServiceNames() throw( uno::RuntimeException )
653 uno::Sequence< OUString > aRet(1);
654 aRet[0] = OUString( SERVICE_NAME );
656 return aRet;
660 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */