diff options
author | Herbert Dürr <hdu@apache.org> | 2013-12-16 16:07:41 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-01-06 14:32:30 +0000 |
commit | a16aacd6474f02307341646ec08f9e1608a8615d (patch) | |
tree | 23d5a086d982d77329f2de6196c97c3139d9bdbf /vcl/inc | |
parent | 8723bf714b6156396f30ac71c0268e5a51c76337 (diff) |
Resolves: #i123840# add and use the sal_GlyphId type
Using the central definition adds consistency and cleans up many ad hoc
declarations. The type sal_GlyphId will become a class in the future so
that its bitfield operations etc. can then be isolated into nice methods.
(cherry picked from commit c0a84ad10964fb7a65b6239cbe1cef8698b5d17b)
Conflicts:
vcl/aqua/source/gdi/salatslayout.cxx
vcl/aqua/source/gdi/salgdi.cxx
vcl/generic/glyphs/gcach_ftyp.cxx
vcl/generic/print/genpspgraphics.cxx
vcl/generic/print/glyphset.cxx
vcl/generic/print/glyphset.hxx
vcl/headless/svptext.cxx
vcl/inc/generic/genpspgraphics.h
vcl/inc/generic/glyphcache.hxx
vcl/inc/os2/salgdi.h
vcl/inc/quartz/salgdi.h
vcl/inc/salgdi.hxx
vcl/inc/sallayout.hxx
vcl/inc/unx/salgdi.h
vcl/inc/vcl/fontmanager.hxx
vcl/inc/win/salgdi.h
vcl/os2/source/gdi/os2layout.cxx
vcl/os2/source/gdi/salgdi3.cxx
vcl/source/gdi/pdfwriter_impl.cxx
vcl/source/gdi/sallayout.cxx
vcl/source/glyphs/gcach_ftyp.hxx
vcl/source/glyphs/gcach_layout.cxx
vcl/source/glyphs/glyphcache.cxx
vcl/source/glyphs/graphite_layout.cxx
vcl/unx/generic/fontmanager/fontmanager.cxx
vcl/unx/generic/gdi/gcach_xpeer.cxx
vcl/unx/generic/gdi/gcach_xpeer.hxx
vcl/unx/generic/gdi/salgdi3.cxx
vcl/unx/generic/gdi/xrender_peer.hxx
vcl/unx/headless/svpgdi.hxx
vcl/unx/headless/svppspgraphics.cxx
vcl/unx/headless/svppspgraphics.hxx
vcl/win/source/gdi/salgdi3.cxx
vcl/win/source/gdi/winlayout.cxx
Change-Id: Ic629131950360e2df4c15db30d6a5362193c6330
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/fontmanager.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/fontsubset.hxx | 5 | ||||
-rw-r--r-- | vcl/inc/generic/genpspgraphics.h | 6 | ||||
-rw-r--r-- | vcl/inc/generic/glyphcache.hxx | 20 | ||||
-rw-r--r-- | vcl/inc/headless/svpgdi.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/quartz/salgdi.h | 8 | ||||
-rw-r--r-- | vcl/inc/salgdi.hxx | 7 | ||||
-rw-r--r-- | vcl/inc/salglyphid.hxx | 45 | ||||
-rw-r--r-- | vcl/inc/sallayout.hxx | 33 | ||||
-rw-r--r-- | vcl/inc/unx/salgdi.h | 6 | ||||
-rw-r--r-- | vcl/inc/win/salgdi.h | 6 |
11 files changed, 86 insertions, 59 deletions
diff --git a/vcl/inc/fontmanager.hxx b/vcl/inc/fontmanager.hxx index a727b84a58c5..a028a20fd6cb 100644 --- a/vcl/inc/fontmanager.hxx +++ b/vcl/inc/fontmanager.hxx @@ -30,6 +30,7 @@ #include <vcl/timer.hxx> #include <vcl/vclenum.hxx> #include <com/sun/star/lang/Locale.hpp> +#include "salglyphid.hxx" #include <vector> @@ -475,7 +476,7 @@ public: bool createFontSubset( FontSubsetInfo&, fontID nFont, const OUString& rOutFile, - sal_Int32* pGlyphIDs, + sal_GlyphId* pGlyphIDs, sal_uInt8* pNewEncoding, sal_Int32* pWidths, int nGlyphs, diff --git a/vcl/inc/fontsubset.hxx b/vcl/inc/fontsubset.hxx index a827a95ea7d1..cc5b1472cc0a 100644 --- a/vcl/inc/fontsubset.hxx +++ b/vcl/inc/fontsubset.hxx @@ -24,6 +24,7 @@ #include <tools/gen.hxx> #include <cstdio> +#include "salglyphid.hxx" #include "vcl/dllapi.h" namespace vcl { struct _TrueTypeFont; } ///< SFT's idea of a TTF font @@ -54,7 +55,7 @@ public: bool CreateFontSubset( int nOutFontTypeMask, FILE* pOutFile, const char* pOutFontName, - const long* pReqGlyphIds, const sal_uInt8* pEncodedIds, + const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncodedIds, int nReqGlyphCount, sal_Int32* pOutGlyphWidths = NULL ); public: // TODO: make subsetter results private and provide accessor methods instead @@ -77,7 +78,7 @@ private: int mnReqFontTypeMask; ///< allowed subset-target font types FILE* mpOutFile; const char* mpReqFontName; - const long* mpReqGlyphIds; + const sal_GlyphId* mpReqGlyphIds; const sal_uInt8* mpReqEncodedIds; int mnReqGlyphCount; diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h index 28ee5c3c48a4..044cb123fb21 100644 --- a/vcl/inc/generic/genpspgraphics.h +++ b/vcl/inc/generic/genpspgraphics.h @@ -99,7 +99,7 @@ public: virtual sal_Bool CreateFontSubset( const OUString& rToFile, const PhysicalFontFace*, - sal_Int32* pGlyphIDs, + sal_GlyphId* pGlyphIDs, sal_uInt8* pEncoding, sal_Int32* pWidths, int nGlyphs, @@ -116,8 +116,8 @@ public: bool bVertical, Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); - virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); - virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ); + virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ); + virtual bool GetGlyphOutline( sal_GlyphId, ::basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); virtual bool supportsOperation( OutDevSupportType ) const; diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx index 452cf4bf0f4e..99274d171f6b 100644 --- a/vcl/inc/generic/glyphcache.hxx +++ b/vcl/inc/generic/glyphcache.hxx @@ -203,20 +203,20 @@ public: const ImplFontCharMap* GetImplFontCharMap() const; bool GetFontCapabilities(vcl::FontCapabilities &) const; - GlyphData& GetGlyphData( int nGlyphIndex ); - const GlyphMetric& GetGlyphMetric( int nGlyphIndex ) - { return GetGlyphData( nGlyphIndex ).GetMetric(); } + GlyphData& GetGlyphData( sal_GlyphId ); + const GlyphMetric& GetGlyphMetric( sal_GlyphId aGlyphId ) + { return GetGlyphData( aGlyphId ).GetMetric(); } #if ENABLE_GRAPHITE virtual GraphiteFaceWrapper* GetGraphiteFace() const; #endif - int GetGlyphIndex( sal_UCS4 ) const; - int GetRawGlyphIndex( sal_UCS4, sal_UCS4 = 0 ) const; - int FixupGlyphIndex( int nGlyphIndex, sal_UCS4 ) const; - bool GetGlyphOutline( int nGlyphIndex, ::basegfx::B2DPolyPolygon& ) const; + sal_GlyphId GetGlyphIndex( sal_UCS4 ) const; + sal_GlyphId GetRawGlyphIndex( sal_UCS4, sal_UCS4 = 0 ) const; + sal_GlyphId FixupGlyphIndex( sal_GlyphId aGlyphId, sal_UCS4 ) const; + bool GetGlyphOutline( sal_GlyphId aGlyphId, ::basegfx::B2DPolyPolygon& ) const; bool GetAntialiasAdvice( void ) const; - bool GetGlyphBitmap1( int nGlyphIndex, RawBitmap& ) const; - bool GetGlyphBitmap8( int nGlyphIndex, RawBitmap& ) const; + bool GetGlyphBitmap1( sal_GlyphId aGlyphId, RawBitmap& ) const; + bool GetGlyphBitmap8( sal_GlyphId aGlyphId, RawBitmap& ) const; private: friend class GlyphCache; @@ -229,7 +229,7 @@ private: long Release() const; sal_uLong GetByteCount() const { return mnBytesUsed; } - void InitGlyphData( int nGlyphIndex, GlyphData& ) const; + void InitGlyphData( sal_GlyphId, GlyphData& ) const; void GarbageCollect( long ); void ReleaseFromGarbageCollect(); diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 9d006bf27c8c..da60ef5b67af 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -157,7 +157,7 @@ public: virtual bool AddTempDevFont( ImplDevFontList*, const OUString& rFileURL, const OUString& rFontName ); virtual sal_Bool CreateFontSubset( const OUString& rToFile, const PhysicalFontFace*, - sal_Int32* pGlyphIDs, + sal_GlyphId* pGlyphIds, sal_uInt8* pEncoding, sal_Int32* pWidths, int nGlyphs, @@ -174,8 +174,8 @@ public: bool bVertical, Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); - virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); - virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ); + virtual bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); + virtual bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); virtual bool supportsOperation( OutDevSupportType ) const; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 15e58e16afa6..5fcb79729065 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -341,9 +341,9 @@ public: // rInfo: additional outgoing information // implementation note: encoding 0 with glyph id 0 should be added implicitly // as "undefined character" - virtual sal_Bool CreateFontSubset( const OUString& rToFile, + virtual sal_Bool CreateFontSubset( const OUString& rToFile, const PhysicalFontFace* pFont, - sal_Int32* pGlyphIDs, + sal_GlyphId* pGlyphIds, sal_uInt8* pEncoding, sal_Int32* pWidths, int nGlyphs, @@ -379,8 +379,8 @@ public: Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); - virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); - virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& ); + virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ); + virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index e12c5ac5f8e9..ec6f5bc26112 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -26,6 +26,7 @@ #include "osl/thread.hxx" #include "vcl/outdev.hxx" #include "vcl/salnativewidgets.hxx" +#include "salglyphid.hxx" #include "sallayout.hxx" #include <map> @@ -261,7 +262,7 @@ public: // as "undefined character" virtual sal_Bool CreateFontSubset( const OUString& rToFile, const PhysicalFontFace* pFont, - sal_Int32* pGlyphIDs, + sal_GlyphId* pGlyphIDs, sal_uInt8* pEncoding, sal_Int32* pWidths, int nGlyphs, @@ -303,8 +304,8 @@ public: Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ) = 0; - virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ) = 0; - virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& ) = 0; + virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) = 0; + virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) = 0; virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0; virtual void DrawServerFontLayout( const ServerFontLayout& ) = 0; diff --git a/vcl/inc/salglyphid.hxx b/vcl/inc/salglyphid.hxx new file mode 100644 index 000000000000..d7d7d7c3f46f --- /dev/null +++ b/vcl/inc/salglyphid.hxx @@ -0,0 +1,45 @@ +/* + * 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 _SV_SALGLYPHID_HXX +#define _SV_SALGLYPHID_HXX + +// TODO: sal_GlyphId should become a class... +typedef sal_uInt32 sal_GlyphId; + +// Glyph Flags +#define GF_NONE 0x00000000 +#define GF_FLAGMASK 0xFF800000 +#define GF_IDXMASK ~GF_FLAGMASK +#define GF_ISCHAR 0x00800000 +#define GF_ROTL 0x01000000 +// caution !!! +#define GF_VERT 0x02000000 +// GF_VERT is only for windows implementation +// (win/source/gdi/salgdi3.cxx, win/source/gdi/winlayout.cxx) +// don't use this elsewhere !!! +#define GF_ROTR 0x03000000 +#define GF_ROTMASK 0x03000000 +#define GF_UNHINTED 0x04000000 +#define GF_GSUB 0x08000000 +#define GF_FONTMASK 0xF0000000 +#define GF_FONTSHIFT 28 + +#define GF_DROPPED 0xFFFFFFFF + +#endif // _SV_SALGLYPHID_HXX + diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index c4a1d4cdf081..047308632e97 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -36,6 +36,7 @@ typedef unsigned short LanguageType; // for typedef sal_UCS4 #include <vcl/vclenum.hxx> +#include "salglyphid.hxx" class SalGraphics; class PhysicalFontFace; @@ -134,28 +135,6 @@ bool IsDiacritic( sal_UCS4 ); int GetVerticalFlags( sal_UCS4 ); sal_UCS4 GetVerticalChar( sal_UCS4 ); -typedef sal_uInt32 sal_GlyphId; - -// Glyph Flags -#define GF_NONE 0x00000000 -#define GF_FLAGMASK 0xFF800000 -#define GF_IDXMASK ~GF_FLAGMASK -#define GF_ISCHAR 0x00800000 -#define GF_ROTL 0x01000000 -// caution !!! -#define GF_VERT 0x02000000 -// GF_VERT is only for windows implementation -// (win/source/gdi/salgdi3.cxx, win/source/gdi/winlayout.cxx) -// don't use this elsewhere !!! -#define GF_ROTR 0x03000000 -#define GF_ROTMASK 0x03000000 -#define GF_UNHINTED 0x04000000 -#define GF_GSUB 0x08000000 -#define GF_FONTMASK 0xF0000000 -#define GF_FONTSHIFT 28 - -#define GF_DROPPED 0xFFFFFFFF - // all positions/widths are in font units // one exception: drawposition is in pixel units @@ -310,26 +289,26 @@ struct GlyphItem int mnOrigWidth; // original glyph width int mnNewWidth; // width after adjustments int mnXOffset; - sal_GlyphId mnGlyphIndex; + sal_GlyphId maGlyphId; Point maLinearPos; // absolute position of non rotated string public: GlyphItem() {} - GlyphItem( int nCharPos, sal_GlyphId nGlyphIndex, const Point& rLinearPos, + GlyphItem( int nCharPos, sal_GlyphId aGlyphId, const Point& rLinearPos, long nFlags, int nOrigWidth ) : mnFlags(nFlags), mnCharPos(nCharPos), mnOrigWidth(nOrigWidth), mnNewWidth(nOrigWidth), mnXOffset(0), - mnGlyphIndex(nGlyphIndex), maLinearPos(rLinearPos) + maGlyphId(aGlyphId), maLinearPos(rLinearPos) {} - GlyphItem( int nCharPos, sal_GlyphId nGlyphIndex, const Point& rLinearPos, + GlyphItem( int nCharPos, sal_GlyphId aGlyphId, const Point& rLinearPos, long nFlags, int nOrigWidth, int nXOffset ) : mnFlags(nFlags), mnCharPos(nCharPos), mnOrigWidth(nOrigWidth), mnNewWidth(nOrigWidth), mnXOffset(nXOffset), - mnGlyphIndex(nGlyphIndex), maLinearPos(rLinearPos) + maGlyphId(aGlyphId), maLinearPos(rLinearPos) {} diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index ddadb55d96ef..962c32e60e3f 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -235,7 +235,7 @@ public: virtual bool AddTempDevFont( ImplDevFontList*, const OUString& rFileURL, const OUString& rFontName ); virtual sal_Bool CreateFontSubset( const OUString& rToFile, const PhysicalFontFace*, - sal_Int32* pGlyphIDs, + sal_GlyphId* pGlyphIDs, sal_uInt8* pEncoding, sal_Int32* pWidths, int nGlyphs, @@ -252,8 +252,8 @@ public: bool bVertical, Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); - virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); - virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ); + virtual bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); + virtual bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); virtual bool supportsOperation( OutDevSupportType ) const; diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index bd9483a9e4db..58de36ad0f87 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -330,7 +330,7 @@ public: // as "undefined character" virtual sal_Bool CreateFontSubset( const OUString& rToFile, const PhysicalFontFace*, - long* pGlyphIDs, + sal_GlyphId* pGlyphIDs, sal_uInt8* pEncoding, sal_Int32* pWidths, int nGlyphs, @@ -366,8 +366,8 @@ public: Ucs2UIntMap& rUnicodeEnc ); virtual int GetMinKashidaWidth(); - virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); - virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ); + virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ); + virtual bool GetGlyphOutline( sal_GlyphId, ::basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); |