Version:
~ [ 10.0 ] ~
** Warning: Cannot open xref database.
1
2 /* $Id: OSXSpecifics.c,v 1.2 2005/01/11 22:48:04 andreradke Exp $ */
3
4 /******************************************************************************
5
6 UserLand Frontier(tm) -- High performance Web content management,
7 object database, system-level and Internet scripting environment,
8 including source code editing and debugging.
9
10 Copyright (C) 1992-2004 UserLand Software, Inc.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
26 ******************************************************************************/
27
28 #include "OSXSpecifics.h"
29
30 /* OSXSpecifics.c
31
32 This file and its header represent a one-stop shop for setting up OSX specific things.
33 The goal is to only need to call the setup procedure once, and have the function pointers
34 available for the rest of the time Frontier is running. I'll hone this down over time,
35 but for right now, this is good enough.
36
37 */
38
39
40 // if (strcmp((char*)*par->params[0], "true")==0) useQDText(1);
41 // else useQDText(0);
42
43
44
45 static OSStatus LoadFrameworkBundle(CFStringRef framework, CFBundleRef *bundlePtr)
46 {
47 OSStatus err;
48 FSRef frameworksFolderRef;
49 CFURLRef baseURL;
50 CFURLRef bundleURL;
51
52 if ( bundlePtr == nil ) return( -1 );
53
54 *bundlePtr = nil;
55
56 baseURL = nil;
57 bundleURL = nil;
58
59 err = FSFindFolder(kOnAppropriateDisk, kFrameworksFolderType, true, &frameworksFolderRef);
60 if (err == noErr) {
61 baseURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault, &frameworksFolderRef);
62 if (baseURL == nil) {
63 err = coreFoundationUnknownErr;
64 }
65 }
66 if (err == noErr) {
67 bundleURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, baseURL, framework, false);
68 if (bundleURL == nil) {
69 err = coreFoundationUnknownErr;
70 }
71 }
72 if (err == noErr) {
73 *bundlePtr = CFBundleCreate(kCFAllocatorSystemDefault, bundleURL);
74 if (*bundlePtr == nil) {
75 err = coreFoundationUnknownErr;
76 }
77 }
78 if (err == noErr) {
79 if ( ! CFBundleLoadExecutable( *bundlePtr ) ) {
80 err = coreFoundationUnknownErr;
81 }
82 }
83
84 // Clean up.
85 if (err != noErr && *bundlePtr != nil) {
86 CFRelease(*bundlePtr);
87 *bundlePtr = nil;
88 }
89 if (bundleURL != nil) {
90 CFRelease(bundleURL);
91 }
92 if (baseURL != nil) {
93 CFRelease(baseURL);
94 }
95
96 return err;
97 }
98
99
100 void useQDText(int i)
101 {
102 OSStatus err;
103 CFBundleRef sysBundle;
104 UInt32 newFlags = 0;
105 char s[64];
106 QuartzTextPtr QuartzText;
107
108
109 s[0]=0;
110 err = LoadFrameworkBundle( CFSTR("ApplicationServices.framework"), &sysBundle );
111 if (err == noErr) {
112 QuartzText = CFBundleGetFunctionPointerForName(sysBundle, CFSTR("SwapQDTextFlags") );
113 if (QuartzText != nil) {
114 //newFlags = kQDUseCGTextRendering | kQDUseCGTextMetrics;
115 if (i == 1) err = QuartzText(kQDUseCGTextRendering);
116 else {
117 err = QuartzText(0);
118 err = 0;
119 }
120 }
121 }
122 }
123
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.