summaryrefslogtreecommitdiffstats
path: root/include/vcl/metric.hxx
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2014-10-06 18:16:16 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2014-10-13 09:19:04 +0000
commitf6d61562d41b8a49449d881da66a3d8fa519487f (patch)
tree15571322cf3bf8475fe2e1c5d1d0ae9fd38f7c1d /include/vcl/metric.hxx
parentMake the image continuously resize back and forth in both cases (diff)
downloadcore-f6d61562d41b8a49449d881da66a3d8fa519487f.tar.gz
core-f6d61562d41b8a49449d881da66a3d8fa519487f.zip
vcl: Make ImplFontCharMap a pImpl and move functions to FontCharMap
To do this, I've made FontCharMap a friend class for ImplFontCharMap, and have moved the functions directly into FontCharMap. In this patch, I am attempting to stop the direct use of ImplFontCharMap by anything other than FontCharMap. However, FontCharMap itself requires a refcounter, so we will use FontCharMapPtr to access the font character map. Change-Id: I509b990a8cbd911c5cc1572c7d24fc5348ca06d9 Reviewed-on: https://gerrit.libreoffice.org/11823 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'include/vcl/metric.hxx')
-rw-r--r--include/vcl/metric.hxx39
1 files changed, 33 insertions, 6 deletions
diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx
index ca53b653b0cc..e9872a97d7af 100644
--- a/include/vcl/metric.hxx
+++ b/include/vcl/metric.hxx
@@ -28,9 +28,11 @@
class ImplFontMetric;
class ImplFontCharMap;
+class CmapResult;
typedef sal_uInt32 sal_UCS4;
typedef boost::intrusive_ptr< ImplFontCharMap > ImplFontCharMapPtr;
+typedef boost::intrusive_ptr< FontCharMap > FontCharMapPtr;
namespace vcl {
@@ -96,16 +98,20 @@ inline std::basic_ostream<charT, traits> & operator <<(
class VCL_DLLPUBLIC FontCharMap
{
-private:
- ImplFontCharMapPtr mpImplFontCharMap;
-
public:
/** A new FontCharMap is created based on a "default" map, which includes
all codepoints in the Unicode BMP range, including surrogates.
**/
FontCharMap();
+ FontCharMap( const CmapResult& rCR );
~FontCharMap();
+ /** Get the default font character map
+
+ @returns the default font character map.
+ */
+ static FontCharMapPtr GetDefaultMap( bool bSymbols=false );
+
/** Determines if the font character map is the "default". The default map
includes all codepoints in the Unicode BMP range, including surrogates.
@@ -119,8 +125,8 @@ public:
*/
bool HasChar( sal_UCS4 ) const;
-
- /** UCS4 codepoints.
+ /** Returns the number of chars supported by the font, which
+ are inside the unicode range from cMin to cMax (inclusive).
@param cMin Lowest codepoint in range to be counted
@param cMax Highest codepoitn in range to be counted
@@ -190,16 +196,37 @@ public:
*/
sal_UCS4 GetCharFromIndex( int nCharIndex ) const;
+ int GetGlyphIndex( sal_UCS4 ) const;
private:
+ ImplFontCharMapPtr mpImplFontCharMap;
+
friend class ::OutputDevice;
- void Reset( const ImplFontCharMapPtr pNewMap = NULL );
+ friend void intrusive_ptr_release(FontCharMap* pFontCharMap);
+ friend void intrusive_ptr_add_ref(FontCharMap* pFontCharMap);
+
+ int findRangeIndex( sal_uInt32 ) const;
+
+ FontCharMap( ImplFontCharMapPtr pIFCMap );
+
+ sal_uInt32 mnRefCount;
// prevent assignment and copy construction
FontCharMap( const FontCharMap& );
void operator=( const FontCharMap& );
};
+inline void intrusive_ptr_add_ref(FontCharMap* pFontCharMap)
+{
+ ++pFontCharMap->mnRefCount;
+}
+
+inline void intrusive_ptr_release(FontCharMap* pFontCharMap)
+{
+ if (--pFontCharMap->mnRefCount == 0)
+ delete pFontCharMap;
+}
+
class VCL_DLLPUBLIC TextRectInfo
{
friend class ::OutputDevice;