diff options
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/gdi/cairotextrender.cxx | 27 | ||||
-rw-r--r-- | vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 70 | ||||
-rw-r--r-- | vcl/unx/generic/glyphs/graphite_serverfont.cxx | 134 | ||||
-rw-r--r-- | vcl/unx/generic/print/genpspgraphics.cxx | 30 |
4 files changed, 3 insertions, 258 deletions
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index eb941e2b384c..289a066cf878 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -34,12 +34,6 @@ #include "impfont.hxx" #include "impfontmetricdata.hxx" -#include <config_graphite.h> -#if ENABLE_GRAPHITE -#include <graphite_layout.hxx> -#include <graphite_serverfont.hxx> -#endif - #include <cairo.h> #include <cairo-ft.h> #include "CommonSalLayout.hxx" @@ -95,12 +89,6 @@ CairoTextRender::CairoTextRender() { for(FreetypeFont* & rp : mpFreetypeFont) rp = nullptr; - -#if ENABLE_GRAPHITE - // check if graphite fonts have been disabled - static const char* pDisableGraphiteStr = getenv( "SAL_DISABLE_GRAPHITE" ); - bDisableGraphite_ = pDisableGraphiteStr && (pDisableGraphiteStr[0]!='0'); -#endif } bool CairoTextRender::setFont( const FontSelectPattern *pEntry, int nFallbackLevel ) @@ -519,22 +507,9 @@ SalLayout* CairoTextRender::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackL && !(rArgs.mnFlags & SalLayoutFlags::DisableGlyphProcessing) ) { if (SalLayout::UseCommonLayout()) - { pLayout = new CommonSalLayout(*mpFreetypeFont[nFallbackLevel]); - } else - { -#if ENABLE_GRAPHITE - // Is this a Graphite font? - if (!bDisableGraphite_ && - GraphiteServerFontLayout::IsGraphiteEnabledFont(*mpFreetypeFont[nFallbackLevel])) - { - pLayout = new GraphiteServerFontLayout(*mpFreetypeFont[nFallbackLevel]); - } - else -#endif - pLayout = new ServerFontLayout( *mpFreetypeFont[ nFallbackLevel ] ); - } + pLayout = new ServerFontLayout( *mpFreetypeFont[ nFallbackLevel ] ); } return pLayout; diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 6df2bba7269a..409972619201 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -28,12 +28,6 @@ #include "fontattributes.hxx" #include <config_features.h> -#include <config_graphite.h> -#if ENABLE_GRAPHITE -# include <graphite_static.hxx> -# include <graphite2/Font.h> -# include <graphite_layout.hxx> -#endif #include <unotools/fontdefs.hxx> #include "tools/poly.hxx" @@ -170,33 +164,6 @@ void FreetypeFontFile::Unmap() mpFileMap = nullptr; } -#if ENABLE_GRAPHITE -// wrap FreetypeFontInfo's table function -const void * graphiteFontTable(const void* appFaceHandle, unsigned int name, size_t *len) -{ - const FreetypeFontInfo * pFontInfo = static_cast<const FreetypeFontInfo*>(appFaceHandle); - typedef union { - char m_c[5]; - unsigned int m_id; - } TableId; - TableId tableId; - tableId.m_id = name; -#ifndef OSL_BIGENDIAN - TableId swapped; - swapped.m_c[3] = tableId.m_c[0]; - swapped.m_c[2] = tableId.m_c[1]; - swapped.m_c[1] = tableId.m_c[2]; - swapped.m_c[0] = tableId.m_c[3]; - tableId.m_id = swapped.m_id; -#endif - tableId.m_c[4] = '\0'; - sal_uLong nLength = 0; - const void * pTable = static_cast<const void*>(pFontInfo->GetTable(tableId.m_c, &nLength)); - if (len) *len = static_cast<size_t>(nLength); - return pTable; -} -#endif - FreetypeFontInfo::FreetypeFontInfo( const FontAttributes& rDevFontAttributes, const OString& rNativeFileName, int nFaceNum, sal_IntPtr nFontId) : @@ -204,10 +171,6 @@ FreetypeFontInfo::FreetypeFontInfo( const FontAttributes& rDevFontAttributes, mpFontFile( FreetypeFontFile::FindFontFile( rNativeFileName ) ), mnFaceNum( nFaceNum ), mnRefCount( 0 ), -#if ENABLE_GRAPHITE - mbCheckedGraphite(false), - mpGraphiteFace(nullptr), -#endif mnFontId( nFontId ), maDevFontAttributes( rDevFontAttributes ), mxFontCharMap( nullptr ), @@ -226,9 +189,6 @@ FreetypeFontInfo::~FreetypeFontInfo() mxFontCharMap.Clear(); delete mpChar2Glyph; delete mpGlyph2Char; -#if ENABLE_GRAPHITE - delete mpGraphiteFace; -#endif } void FreetypeFontInfo::InitHashes() const @@ -253,29 +213,6 @@ FT_FaceRec_* FreetypeFontInfo::GetFaceFT() return maFaceFT; } -#if ENABLE_GRAPHITE -GraphiteFaceWrapper * FreetypeFontInfo::GetGraphiteFace() -{ - if (mbCheckedGraphite) - return mpGraphiteFace; - // test for graphite here so that it is cached most efficiently - if (GetTable("Silf")) - { - static const char* pGraphiteCacheStr = getenv( "SAL_GRAPHITE_CACHE_SIZE" ); - int graphiteSegCacheSize = pGraphiteCacheStr ? (atoi(pGraphiteCacheStr)) : 0; - gr_face * pGraphiteFace; - if (graphiteSegCacheSize > 500) - pGraphiteFace = gr_make_face_with_seg_cache(this, graphiteFontTable, graphiteSegCacheSize, gr_face_cacheCmap); - else - pGraphiteFace = gr_make_face(this, graphiteFontTable, gr_face_cacheCmap); - if (pGraphiteFace) - mpGraphiteFace = new GraphiteFaceWrapper(pGraphiteFace); - } - mbCheckedGraphite = true; - return mpGraphiteFace; -} -#endif - void FreetypeFontInfo::ReleaseFaceFT() { if (--mnRefCount <= 0) @@ -1507,11 +1444,4 @@ const unsigned char* FreetypeFont::GetTable(const char* pName, sal_uLong* pLengt return mpFontInfo->GetTable( pName, pLength ); } -#if ENABLE_GRAPHITE -GraphiteFaceWrapper* FreetypeFont::GetGraphiteFace() const -{ - return mpFontInfo->GetGraphiteFace(); -} -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/glyphs/graphite_serverfont.cxx b/vcl/unx/generic/glyphs/graphite_serverfont.cxx deleted file mode 100644 index af57ded6d861..000000000000 --- a/vcl/unx/generic/glyphs/graphite_serverfont.cxx +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -// Header files - -// Platform -#include <i18nlangtag/languagetag.hxx> -#include <sallayout.hxx> -// Module -#include "unx/freetype_glyphcache.hxx" -#include "unx/glyphcache.hxx" -#include <graphite_features.hxx> -#include <graphite_serverfont.hxx> - -float freetypeServerFontAdvance(const void* appFontHandle, gr_uint16 glyphId) -{ - FreetypeFont * pFreetypeFont = - const_cast<FreetypeFont*> - (static_cast<const FreetypeFont*>(appFontHandle)); - if (pFreetypeFont) - { - return static_cast<float>(pFreetypeFont->GetGlyphMetric(glyphId).GetCharWidth()); - } - return .0f; -} - -// An implementation of the GraphiteLayout interface to enable Graphite enabled fonts to be used. - -GraphiteServerFontLayout::GraphiteServerFontLayout(FreetypeFont& rFreetypeFont) throw() - : ServerFontLayout(rFreetypeFont), - maImpl(rFreetypeFont.GetGraphiteFace()->face(), rFreetypeFont) - , mpFeatures(nullptr) -{ - gr_font * pFont = rFreetypeFont.GetGraphiteFace()->font(rFreetypeFont.GetFontSelData().mnHeight, rFreetypeFont.NeedsArtificialBold(), rFreetypeFont.NeedsArtificialItalic()); - if (!pFont) - { - pFont = gr_make_font_with_advance_fn( - // need to use mnHeight here, mfExactHeight can give wrong values - static_cast<float>(rFreetypeFont.GetFontSelData().mnHeight), - &rFreetypeFont, - freetypeServerFontAdvance, - rFreetypeFont.GetGraphiteFace()->face()); - rFreetypeFont.GetGraphiteFace()->addFont(rFreetypeFont.GetFontSelData().mnHeight, pFont, rFreetypeFont.NeedsArtificialBold(), rFreetypeFont.NeedsArtificialItalic()); - } - maImpl.SetFont(pFont); - OString aLang(""); - if (rFreetypeFont.GetFontSelData().meLanguage != LANGUAGE_DONTKNOW) - { - aLang = OUStringToOString( LanguageTag( rFreetypeFont.GetFontSelData().meLanguage ).getBcp47(), - RTL_TEXTENCODING_UTF8 ); - } - OString name = OUStringToOString( - rFreetypeFont.GetFontSelData().maTargetName, RTL_TEXTENCODING_UTF8 ); -#ifdef DEBUG - printf("GraphiteServerFontLayout %lx %s size %d %f\n", (long unsigned int)this, name.getStr(), - rFreetypeFont.GetFtFace()->size->metrics.x_ppem, - rFreetypeFont.GetFontSelData().mfExactHeight); -#endif - sal_Int32 nFeat = name.indexOf(FontSelectPatternAttributes::FEAT_PREFIX) + 1; - if (nFeat > 0) - { - OString aFeat = name.copy(nFeat, name.getLength() - nFeat); - mpFeatures = new grutils::GrFeatureParser( - rFreetypeFont.GetGraphiteFace()->face(), aFeat, aLang); -#ifdef DEBUG - if (mpFeatures) - printf("GraphiteServerFontLayout %s/%s/%s %x language\n", - OUStringToOString( rFreetypeFont.GetFontSelData().GetFamilyName(), - RTL_TEXTENCODING_UTF8 ).getStr(), - OUStringToOString( rFreetypeFont.GetFontSelData().maTargetName, - RTL_TEXTENCODING_UTF8 ).getStr(), - OUStringToOString( rFreetypeFont.GetFontSelData().maSearchName, - RTL_TEXTENCODING_UTF8 ).getStr(), - rFreetypeFont.GetFontSelData().meLanguage); -#endif - } - else - { - mpFeatures = new grutils::GrFeatureParser( - rFreetypeFont.GetGraphiteFace()->face(), aLang); - } - maImpl.SetFeatures(mpFeatures); -} - -GraphiteServerFontLayout::~GraphiteServerFontLayout() throw() -{ - delete mpFeatures; - mpFeatures = nullptr; -} - -bool GraphiteServerFontLayout::IsGraphiteEnabledFont(FreetypeFont& rFreetypeFont) -{ - if (rFreetypeFont.GetGraphiteFace()) - { -#ifdef DEBUG - printf("IsGraphiteEnabledFont\n"); -#endif - return true; - } - return false; -} - -sal_GlyphId GraphiteLayoutImpl::getKashidaGlyph(int & width) -{ - int nKashidaIndex = mrFreetypeFont.GetGlyphIndex( 0x0640 ); - if( nKashidaIndex != 0 ) - { - const GlyphMetric& rGM = mrFreetypeFont.GetGlyphMetric( nKashidaIndex ); - width = rGM.GetCharWidth(); - } - else - { - width = 0; - } - return nKashidaIndex; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx index 6bd871b89049..ee605546dc5f 100644 --- a/vcl/unx/generic/print/genpspgraphics.cxx +++ b/vcl/unx/generic/print/genpspgraphics.cxx @@ -56,12 +56,6 @@ #include "salprn.hxx" #include "CommonSalLayout.hxx" -#include <config_graphite.h> -#if ENABLE_GRAPHITE -#include <graphite_layout.hxx> -#include <graphite_serverfont.hxx> -#endif - using namespace psp; // ----- Implementation of PrinterBmp by means of SalBitmap/BitmapBuffer --------------- @@ -741,20 +735,12 @@ static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx if (bIsPspServerFontLayout) { const PspServerFontLayout * pPspLayout = dynamic_cast<const PspServerFontLayout*>(&rLayout); -#if ENABLE_GRAPHITE - const GraphiteServerFontLayout * pGrLayout = dynamic_cast<const GraphiteServerFontLayout*>(&rLayout); -#endif if (pPspLayout) { pText = pPspLayout->getTextPtr(); nMinCharPos = pPspLayout->getMinCharPos(); nMaxCharPos = pPspLayout->getMaxCharPos(); } -#if ENABLE_GRAPHITE - else if (pGrLayout) - { - } -#endif } for( int nStart = 0;; ) { @@ -1027,21 +1013,9 @@ SalLayout* GenPspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe && !(rArgs.mnFlags & SalLayoutFlags::DisableGlyphProcessing) ) { if (SalLayout::UseCommonLayout()) - { - pLayout = new PspCommonSalLayout(*m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel]); - } + pLayout = new PspCommonSalLayout(*m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel]); else - { -#if ENABLE_GRAPHITE - // Is this a Graphite font? - if (GraphiteServerFontLayout::IsGraphiteEnabledFont(*m_pFreetypeFont[nFallbackLevel])) - { - pLayout = new GraphiteServerFontLayout(*m_pFreetypeFont[nFallbackLevel]); - } - else -#endif - pLayout = new PspServerFontLayout( *m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel], rArgs ); - } + pLayout = new PspServerFontLayout( *m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel], rArgs ); } else pLayout = new PspFontLayout( *m_pPrinterGfx ); |