diff options
author | Mox Soini <mox@iki.fi> | 2015-06-02 23:52:56 +0300 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2015-06-04 21:31:58 +0000 |
commit | e4d55e8045c99af65a2cae57b26ec076825c9673 (patch) | |
tree | 3a56aa0c7998ff643e15c0edee5ad8fdaa0e1fed /canvas | |
parent | Removed getNormal() from polygontools, it just calls B3DPolygon::getNormal() (diff) | |
download | core-e4d55e8045c99af65a2cae57b26ec076825c9673.tar.gz core-e4d55e8045c99af65a2cae57b26ec076825c9673.zip |
Cleanup crossplatform cairo
Mac / Win cairo is not built / used, this cairo code can be removed to
reduce code bloat.
Change-Id: I758d674291e25e0722f5c66a0096295e903786b1
Reviewed-on: https://gerrit.libreoffice.org/16049
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/source/cairo/cairo_textlayout.cxx | 97 |
1 files changed, 4 insertions, 93 deletions
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx index 03d319473e7c..570daaf41a3a 100644 --- a/canvas/source/cairo/cairo_textlayout.cxx +++ b/canvas/source/cairo/cairo_textlayout.cxx @@ -26,15 +26,6 @@ #include <vcl/metric.hxx> #include <vcl/virdev.hxx> - -#ifdef WNT -#ifdef max -#undef max -#endif -#ifdef min -#undef min -#endif -#endif #include <vcl/sysdata.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> @@ -45,21 +36,12 @@ #include "cairo_textlayout.hxx" #include "cairo_spritecanvas.hxx" -#ifdef CAIRO_HAS_QUARTZ_SURFACE -#include <cairo-quartz.h> -#elif defined CAIRO_HAS_WIN32_SURFACE -# include "cairo_win32_cairo.hxx" -# include <cairo-win32.h> -#elif defined CAIRO_HAS_FT_FONT +#if defined CAIRO_HAS_FT_FONT # include <cairo-ft.h> #else # error Native API needed. #endif -#ifdef IOS -#include <CoreText/CoreText.h> -#endif - using namespace ::cairo; using namespace ::com::sun::star; @@ -309,7 +291,7 @@ namespace cairocanvas **/ bool TextLayout::isCairoRenderable(SystemFontData aSysFontData) const { -#if defined UNX && !defined MACOSX && !defined IOS +#if defined CAIRO_HAS_FT_FONT // is font usable? if (!aSysFontData.nFontId) return false; @@ -325,46 +307,6 @@ namespace cairocanvas return true; } -#ifdef CAIRO_HAS_WIN32_SURFACE - namespace - { - /** - * cairo::ucs4toindex: Convert ucs4 char to glyph index - * @param ucs4 an ucs4 char - * @param hfont current font - * - * @return true if successful - **/ - unsigned long ucs4toindex(unsigned int ucs4, HFONT hfont) - { - wchar_t unicode[2]; - WORD glyph_index; - HDC hdc = NULL; - - hdc = CreateCompatibleDC (NULL); - - if (!hdc) return 0; - if (!SetGraphicsMode (hdc, GM_ADVANCED)) - { - DeleteDC (hdc); - return 0; - } - - SelectObject (hdc, hfont); - SetMapMode (hdc, MM_TEXT); - - unicode[0] = ucs4; - unicode[1] = 0; - if (GetGlyphIndicesW (hdc, unicode, 1, &glyph_index, 0) == GDI_ERROR) - { - glyph_index = 0; - } - - DeleteDC (hdc); - return glyph_index; - } - } -#endif /** * TextLayout::draw @@ -385,9 +327,6 @@ namespace cairocanvas { ::osl::MutexGuard aGuard( m_aMutex ); SystemTextLayoutData aSysLayoutData; -#if (defined CAIRO_HAS_WIN32_SURFACE) && (OSL_DEBUG_LEVEL > 1) - LOGFONTW logfont; -#endif setupLayoutMode( rOutDev, mnTextDirection ); // TODO(P2): cache that @@ -484,11 +423,6 @@ namespace cairocanvas cairo_glyph_t aGlyph; aGlyph.index = systemGlyph.index; -#ifdef CAIRO_HAS_WIN32_SURFACE - // Cairo requires standard glyph indexes (ETO_GLYPH_INDEX), while vcl/win/* uses ucs4 chars. - // Convert to standard indexes - aGlyph.index = ucs4toindex((unsigned int) aGlyph.index, rSysFontData.hFont); -#endif aGlyph.x = systemGlyph.x; aGlyph.y = systemGlyph.y; cairo_glyphs.push_back(aGlyph); @@ -502,24 +436,7 @@ namespace cairocanvas **/ cairo_font_face_t* font_face = NULL; -#ifdef CAIRO_HAS_QUARTZ_SURFACE -# ifdef MACOSX - // TODO: use cairo_quartz_font_face_create_for_cgfont(cgFont) - // when CGFont (Mac OS X 10.5 API) is provided by the AQUA VCL backend. - font_face = cairo_quartz_font_face_create_for_atsu_font_id((ATSUFontID) rSysFontData.aATSUFontID); -# else // iOS - font_face = cairo_quartz_font_face_create_for_cgfont( CTFontCopyGraphicsFont( rSysFontData.rCTFont, NULL ) ); -# endif - -#elif defined CAIRO_HAS_WIN32_SURFACE -# if (OSL_DEBUG_LEVEL > 1) - GetObjectW( rSysFontData.hFont, sizeof(logfont), &logfont ); -# endif - // Note: cairo library uses logfont fallbacks when lfEscapement, lfOrientation and lfWidth are not zero. - // VCL always has non-zero value for lfWidth - font_face = cairo_win32_font_face_create_for_hfont(rSysFontData.hFont); - -#elif defined CAIRO_HAS_FT_FONT +#if defined CAIRO_HAS_FT_FONT font_face = cairo_ft_font_face_create_for_ft_face(static_cast<FT_Face>(rSysFontData.nFontId), rSysFontData.nFontFlags); #else @@ -567,11 +484,6 @@ namespace cairocanvas cairo_set_font_matrix(pSCairo.get(), &m); -#if (defined CAIRO_HAS_WIN32_SURFACE) && (OSL_DEBUG_LEVEL > 1) -# define TEMP_TRACE_FONT OUString(reinterpret_cast<const sal_Unicode*> (logfont.lfFaceName)) -#else -# define TEMP_TRACE_FONT aFont.GetName() -#endif SAL_INFO( "canvas.cairo", "Size:(" << aFont.GetWidth() << "," << aFont.GetHeight() @@ -586,9 +498,8 @@ namespace cairocanvas << (rSysFontData.bAntialias ? "AA " : "") << (rSysFontData.bFakeBold ? "FB " : "") << (rSysFontData.bFakeItalic ? "FI " : "") << " || Name:" - << TEMP_TRACE_FONT << " - " + << aFont.GetName() << " - " << maText.Text.copy(maText.StartPosition, maText.Length)); -#undef TEMP_TRACE_FONT cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size()); |