summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorMox Soini <mox@iki.fi>2015-06-02 23:52:56 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-06-11 08:35:09 +0000
commit0c87f8bf42ba0338dbf6516dc9539223a5dedf4c (patch)
treeb2257ea435d70bf8e5bc00f0529f6dabf6e563b5 /canvas
parent776a3f14f2d987312b926ebc1ad09321a3a87f0d (diff)
Cleanup crossplatform cairo
Mac / Win cairo is not built / used, this cairo code can be removed to reduce code bloat. 4th Revised version with Android fixes Change-Id: I6e56850f535ca13b77839b7d67e227c5f39d388e Reviewed-on: https://gerrit.libreoffice.org/16218 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/cairo/cairo_textlayout.cxx97
1 files changed, 4 insertions, 93 deletions
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index 35e98c741c4c..6f5326409999 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());