diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-01-11 18:31:28 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-01-12 00:05:22 +0000 |
commit | 27154c4bb5ed80d699d706ebd1a84e807c3f1625 (patch) | |
tree | ee4b8ba505521003608434fd8e4add32965ba914 | |
parent | cbd483211e1ac9d9e724b5ba3e3e38a0c5abe55c (diff) |
vcl: split off ImplFontCharMap into it's own header file
Change-Id: I6173cd191cd771b1f030fa737617b1067278ee10
Reviewed-on: https://gerrit.libreoffice.org/21338
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
-rw-r--r-- | include/vcl/fontcharmap.hxx | 23 | ||||
-rw-r--r-- | vcl/inc/impfont.hxx | 57 | ||||
-rw-r--r-- | vcl/inc/impfontcharmap.hxx | 82 | ||||
-rw-r--r-- | vcl/quartz/salgdi.cxx | 1 | ||||
-rw-r--r-- | vcl/source/gdi/impfont.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/fontmanager.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 1 | ||||
-rw-r--r-- | vcl/win/gdi/salfont.cxx | 1 |
8 files changed, 107 insertions, 62 deletions
diff --git a/include/vcl/fontcharmap.hxx b/include/vcl/fontcharmap.hxx index c4d495c368fd..b0dca542c2ee 100644 --- a/include/vcl/fontcharmap.hxx +++ b/include/vcl/fontcharmap.hxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FONTCHARMAP_METRIC_HXX -#define INCLUDED_FONTCHARMAP_METRIC_HXX +#ifndef INCLUDED_FONTCHARMAP_HXX +#define INCLUDED_FONTCHARMAP_HXX #include <vcl/dllapi.h> #include <vcl/font.hxx> @@ -164,6 +164,23 @@ inline void intrusive_ptr_release(FontCharMap* pFontCharMap) delete pFontCharMap; } -#endif // INCLUDED_FONTCHARMAP_METRIC_HXX + +// CmapResult is a normalized version of the many CMAP formats +class VCL_PLUGIN_PUBLIC CmapResult +{ +public: + explicit CmapResult( bool bSymbolic = false, + const sal_uInt32* pRangeCodes = nullptr, int nRangeCount = 0, + const int* pStartGlyphs = nullptr, const sal_uInt16* pGlyphIds = nullptr ); + + const sal_uInt32* mpRangeCodes; + const int* mpStartGlyphs; + const sal_uInt16* mpGlyphIds; + int mnRangeCount; + bool mbSymbolic; + bool mbRecoded; +}; + +#endif // INCLUDED_FONTCHARMAP_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index 904c9ebc8da4..77b90a4cf988 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -161,64 +161,7 @@ private: FcPattern* mpPattern; }; -// - ImplFontCharMap - -class CmapResult; - -class VCL_PLUGIN_PUBLIC ImplFontCharMap -{ -public: - explicit ImplFontCharMap( const CmapResult& ); - virtual ~ImplFontCharMap(); - -private: - friend class FontCharMap; - friend void intrusive_ptr_add_ref(ImplFontCharMap* pImplFontCharMap); - friend void intrusive_ptr_release(ImplFontCharMap* pImplFontCharMap); - - ImplFontCharMap( const ImplFontCharMap& ) = delete; - void operator=( const ImplFontCharMap& ) = delete; - - static ImplFontCharMapPtr getDefaultMap( bool bSymbols=false); - bool isDefaultMap() const; - -private: - const sal_uInt32* mpRangeCodes; // pairs of StartCode/(EndCode+1) - const int* mpStartGlyphs; // range-specific mapper to glyphs - const sal_uInt16* mpGlyphIds; // individual glyphid mappings - int mnRangeCount; - int mnCharCount; // covered codepoints - mutable sal_uInt32 mnRefCount; -}; - -inline void intrusive_ptr_add_ref(ImplFontCharMap* pImplFontCharMap) -{ - ++pImplFontCharMap->mnRefCount; -} - -inline void intrusive_ptr_release(ImplFontCharMap* pImplFontCharMap) -{ - if (--pImplFontCharMap->mnRefCount == 0) - delete pImplFontCharMap; -} - -// CmapResult is a normalized version of the many CMAP formats -class VCL_PLUGIN_PUBLIC CmapResult -{ -public: - explicit CmapResult( bool bSymbolic = false, - const sal_uInt32* pRangeCodes = nullptr, int nRangeCount = 0, - const int* pStartGlyphs = nullptr, const sal_uInt16* pGlyphIds = nullptr ); - - const sal_uInt32* mpRangeCodes; - const int* mpStartGlyphs; - const sal_uInt16* mpGlyphIds; - int mnRangeCount; - bool mbSymbolic; - bool mbRecoded; -}; - -bool ParseCMAP( const unsigned char* pRawData, int nRawLength, CmapResult& ); #endif // INCLUDED_VCL_INC_IMPFONT_HXX diff --git a/vcl/inc/impfontcharmap.hxx b/vcl/inc/impfontcharmap.hxx new file mode 100644 index 000000000000..ef5c9612b6c4 --- /dev/null +++ b/vcl/inc/impfontcharmap.hxx @@ -0,0 +1,82 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_IMPFONTCHARMAP_HXX +#define INCLUDED_VCL_INC_IMPFONTCHARMAP_HXX + +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include <i18nlangtag/languagetag.hxx> +#include <tools/color.hxx> +#include <vcl/dllapi.h> +#include <vcl/vclenum.hxx> +#include <vcl/fntstyle.hxx> +#include <fontinstance.hxx> +#include <vcl/fontcharmap.hxx> + +#include <boost/intrusive_ptr.hpp> + +class ImplFontCharMap; +typedef boost::intrusive_ptr< ImplFontCharMap > ImplFontCharMapPtr; + + +class CmapResult; + +class VCL_PLUGIN_PUBLIC ImplFontCharMap +{ +public: + explicit ImplFontCharMap( const CmapResult& ); + virtual ~ImplFontCharMap(); + +private: + friend class FontCharMap; + friend void intrusive_ptr_add_ref(ImplFontCharMap* pImplFontCharMap); + friend void intrusive_ptr_release(ImplFontCharMap* pImplFontCharMap); + + ImplFontCharMap( const ImplFontCharMap& ) = delete; + void operator=( const ImplFontCharMap& ) = delete; + + static ImplFontCharMapPtr getDefaultMap( bool bSymbols=false); + bool isDefaultMap() const; + +private: + const sal_uInt32* mpRangeCodes; // pairs of StartCode/(EndCode+1) + const int* mpStartGlyphs; // range-specific mapper to glyphs + const sal_uInt16* mpGlyphIds; // individual glyphid mappings + int mnRangeCount; + int mnCharCount; // covered codepoints + mutable sal_uInt32 mnRefCount; +}; + +inline void intrusive_ptr_add_ref(ImplFontCharMap* pImplFontCharMap) +{ + ++pImplFontCharMap->mnRefCount; +} + +inline void intrusive_ptr_release(ImplFontCharMap* pImplFontCharMap) +{ + if (--pImplFontCharMap->mnRefCount == 0) + delete pImplFontCharMap; +} + +bool ParseCMAP( const unsigned char* pRawData, int nRawLength, CmapResult& ); + +#endif // INCLUDED_VCL_INC_IMPFONTCHARMAP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 9a917ec25d7a..ad10cc8a3469 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -40,6 +40,7 @@ #include "ctfonts.hxx" #include "fontsubset.hxx" #include "impfont.hxx" +#include "impfontcharmap.hxx" #ifdef MACOSX #include "osx/salframe.h" #endif diff --git a/vcl/source/gdi/impfont.cxx b/vcl/source/gdi/impfont.cxx index 4061a4004079..6c458b515884 100644 --- a/vcl/source/gdi/impfont.cxx +++ b/vcl/source/gdi/impfont.cxx @@ -17,7 +17,7 @@ */ #include <vcl/fontcharmap.hxx> #include <fontinstance.hxx> -#include <impfont.hxx> +#include <impfontcharmap.hxx> #include <vector> #include <set> diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx index a926e97b10b2..e9a51fffab0f 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -27,7 +27,7 @@ #include "fontcache.hxx" #include "fontsubset.hxx" -#include "impfont.hxx" +#include "impfontcharmap.hxx" #include "svdata.hxx" #include "unx/geninst.h" #include "fontmanager.hxx" diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 5417590f2b63..2f539a961ede 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -68,6 +68,7 @@ #include <sys/stat.h> #include <sys/mman.h> #include "fontmanager.hxx" +#include "impfontcharmap.hxx" static FT_Library aLibFT = nullptr; diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index 9decea8dc69e..4781b14609d9 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -49,6 +49,7 @@ #include "sft.hxx" #include "win/saldata.hxx" #include "win/salgdi.h" +#include "impfontcharmap.hxx" using namespace vcl; |