1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 #include "aqua/salgdi.h" 23 #include "sallayout.hxx" 24 25 #include <ApplicationServices/ApplicationServices.h> 26 27 // ======================================================================= 28 29 class CTTextStyle 30 : public ImplMacTextStyle 31 { 32 public: 33 explicit CTTextStyle( const ImplFontSelectData& ); 34 virtual ~CTTextStyle( void ); 35 36 virtual SalLayout* GetTextLayout( void ) const; 37 38 virtual void GetFontMetric( float fDPIY, ImplFontMetricData& ) const; 39 virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) const; 40 virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) const; 41 SetTextColor(const RGBAColor &)42 virtual void SetTextColor( const RGBAColor& ) {} 43 44 private: 45 /// CoreText text style object 46 CFMutableDictionaryRef mpStyleDict; 47 48 friend class CTLayout; GetStyleDict(void) const49 CFMutableDictionaryRef GetStyleDict( void ) const { return mpStyleDict; } 50 }; 51 52 // ======================================================================= 53 54 #ifndef DISABLE_CORETEXT_DYNLOAD 55 // the CoreText symbols may need to be loaded dynamically 56 // since platform targets like OSX 10.4 do not provide all required symbols 57 // TODO: avoid the dlsym stuff if the target platform is >= OSX10.5 58 59 class DynCoreTextSyms 60 { 61 public: 62 // dynamic symbols to access the CoreText API 63 uint32_t (*GetCoreTextVersion)(void); 64 CTFontCollectionRef (*FontCollectionCreateFromAvailableFonts)(CFDictionaryRef); 65 CFArrayRef (*FontCollectionCreateMatchingFontDescriptors)(CTFontCollectionRef); 66 CGPathRef (*FontCreatePathForGlyph)(CTFontRef,CGGlyph,const CGAffineTransform*); 67 CGRect (*FontGetBoundingRectsForGlyphs)(CTFontRef,CTFontOrientation,CGGlyph*,CGRect*,CFIndex); 68 CTLineRef (*LineCreateJustifiedLine)(CTLineRef,CGFloat,double); 69 double (*LineGetTrailingWhitespaceWidth)(CTLineRef); 70 CGFloat (*LineGetOffsetForStringIndex)(CTLineRef,CFIndex,CGFloat*); 71 CFArrayRef (*LineGetGlyphRuns)(CTLineRef); 72 CFIndex (*RunGetGlyphCount)(CTRunRef); 73 const CGGlyph* (*RunGetGlyphsPtr)(CTRunRef); 74 const CGPoint* (*RunGetPositionsPtr)(CTRunRef); 75 const CGSize* (*RunGetAdvancesPtr)(CTRunRef); 76 const CFIndex * (*RunGetStringIndicesPtr)(CTRunRef); 77 78 // singleton helpers 79 static const DynCoreTextSyms& get( void ); IsActive(void) const80 bool IsActive( void ) const { return mbIsActive; } 81 82 private: 83 explicit DynCoreTextSyms( void ); 84 bool mbIsActive; 85 }; 86 87 #endif // DISABLE_CORETEXT_DYNLOAD 88 89 // ======================================================================= 90 91