1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
|
# :Author: Robert Kern
# :Copyright: 2004, Enthought, Inc.
# :License: BSD Style
cdef extern from "ATSFont.h":
ctypedef struct Float32Point:
float x
float y
ctypedef unsigned long UInt32
ctypedef short SInt16
ctypedef UInt32 FMGeneration
ctypedef SInt16 FMFontFamily
ctypedef SInt16 FMFontStyle
ctypedef SInt16 FMFontSize
ctypedef UInt32 FMFont
ctypedef struct FMFontFamilyInstance:
FMFontFamily fontFamily
FMFontStyle fontStyle
ctypedef struct FMFontFamilyIterator:
UInt32 reserved[16]
ctypedef struct FMFontIterator:
UInt32 reserved[16]
ctypedef struct FMFontFamilyInstanceIterator:
UInt32 reserved[16]
cdef enum:
kInvalidGeneration = 0
kInvalidFontFamily = -1
kInvalidFont = 0
cdef enum:
kFMCurrentFilterFormat = 0
ctypedef UInt32 FMFilterSelector
cdef enum:
kFMFontTechnologyFilterSelector = 1
kFMFontContainerFilterSelector = 2
kFMGenerationFilterSelector = 3
kFMFontFamilyCallbackFilterSelector = 4
kFMFontCallbackFilterSelector = 5
kFMFontDirectoryFilterSelector = 6
#kFMTrueTypeFontTechnology = 'true'
#kFMPostScriptFontTechnology = 'typ1'
#struct FMFontDirectoryFilter:
# SInt16 fontFolderDomain
# UInt32 reserved[2]
#
#typedef struct FMFontDirectoryFilter FMFontDirectoryFilter
#struct FMFilter:
# UInt32 format
# FMFilterSelector selector
# union:
# FourCharCode fontTechnologyFilter
# FSSpec fontContainerFilter
# FMGeneration generationFilter
# FMFontFamilyCallbackFilterUPP fontFamilyCallbackFilter
# FMFontCallbackFilterUPP fontCallbackFilter
# FMFontDirectoryFilter fontDirectoryFilter
# } filter
#
#typedef struct FMFilter FMFilter
#
ctypedef float Float32
ctypedef unsigned long OptionBits
ctypedef unsigned short UInt16
ctypedef OptionBits ATSOptionFlags
ctypedef UInt32 ATSGeneration
ctypedef UInt32 ATSFontContainerRef
ctypedef UInt32 ATSFontFamilyRef
ctypedef UInt32 ATSFontRef
ctypedef UInt16 ATSGlyphRef
ctypedef Float32 ATSFontSize
cdef enum:
kATSGenerationUnspecified = 0
kATSFontContainerRefUnspecified = 0
kATSFontFamilyRefUnspecified = 0
kATSFontRefUnspecified = 0
ctypedef struct ATSFontMetrics:
UInt32 version
Float32 ascent
Float32 descent
Float32 leading
Float32 avgAdvanceWidth
Float32 maxAdvanceWidth
Float32 minLeftSideBearing
Float32 minRightSideBearing
Float32 stemWidth
Float32 stemHeight
Float32 capHeight
Float32 xHeight
Float32 italicAngle
Float32 underlinePosition
Float32 underlineThickness
cdef enum:
kATSItalicQDSkew = 16384 # (1 << 16) / 4
kATSBoldQDStretch = 98304 # (1 << 16) * 3 / 2
kATSRadiansFactor = 1144
ctypedef UInt16 ATSCurveType
cdef enum:
kATSCubicCurveType = 0x0001
kATSQuadCurveType = 0x0002
kATSOtherCurveType = 0x0003
cdef enum:
kATSDeletedGlyphcode = 0xFFFF
ctypedef struct ATSUCurvePath:
UInt32 vectors
UInt32 controlBits[1]
Float32Point vector[1]
ctypedef struct ATSUCurvePaths:
UInt32 contours
ATSUCurvePath contour[1]
ctypedef struct ATSGlyphIdealMetrics:
Float32Point advance
Float32Point sideBearing
Float32Point otherSideBearing
ctypedef struct ATSGlyphScreenMetrics:
Float32Point deviceAdvance
Float32Point topLeft
UInt32 height
UInt32 width
Float32Point sideBearing
Float32Point otherSideBearing
ctypedef ATSGlyphRef GlyphID
cdef enum:
kATSOptionFlagsDefault = 0
kATSOptionFlagsComposeFontPostScriptName = 1 << 0
kATSOptionFlagsUseDataForkAsResourceFork = 1 << 8
kATSOptionFlagsUseResourceFork = 2 << 8
kATSOptionFlagsUseDataFork = 3 << 8
cdef enum:
kATSIterationCompleted = -980
kATSInvalidFontFamilyAccess = -981
kATSInvalidFontAccess = -982
kATSIterationScopeModified = -983
kATSInvalidFontTableAccess = -984
kATSInvalidFontContainerAccess = -985
kATSInvalidGlyphAccess = -986
ctypedef long ATSFontContext
cdef enum:
kATSFontContextUnspecified = 0
kATSFontContextGlobal = 1
kATSFontContextLocal = 2
cdef enum:
kATSOptionFlagsProcessSubdirectories = 0x00000001 << 6
kATSOptionFlagsDoNotNotify = 0x00000001 << 7
cdef enum:
kATSOptionFlagsIterateByPrecedenceMask = 0x00000001 << 5
kATSOptionFlagsIterationScopeMask = 0x00000007 << 12
kATSOptionFlagsDefaultScope = 0x00000000 << 12
kATSOptionFlagsUnRestrictedScope = 0x00000001 << 12
kATSOptionFlagsRestrictedScope = 0x00000002 << 12
ctypedef long ATSFontFormat
cdef enum:
kATSFontFormatUnspecified = 0
ctypedef OSStatus (*ATSFontFamilyApplierFunction)(ATSFontFamilyRef iFamily,
void *iRefCon)
ctypedef OSStatus (*ATSFontApplierFunction)(ATSFontRef iFont, void *iRefCon)
ctypedef void* ATSFontFamilyIterator
ctypedef void* ATSFontIterator
cdef enum:
kATSFontFilterCurrentVersion = 0
ctypedef enum ATSFontFilterSelector:
kATSFontFilterSelectorUnspecified = 0
kATSFontFilterSelectorGeneration = 3
kATSFontFilterSelectorFontFamily = 7
kATSFontFilterSelectorFontFamilyApplierFunction = 8
kATSFontFilterSelectorFontApplierFunction = 9
ctypedef union font_filter:
ATSGeneration generationFilter
ATSFontFamilyRef fontFamilyFilter
ATSFontFamilyApplierFunction fontFamilyApplierFunctionFilter
ATSFontApplierFunction fontApplierFunctionFilter
ctypedef struct ATSFontFilter:
UInt32 version
ATSFontFilterSelector filterSelector
font_filter filter
ctypedef void* ATSFontNotificationRef
ctypedef void* ATSFontNotificationInfoRef
ctypedef enum ATSFontNotifyOption:
kATSFontNotifyOptionDefault = 0
kATSFontNotifyOptionReceiveWhileSuspended = 1 << 0
ctypedef enum ATSFontNotifyAction:
kATSFontNotifyActionFontsChanged = 1
kATSFontNotifyActionDirectoriesChanged = 2
ATSGeneration ATSGetGeneration()
OSStatus ATSFontFamilyApplyFunction(ATSFontFamilyApplierFunction iFunction,
void* iRefCon)
OSStatus ATSFontFamilyIteratorCreate(
ATSFontContext iContext,
ATSFontFilter * iFilter,
void * iRefCon,
ATSOptionFlags iOptions,
ATSFontFamilyIterator * ioIterator)
OSStatus ATSFontFamilyIteratorRelease(ATSFontFamilyIterator * ioIterator)
OSStatus ATSFontFamilyIteratorReset(
ATSFontContext iContext,
ATSFontFilter * iFilter,
void * iRefCon,
ATSOptionFlags iOptions,
ATSFontFamilyIterator * ioIterator)
OSStatus ATSFontFamilyIteratorNext(
ATSFontFamilyIterator iIterator,
ATSFontFamilyRef * oFamily)
ATSFontFamilyRef ATSFontFamilyFindFromName(
CFStringRef iName,
ATSOptionFlags iOptions)
ATSGeneration ATSFontFamilyGetGeneration(ATSFontFamilyRef iFamily)
OSStatus ATSFontFamilyGetName(
ATSFontFamilyRef iFamily,
ATSOptionFlags iOptions,
CFStringRef * oName)
ctypedef UInt32 TextEncoding
TextEncoding ATSFontFamilyGetEncoding(ATSFontFamilyRef iFamily)
OSStatus ATSFontApplyFunction(ATSFontApplierFunction iFunction,
void* iRefCon)
OSStatus ATSFontIteratorCreate(
ATSFontContext iContext,
ATSFontFilter * iFilter,
void * iRefCon,
ATSOptionFlags iOptions,
ATSFontIterator * ioIterator)
OSStatus ATSFontIteratorRelease(ATSFontIterator * ioIterator)
OSStatus ATSFontIteratorReset(
ATSFontContext iContext,
ATSFontFilter * iFilter,
void * iRefCon,
ATSOptionFlags iOptions,
ATSFontIterator * ioIterator)
OSStatus ATSFontIteratorNext(
ATSFontIterator iIterator,
ATSFontRef * oFont)
ATSFontRef ATSFontFindFromName(
CFStringRef iName,
ATSOptionFlags iOptions)
ATSFontRef ATSFontFindFromPostScriptName(
CFStringRef iName,
ATSOptionFlags iOptions)
# OSStatus ATSFontFindFromContainer(
# ATSFontContainerRef iContainer,
# ATSOptionFlags iOptions,
# ItemCount iCount,
# ATSFontRef ioArray[],
# ItemCount * oCount)
#
ATSGeneration ATSFontGetGeneration(ATSFontRef iFont)
OSStatus ATSFontGetName(
ATSFontRef iFont,
ATSOptionFlags iOptions,
CFStringRef * oName)
OSStatus ATSFontGetPostScriptName(
ATSFontRef iFont,
ATSOptionFlags iOptions,
CFStringRef * oName)
# OSStatus ATSFontGetTableDirectory(
# ATSFontRef iFont,
# ByteCount iBufferSize,
# void * ioBuffer,
# ByteCount * oSize)
# ctypedef char[4] FourCharCode
# OSStatus ATSFontGetTable(
# ATSFontRef iFont,
# FourCharCode iTag,
# ByteOffset iOffset,
# ByteCount iBufferSize,
# void * ioBuffer,
# ByteCount * oSize)
OSStatus ATSFontGetHorizontalMetrics(
ATSFontRef iFont,
ATSOptionFlags iOptions,
ATSFontMetrics * oMetrics)
OSStatus ATSFontGetVerticalMetrics(
ATSFontRef iFont,
ATSOptionFlags iOptions,
ATSFontMetrics * oMetrics)
ctypedef char ConstStr255Param[256]
ATSFontFamilyRef ATSFontFamilyFindFromQuickDrawName(ConstStr255Param iName)
ctypedef char Str255[256]
OSStatus ATSFontFamilyGetQuickDrawName(
ATSFontFamilyRef iFamily,
Str255 oName)
# OSStatus ATSFontGetFileSpecification(
# ATSFontRef iFont,
# FSSpec * oFile)
# OSStatus ATSFontGetFontFamilyResource(
# ATSFontRef iFont,
# ByteCount iBufferSize,
# void * ioBuffer,
# ByteCount * oSize)
#
#ctypedef struct ATSFontQuerySourceContext:
# UInt32 version
# void * refCon
# CFAllocatorRetainCallBack retain
# CFAllocatorReleaseCallBack release
#
#ctypedef enum ATSFontQueryMessageID:
# kATSQueryActivateFontMessage = 'atsa'
cdef extern from "Fonts.h":
OSStatus FMGetFontFamilyInstanceFromFont(FMFont iFont, FMFontFamily* oFontFamily,
FMFontStyle* oStyle)
ATSFontRef FMGetATSFontRefFromFont(FMFont iFont)
FMFont FMGetFontFromATSFontRef(ATSFontRef iFont)
cdef enum:
normal = 0
bold = 1
italic = 2
underline = 4
outline = 8
shadow = 0x10
condense = 0x20
extend = 0x40
|