12123d757SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 32123d757SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 42123d757SAndrew Rist * or more contributor license agreements. See the NOTICE file 52123d757SAndrew Rist * distributed with this work for additional information 62123d757SAndrew Rist * regarding copyright ownership. The ASF licenses this file 72123d757SAndrew Rist * to you under the Apache License, Version 2.0 (the 82123d757SAndrew Rist * "License"); you may not use this file except in compliance 92123d757SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 112123d757SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 132123d757SAndrew Rist * Unless required by applicable law or agreed to in writing, 142123d757SAndrew Rist * software distributed under the License is distributed on an 152123d757SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 162123d757SAndrew Rist * KIND, either express or implied. See the License for the 172123d757SAndrew Rist * specific language governing permissions and limitations 182123d757SAndrew Rist * under the License. 19cdf0e10cSrcweir * 202123d757SAndrew Rist *************************************************************/ 212123d757SAndrew Rist 222123d757SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SV_SALGDI_H 25cdf0e10cSrcweir #define _SV_SALGDI_H 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <sallayout.hxx> 28cdf0e10cSrcweir #include <salgdi.hxx> 29cdf0e10cSrcweir #include <outfont.hxx> 30cdf0e10cSrcweir #include <impfont.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include "boost/scoped_ptr.hpp" 33cdf0e10cSrcweir #include <hash_set> 34cdf0e10cSrcweir 35cdf0e10cSrcweir class ImplFontSelectData; 36cdf0e10cSrcweir class ImplWinFontEntry; 37cdf0e10cSrcweir class ImplFontAttrCache; 38cdf0e10cSrcweir 39cdf0e10cSrcweir // ----------- 40cdf0e10cSrcweir // - Defines - 41cdf0e10cSrcweir // ----------- 42cdf0e10cSrcweir 43cdf0e10cSrcweir #define RGB_TO_PALRGB(nRGB) ((nRGB)|0x02000000) 44cdf0e10cSrcweir #define PALRGB_TO_RGB(nPalRGB) ((nPalRGB)&0x00ffffff) 45cdf0e10cSrcweir 46cdf0e10cSrcweir // win32 platform specific options. Move them to the PMK file? 47cdf0e10cSrcweir 48cdf0e10cSrcweir #define GCP_KERN_HACK 49cdf0e10cSrcweir #define GNG_VERT_HACK 50cdf0e10cSrcweir 51cdf0e10cSrcweir // win32 specific physically available font face 52cdf0e10cSrcweir class ImplWinFontData : public ImplFontData 53cdf0e10cSrcweir { 54cdf0e10cSrcweir public: 55cdf0e10cSrcweir explicit ImplWinFontData( const ImplDevFontAttributes&, 56cdf0e10cSrcweir int nFontHeight, BYTE eWinCharSet, 57cdf0e10cSrcweir BYTE nPitchAndFamily ); 58cdf0e10cSrcweir virtual ~ImplWinFontData(); 59cdf0e10cSrcweir 60cdf0e10cSrcweir virtual ImplFontData* Clone() const; 61cdf0e10cSrcweir virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const; 62cdf0e10cSrcweir virtual sal_IntPtr GetFontId() const; 63cdf0e10cSrcweir void SetFontId( sal_IntPtr nId ) { mnId = nId; } 64cdf0e10cSrcweir void UpdateFromHDC( HDC ) const; 65cdf0e10cSrcweir 66cdf0e10cSrcweir bool HasChar( sal_uInt32 cChar ) const; 67cdf0e10cSrcweir 68cdf0e10cSrcweir BYTE GetCharSet() const { return meWinCharSet; } 69cdf0e10cSrcweir BYTE GetPitchAndFamily() const { return mnPitchAndFamily; } 70cdf0e10cSrcweir bool IsGlyphApiDisabled() const { return mbDisableGlyphApi; } 71cdf0e10cSrcweir bool SupportsKorean() const { return mbHasKoreanRange; } 72cdf0e10cSrcweir bool SupportsCJK() const { return mbHasCJKSupport; } 73cdf0e10cSrcweir bool SupportsArabic() const { return mbHasArabicSupport; } 74cdf0e10cSrcweir bool AliasSymbolsHigh() const { return mbAliasSymbolsHigh; } 75cdf0e10cSrcweir bool AliasSymbolsLow() const { return mbAliasSymbolsLow; } 76cdf0e10cSrcweir #ifdef ENABLE_GRAPHITE 77cdf0e10cSrcweir bool SupportsGraphite() const { return mbHasGraphiteSupport; } 78cdf0e10cSrcweir #endif 79cdf0e10cSrcweir 80cdf0e10cSrcweir const ImplFontCharMap* GetImplFontCharMap() const; 81cdf0e10cSrcweir const Ucs2SIntMap* GetEncodingVector() const { return mpEncodingVector; } 82cdf0e10cSrcweir void SetEncodingVector( const Ucs2SIntMap* pNewVec ) const 83cdf0e10cSrcweir { 84cdf0e10cSrcweir if( mpEncodingVector ) 85cdf0e10cSrcweir delete mpEncodingVector; 86cdf0e10cSrcweir mpEncodingVector = pNewVec; 87cdf0e10cSrcweir } 88cdf0e10cSrcweir private: 89cdf0e10cSrcweir sal_IntPtr mnId; 90cdf0e10cSrcweir 91cdf0e10cSrcweir // some members that are initalized lazily when the font gets selected into a HDC 92cdf0e10cSrcweir mutable bool mbDisableGlyphApi; 93cdf0e10cSrcweir mutable bool mbHasKoreanRange; 94cdf0e10cSrcweir mutable bool mbHasCJKSupport; 95cdf0e10cSrcweir #ifdef ENABLE_GRAPHITE 96cdf0e10cSrcweir mutable bool mbHasGraphiteSupport; 97cdf0e10cSrcweir #endif 98cdf0e10cSrcweir mutable bool mbHasArabicSupport; 99cdf0e10cSrcweir mutable ImplFontCharMap* mpUnicodeMap; 100cdf0e10cSrcweir mutable const Ucs2SIntMap* mpEncodingVector; 101cdf0e10cSrcweir 102cdf0e10cSrcweir // TODO: get rid of the members below needed to work with the Win9x non-unicode API 103cdf0e10cSrcweir BYTE* mpFontCharSets; // all Charsets for the current font (used on W98 for kerning) 104cdf0e10cSrcweir BYTE mnFontCharSetCount; // Number of Charsets of the current font; 0 - if not queried 105cdf0e10cSrcweir BYTE meWinCharSet; 106cdf0e10cSrcweir BYTE mnPitchAndFamily; 107cdf0e10cSrcweir bool mbAliasSymbolsHigh; 108cdf0e10cSrcweir bool mbAliasSymbolsLow; 109cdf0e10cSrcweir private: 110cdf0e10cSrcweir void ReadCmapTable( HDC ) const; 111cdf0e10cSrcweir void ReadOs2Table( HDC ) const; 112cdf0e10cSrcweir 113cdf0e10cSrcweir #ifdef GNG_VERT_HACK 114cdf0e10cSrcweir void ReadGsubTable( HDC ) const; 115cdf0e10cSrcweir 116cdf0e10cSrcweir typedef std::hash_set<sal_UCS4> UcsHashSet; 117cdf0e10cSrcweir mutable UcsHashSet maGsubTable; 118cdf0e10cSrcweir mutable bool mbGsubRead; 119cdf0e10cSrcweir public: 120cdf0e10cSrcweir bool HasGSUBstitutions( HDC ) const; 121cdf0e10cSrcweir bool IsGSUBstituted( sal_UCS4 ) const; 122cdf0e10cSrcweir #endif // GNG_VERT_HACK 123cdf0e10cSrcweir }; 124cdf0e10cSrcweir 125cdf0e10cSrcweir // ------------------ 126cdf0e10cSrcweir // - WinSalGraphics - 127cdf0e10cSrcweir // ------------------ 128cdf0e10cSrcweir 129cdf0e10cSrcweir class WinSalGraphics : public SalGraphics 130cdf0e10cSrcweir { 131cdf0e10cSrcweir public: 132cdf0e10cSrcweir HDC mhDC; // HDC 133cdf0e10cSrcweir HWND mhWnd; // Window-Handle, when Window-Graphics 134cdf0e10cSrcweir HFONT mhFonts[ MAX_FALLBACK ]; // Font + Fallbacks 135cdf0e10cSrcweir const ImplWinFontData* mpWinFontData[ MAX_FALLBACK ]; // pointer to the most recent font face 136cdf0e10cSrcweir ImplWinFontEntry* mpWinFontEntry[ MAX_FALLBACK ]; // pointer to the most recent font instance 137cdf0e10cSrcweir float mfFontScale; // allows metrics emulation of huge font sizes 138cdf0e10cSrcweir HPEN mhPen; // Pen 139cdf0e10cSrcweir HBRUSH mhBrush; // Brush 140cdf0e10cSrcweir HRGN mhRegion; // Region Handle 141cdf0e10cSrcweir HPEN mhDefPen; // DefaultPen 142cdf0e10cSrcweir HBRUSH mhDefBrush; // DefaultBrush 143cdf0e10cSrcweir HFONT mhDefFont; // DefaultFont 144cdf0e10cSrcweir HPALETTE mhDefPal; // DefaultPalette 145cdf0e10cSrcweir COLORREF mnPenColor; // PenColor 146cdf0e10cSrcweir COLORREF mnBrushColor; // BrushColor 147cdf0e10cSrcweir COLORREF mnTextColor; // TextColor 148cdf0e10cSrcweir RGNDATA* mpClipRgnData; // ClipRegion-Data 149cdf0e10cSrcweir RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data 150cdf0e10cSrcweir LOGFONTA* mpLogFont; // LOG-Font which is currently selected (only W9x) 151cdf0e10cSrcweir ImplFontAttrCache* mpFontAttrCache; // Cache font attributes from files in so/share/fonts 152cdf0e10cSrcweir BYTE* mpFontCharSets; // All Charsets for the current font 153cdf0e10cSrcweir BYTE mnFontCharSetCount; // Number of Charsets of the current font; 0 - if not queried 154cdf0e10cSrcweir sal_Bool mbFontKernInit; // FALSE: FontKerns must be queried 155cdf0e10cSrcweir KERNINGPAIR* mpFontKernPairs; // Kerning Pairs of the current Font 156cdf0e10cSrcweir sal_uIntPtr mnFontKernPairCount;// Number of Kerning Pairs of the current Font 157cdf0e10cSrcweir int mnPenWidth; // Linienbreite 158cdf0e10cSrcweir sal_Bool mbStockPen; // is Pen a stockpen 159cdf0e10cSrcweir sal_Bool mbStockBrush; // is Brush a stcokbrush 160cdf0e10cSrcweir sal_Bool mbPen; // is Pen (FALSE == NULL_PEN) 161cdf0e10cSrcweir sal_Bool mbBrush; // is Brush (FALSE == NULL_BRUSH) 162cdf0e10cSrcweir sal_Bool mbPrinter; // is Printer 163cdf0e10cSrcweir sal_Bool mbVirDev; // is VirDev 164cdf0e10cSrcweir sal_Bool mbWindow; // is Window 165cdf0e10cSrcweir sal_Bool mbScreen; // is Screen compatible 166cdf0e10cSrcweir bool mbXORMode; // _every_ output with RasterOp XOR 167cdf0e10cSrcweir 168cdf0e10cSrcweir // remember RGB values for SetLineColor/SetFillColor 169cdf0e10cSrcweir SalColor maLineColor; 170cdf0e10cSrcweir SalColor maFillColor; 171cdf0e10cSrcweir 172cdf0e10cSrcweir HFONT ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFontScale, HFONT& o_rOldFont ); 173cdf0e10cSrcweir 174cdf0e10cSrcweir public: 175cdf0e10cSrcweir explicit WinSalGraphics(); 176cdf0e10cSrcweir virtual ~WinSalGraphics(); 177cdf0e10cSrcweir 178cdf0e10cSrcweir protected: 179cdf0e10cSrcweir virtual bool setClipRegion( const Region& ); 180cdf0e10cSrcweir // draw --> LineColor and FillColor and RasterOp and ClipRegion 181cdf0e10cSrcweir virtual void drawPixel( long nX, long nY ); 182cdf0e10cSrcweir virtual void drawPixel( long nX, long nY, SalColor nSalColor ); 183cdf0e10cSrcweir virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ); 184cdf0e10cSrcweir virtual void drawRect( long nX, long nY, long nWidth, long nHeight ); 185cdf0e10cSrcweir virtual void drawPolyLine( sal_uIntPtr nPoints, const SalPoint* pPtAry ); 186cdf0e10cSrcweir virtual void drawPolygon( sal_uIntPtr nPoints, const SalPoint* pPtAry ); 187cdf0e10cSrcweir virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); 188cdf0e10cSrcweir virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); 189*5aaf853bSArmin Le Grand virtual bool drawPolyLine( 190*5aaf853bSArmin Le Grand const ::basegfx::B2DPolygon&, 191*5aaf853bSArmin Le Grand double fTransparency, 192*5aaf853bSArmin Le Grand const ::basegfx::B2DVector& rLineWidth, 193*5aaf853bSArmin Le Grand basegfx::B2DLineJoin, 194*5aaf853bSArmin Le Grand com::sun::star::drawing::LineCap); 195cdf0e10cSrcweir virtual sal_Bool drawPolyLineBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); 196cdf0e10cSrcweir virtual sal_Bool drawPolygonBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); 197cdf0e10cSrcweir virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); 198cdf0e10cSrcweir 199cdf0e10cSrcweir // CopyArea --> No RasterOp, but ClipRegion 200cdf0e10cSrcweir virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, 201cdf0e10cSrcweir long nSrcHeight, sal_uInt16 nFlags ); 202cdf0e10cSrcweir 203cdf0e10cSrcweir // CopyBits and DrawBitmap --> RasterOp and ClipRegion 204cdf0e10cSrcweir // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics 205cdf0e10cSrcweir virtual void copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ); 206cdf0e10cSrcweir virtual void drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap ); 207cdf0e10cSrcweir virtual void drawBitmap( const SalTwoRect* pPosAry, 208cdf0e10cSrcweir const SalBitmap& rSalBitmap, 209cdf0e10cSrcweir SalColor nTransparentColor ); 210cdf0e10cSrcweir virtual void drawBitmap( const SalTwoRect* pPosAry, 211cdf0e10cSrcweir const SalBitmap& rSalBitmap, 212cdf0e10cSrcweir const SalBitmap& rTransparentBitmap ); 213cdf0e10cSrcweir virtual void drawMask( const SalTwoRect* pPosAry, 214cdf0e10cSrcweir const SalBitmap& rSalBitmap, 215cdf0e10cSrcweir SalColor nMaskColor ); 216cdf0e10cSrcweir 217cdf0e10cSrcweir virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ); 218cdf0e10cSrcweir virtual SalColor getPixel( long nX, long nY ); 219cdf0e10cSrcweir 220cdf0e10cSrcweir // invert --> ClipRegion (only Windows or VirDevs) 221cdf0e10cSrcweir virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags); 222cdf0e10cSrcweir virtual void invert( sal_uIntPtr nPoints, const SalPoint* pPtAry, SalInvert nFlags ); 223cdf0e10cSrcweir 224cdf0e10cSrcweir virtual sal_Bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uIntPtr nSize ); 225cdf0e10cSrcweir 226cdf0e10cSrcweir // native widget rendering methods that require mirroring 227cdf0e10cSrcweir virtual sal_Bool hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, 228cdf0e10cSrcweir const Point& aPos, sal_Bool& rIsInside ); 229cdf0e10cSrcweir virtual sal_Bool drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, 230cdf0e10cSrcweir ControlState nState, const ImplControlValue& aValue, 231cdf0e10cSrcweir const rtl::OUString& aCaption ); 232cdf0e10cSrcweir virtual sal_Bool drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, 233cdf0e10cSrcweir ControlState nState, const ImplControlValue& aValue, 234cdf0e10cSrcweir const rtl::OUString& aCaption ); 235cdf0e10cSrcweir virtual sal_Bool getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, 236cdf0e10cSrcweir const ImplControlValue& aValue, const rtl::OUString& aCaption, 237cdf0e10cSrcweir Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ); 238cdf0e10cSrcweir 239cdf0e10cSrcweir virtual bool drawAlphaBitmap( const SalTwoRect&, 240cdf0e10cSrcweir const SalBitmap& rSourceBitmap, 241cdf0e10cSrcweir const SalBitmap& rAlphaBitmap ); 242cdf0e10cSrcweir virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency ); 243cdf0e10cSrcweir 244cdf0e10cSrcweir public: 245cdf0e10cSrcweir // public SalGraphics methods, the interface to teh independent vcl part 246cdf0e10cSrcweir 247cdf0e10cSrcweir // get device resolution 248cdf0e10cSrcweir virtual void GetResolution( long& rDPIX, long& rDPIY ); 249cdf0e10cSrcweir // get the depth of the device 250cdf0e10cSrcweir virtual sal_uInt16 GetBitCount(); 251cdf0e10cSrcweir // get the width of the device 252cdf0e10cSrcweir virtual long GetGraphicsWidth() const; 253cdf0e10cSrcweir 254cdf0e10cSrcweir // set the clip region to empty 255cdf0e10cSrcweir virtual void ResetClipRegion(); 256cdf0e10cSrcweir 257cdf0e10cSrcweir // set the line color to transparent (= don't draw lines) 258cdf0e10cSrcweir virtual void SetLineColor(); 259cdf0e10cSrcweir // set the line color to a specific color 260cdf0e10cSrcweir virtual void SetLineColor( SalColor nSalColor ); 261cdf0e10cSrcweir // set the fill color to transparent (= don't fill) 262cdf0e10cSrcweir virtual void SetFillColor(); 263cdf0e10cSrcweir // set the fill color to a specific color, shapes will be 264cdf0e10cSrcweir // filled accordingly 265cdf0e10cSrcweir virtual void SetFillColor( SalColor nSalColor ); 266cdf0e10cSrcweir // enable/disable XOR drawing 267cdf0e10cSrcweir virtual void SetXORMode( bool bSet, bool ); 268cdf0e10cSrcweir // set line color for raster operations 269cdf0e10cSrcweir virtual void SetROPLineColor( SalROPColor nROPColor ); 270cdf0e10cSrcweir // set fill color for raster operations 271cdf0e10cSrcweir virtual void SetROPFillColor( SalROPColor nROPColor ); 272cdf0e10cSrcweir // set the text color to a specific color 273cdf0e10cSrcweir virtual void SetTextColor( SalColor nSalColor ); 274cdf0e10cSrcweir // set the font 275cdf0e10cSrcweir virtual sal_uInt16 SetFont( ImplFontSelectData*, int nFallbackLevel ); 276cdf0e10cSrcweir // get the current font's etrics 277cdf0e10cSrcweir virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); 278cdf0e10cSrcweir // get kernign pairs of the current font 279cdf0e10cSrcweir // return only PairCount if (pKernPairs == NULL) 280cdf0e10cSrcweir virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs ); 281cdf0e10cSrcweir // get the repertoire of the current font 282cdf0e10cSrcweir virtual const ImplFontCharMap* GetImplFontCharMap() const; 283cdf0e10cSrcweir // graphics must fill supplied font list 284cdf0e10cSrcweir virtual void GetDevFontList( ImplDevFontList* ); 285cdf0e10cSrcweir // graphics should call ImplAddDevFontSubstitute on supplied 286cdf0e10cSrcweir // OutputDevice for all its device specific preferred font substitutions 287cdf0e10cSrcweir virtual void GetDevFontSubstList( OutputDevice* ); 288cdf0e10cSrcweir virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); 289cdf0e10cSrcweir // CreateFontSubset: a method to get a subset of glyhps of a font 290cdf0e10cSrcweir // inside a new valid font file 291cdf0e10cSrcweir // returns TRUE if creation of subset was successfull 292cdf0e10cSrcweir // parameters: rToFile: contains a osl file URL to write the subset to 293cdf0e10cSrcweir // pFont: describes from which font to create a subset 294cdf0e10cSrcweir // pGlyphIDs: the glyph ids to be extracted 295cdf0e10cSrcweir // pEncoding: the character code corresponding to each glyph 296cdf0e10cSrcweir // pWidths: the advance widths of the correspoding glyphs (in PS font units) 297cdf0e10cSrcweir // nGlyphs: the number of glyphs 298cdf0e10cSrcweir // rInfo: additional outgoing information 299cdf0e10cSrcweir // implementation note: encoding 0 with glyph id 0 should be added implicitly 300cdf0e10cSrcweir // as "undefined character" 301cdf0e10cSrcweir virtual sal_Bool CreateFontSubset( const rtl::OUString& rToFile, 302cdf0e10cSrcweir const ImplFontData*, 303cdf0e10cSrcweir long* pGlyphIDs, 304cdf0e10cSrcweir sal_uInt8* pEncoding, 305cdf0e10cSrcweir sal_Int32* pWidths, 306cdf0e10cSrcweir int nGlyphs, 307cdf0e10cSrcweir FontSubsetInfo& rInfo // out parameter 308cdf0e10cSrcweir ); 309cdf0e10cSrcweir 310cdf0e10cSrcweir // GetFontEncodingVector: a method to get the encoding map Unicode 311cdf0e10cSrcweir // to font encoded character; this is only used for type1 fonts and 312cdf0e10cSrcweir // may return NULL in case of unknown encoding vector 313cdf0e10cSrcweir // if ppNonEncoded is set and non encoded characters (that is type1 314cdf0e10cSrcweir // glyphs with only a name) exist it is set to the corresponding 315cdf0e10cSrcweir // map for non encoded glyphs; the encoding vector contains -1 316cdf0e10cSrcweir // as encoding for these cases 317cdf0e10cSrcweir virtual const Ucs2SIntMap* GetFontEncodingVector( const ImplFontData*, const Ucs2OStrMap** ppNonEncoded ); 318cdf0e10cSrcweir 319cdf0e10cSrcweir // GetEmbedFontData: gets the font data for a font marked 320cdf0e10cSrcweir // embeddable by GetDevFontList or NULL in case of error 321cdf0e10cSrcweir // parameters: pFont: describes the font in question 322cdf0e10cSrcweir // pWidths: the widths of all glyphs from char code 0 to 255 323cdf0e10cSrcweir // pWidths MUST support at least 256 members; 324cdf0e10cSrcweir // rInfo: additional outgoing information 325cdf0e10cSrcweir // pDataLen: out parameter, contains the byte length of the returned buffer 326cdf0e10cSrcweir virtual const void* GetEmbedFontData( const ImplFontData*, 327cdf0e10cSrcweir const sal_Ucs* pUnicodes, 328cdf0e10cSrcweir sal_Int32* pWidths, 329cdf0e10cSrcweir FontSubsetInfo& rInfo, 330cdf0e10cSrcweir long* pDataLen ); 331cdf0e10cSrcweir // frees the font data again 332cdf0e10cSrcweir virtual void FreeEmbedFontData( const void* pData, long nDataLen ); 333cdf0e10cSrcweir virtual void GetGlyphWidths( const ImplFontData*, 334cdf0e10cSrcweir bool bVertical, 335cdf0e10cSrcweir Int32Vector& rWidths, 336cdf0e10cSrcweir Ucs2UIntMap& rUnicodeEnc ); 337cdf0e10cSrcweir virtual int GetMinKashidaWidth(); 338cdf0e10cSrcweir 339cdf0e10cSrcweir virtual sal_Bool GetGlyphBoundRect( long nIndex, Rectangle& ); 340cdf0e10cSrcweir virtual sal_Bool GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); 341cdf0e10cSrcweir 342cdf0e10cSrcweir virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); 343cdf0e10cSrcweir virtual void DrawServerFontLayout( const ServerFontLayout& ); 344cdf0e10cSrcweir 345cdf0e10cSrcweir virtual bool supportsOperation( OutDevSupportType ) const; 346cdf0e10cSrcweir // Query the platform layer for control support 347cdf0e10cSrcweir virtual sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart ); 348cdf0e10cSrcweir 349cdf0e10cSrcweir virtual SystemGraphicsData GetGraphicsData() const; 350cdf0e10cSrcweir virtual SystemFontData GetSysFontData( int nFallbacklevel ) const; 351cdf0e10cSrcweir }; 352cdf0e10cSrcweir 353cdf0e10cSrcweir // Init/Deinit Graphics 354cdf0e10cSrcweir void ImplSalInitGraphics( WinSalGraphics* ); 355cdf0e10cSrcweir void ImplSalDeInitGraphics( WinSalGraphics* ); 356cdf0e10cSrcweir void ImplUpdateSysColorEntries(); 357cdf0e10cSrcweir int ImplIsSysColorEntry( SalColor nSalColor ); 358cdf0e10cSrcweir void ImplGetLogFontFromFontSelect( HDC, const ImplFontSelectData*, 359cdf0e10cSrcweir LOGFONTW&, bool bTestVerticalAvail ); 360cdf0e10cSrcweir 361cdf0e10cSrcweir // ----------- 362cdf0e10cSrcweir // - Defines - 363cdf0e10cSrcweir // ----------- 364cdf0e10cSrcweir 365cdf0e10cSrcweir #define MAX_64KSALPOINTS ((((sal_uInt16)0xFFFF)-8)/sizeof(POINTS)) 366cdf0e10cSrcweir 367cdf0e10cSrcweir // ----------- 368cdf0e10cSrcweir // - Inlines - 369cdf0e10cSrcweir // ----------- 370cdf0e10cSrcweir 371cdf0e10cSrcweir // #102411# Win's GCP mishandles kerning => we need to do it ourselves 372cdf0e10cSrcweir // SalGraphicsData::mpFontKernPairs is sorted by 373cdf0e10cSrcweir inline bool ImplCmpKernData( const KERNINGPAIR& a, const KERNINGPAIR& b ) 374cdf0e10cSrcweir { 375cdf0e10cSrcweir if( a.wFirst < b.wFirst ) 376cdf0e10cSrcweir return true; 377cdf0e10cSrcweir if( a.wFirst > b.wFirst ) 378cdf0e10cSrcweir return false; 379cdf0e10cSrcweir return (a.wSecond < b.wSecond); 380cdf0e10cSrcweir } 381cdf0e10cSrcweir 382cdf0e10cSrcweir // called extremely often from just one spot => inline 383cdf0e10cSrcweir inline bool ImplWinFontData::HasChar( sal_uInt32 cChar ) const 384cdf0e10cSrcweir { 385cdf0e10cSrcweir if( mpUnicodeMap->HasChar( cChar ) ) 386cdf0e10cSrcweir return true; 387cdf0e10cSrcweir // second chance to allow symbol aliasing 388cdf0e10cSrcweir if( mbAliasSymbolsLow && ((cChar-0xF000) <= 0xFF) ) 389cdf0e10cSrcweir cChar -= 0xF000; 390cdf0e10cSrcweir else if( mbAliasSymbolsHigh && (cChar <= 0xFF) ) 391cdf0e10cSrcweir cChar += 0xF000; 392cdf0e10cSrcweir else 393cdf0e10cSrcweir return false; 394cdf0e10cSrcweir return mpUnicodeMap->HasChar( cChar ); 395cdf0e10cSrcweir } 396cdf0e10cSrcweir 397cdf0e10cSrcweir #endif // _SV_SALGDI_H 398cdf0e10cSrcweir 399