Mercurial > projects > dstep
diff dstep/applicationservices/ats/ATSTypes.d @ 12:9f0b49a2f64e
Added the ApplicationServices frameworks: ATS, ColorSync and CoreGraphics
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 14:00:21 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/applicationservices/ats/ATSTypes.d Mon Aug 03 14:00:21 2009 +0200 @@ -0,0 +1,230 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Aug 1, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.applicationservices.ats.ATSTypes; + +//import dstep.AvailabilityMacros; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.applicationservices.coregraphics.CGGeometry; +import dstep.coreservices.CoreServices; +import dstep.objc.bridge.TypeEncoding; + +alias CGPoint ATSPoint; +alias uint FMGeneration; +alias short FMFontFamily; +alias short FMFontStyle; +alias short FMFontSize; +alias uint FMFont; +alias uint FMFilterSelector; +alias FMFontFamilyCallbackFilterProcPtr FMFontFamilyCallbackFilterUPP; +alias FMFontCallbackFilterProcPtr FMFontCallbackFilterUPP; +alias uint ATSOptionFlags; +alias uint ATSGeneration; +alias uint ATSFontContainerRef; +alias uint ATSFontFamilyRef; +alias uint ATSFontRef; +alias ushort ATSGlyphRef; +alias CGFloat ATSFontSize; +alias uint ATSFontFormat; +alias ushort ATSCurveType; +alias ushort GlyphID; + +extern (C) +{ + alias int function (uint, void*) FMFontCallbackFilterProcPtr; + alias int function (short, void*) FMFontFamilyCallbackFilterProcPtr; +} + +// This is needed otherwise the enums will fail compiling with gdc +version (GNU) +{ + private + { + const __kFMTrueTypeFontTechnology = getOSType!("true"); + const __kFMPostScriptFontTechnology = getOSType!("typ1"); + } +} + +enum +{ + kInvalidGeneration = 0L, + kInvalidFontFamily = -1, + kInvalidFont = 0L +} + +enum +{ + kFMCurrentFilterFormat = 0L +} + +enum +{ + kFMFontTechnologyFilterSelector = 1L, + kFMFontContainerFilterSelector = 2L, + kFMGenerationFilterSelector = 3L, + kFMFontFamilyCallbackFilterSelector = 4L, + kFMFontCallbackFilterSelector = 5L, + kFMFontDirectoryFilterSelector = 6L, + kFMFontFileRefFilterSelector = 10L +} + +enum +{ + kFMTrueTypeFontTechnology = getOSType!("true"), + kFMPostScriptFontTechnology = getOSType!("typ1") +} + +enum +{ + kATSFontFormatUnspecified = 0 +} + +enum +{ + kATSGenerationUnspecified = 0L, + kATSFontContainerRefUnspecified = 0L, + kATSFontFamilyRefUnspecified = 0L, + kATSFontRefUnspecified = 0L +} + +enum +{ + kATSItalicQDSkew = (1 << 16) / 4, + kATSBoldQDStretch = (1 << 16) * 3 / 2, + kATSRadiansFactor = 1144 +} + +enum +{ + kATSCubicCurveType = 0x0001, + kATSQuadCurveType = 0x0002, + kATSOtherCurveType = 0x0003 +} + +enum +{ + kATSDeletedGlyphcode = 0xFFFF +} + +struct ATSFSSpec +{ + short vRefNum; + int parID; + ubyte[64] name; +} + + +struct FMFontFamilyInstance +{ + short fontFamily; + short fontStyle; +} + + +struct FMFontFamilyIterator +{ + UInt32* reserved; +} + + +struct FMFontIterator +{ + UInt32* reserved; +} + + +struct FMFontFamilyInstanceIterator +{ + UInt32* reserved; +} + + +struct FMFontDirectoryFilter +{ + short fontFolderDomain; + UInt32* reserved; +} + +struct FMFilter +{ + uint format; + FMFilterSelector selector; + + union + { + FourCharCode fontTechnologyFilter; + ATSFSSpec fontContainerFilter; + FMGeneration generationFilter; + FMFontFamilyCallbackFilterUPP fontFamilyCallbackFilter; + FMFontCallbackFilterUPP fontCallbackFilter; + FMFontDirectoryFilter fontDirectoryFilter; + /*const*/ FSRef* fontFileRefFilter; + } +} + + +struct ATSFontMetrics +{ + float version_; + CGFloat ascent; + CGFloat descent; + CGFloat leading; + CGFloat avgAdvanceWidth; + CGFloat maxAdvanceWidth; + CGFloat minLeftSideBearing; + CGFloat minRightSideBearing; + CGFloat stemWidth; + CGFloat stemHeight; + CGFloat capHeight; + CGFloat xHeight; + CGFloat italicAngle; + CGFloat underlinePosition; + CGFloat underlineThickness; +} + + +struct ATSUCurvePath +{ + UInt32 vectors; + UInt32* controlBits; + ATSPoint* vector; +} + + +struct ATSUCurvePaths +{ + UInt32 contours; + ATSUCurvePath* contour; +} + + +struct ATSGlyphIdealMetrics +{ + ATSPoint advance; + ATSPoint sideBearing; + ATSPoint otherSideBearing; +} + + +struct ATSGlyphScreenMetrics +{ + ATSPoint deviceAdvance; + uint topLeft; + uint height; + UInt32 width; + ATSPoint sideBearing; + ATSPoint otherSideBearing; +} + +extern (C) +{ + FMFontFamilyCallbackFilterUPP NewFMFontFamilyCallbackFilterUPP (FMFontFamilyCallbackFilterProcPtr userRoutine); + FMFontCallbackFilterUPP NewFMFontCallbackFilterUPP (FMFontCallbackFilterProcPtr userRoutine); + void DisposeFMFontFamilyCallbackFilterUPP (FMFontFamilyCallbackFilterUPP userUPP); + void DisposeFMFontCallbackFilterUPP (FMFontCallbackFilterUPP userUPP); + int InvokeFMFontFamilyCallbackFilterUPP (short iFontFamily, void* iRefCon, FMFontFamilyCallbackFilterUPP userUPP); + int InvokeFMFontCallbackFilterUPP (uint iFont, void* iRefCon, FMFontCallbackFilterUPP userUPP); +} \ No newline at end of file