Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > App idea: Seamless font viewer?

App idea: Seamless font viewer?
Thread Tools
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jan 16, 2003, 11:26 PM
 
I was thinking on the feasibility of recreating the functionality of viewing a font in OS 9. It's really useful being able to double click on a font anywhere on your computer and seeing what it looks like. Currently the only thing you can do is drag to the Fonts folder and then launch an app and try it out.

Could a background app run that's registered to open font type files and simply pop up a window in the Finder like in OS 9 with a simple preview of the font? Would be nice

If nobody's interested, is there at least some info on reading a font from anywhere on a computer (i.e. not just in the fonts folder?)

Thanks!
     
Forum Regular
Join Date: Oct 2001
Location: Sweden
Status: Offline
Reply With Quote
Jan 17, 2003, 03:03 AM
 
Good idea. The thing about using a background app to pop up windows in the Finder might be a bit tricky though. Anyway, here's some info about reading font files from anywhere: http://developer.apple.com/techpubs/...sks/index.html , works great.
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Jan 17, 2003, 03:53 AM
 
It probably wouldn't need to run in the background.. just make it a standard document-based application, register it to handle fonts, and make it an LSUIElement.
[vash:~] banana% killall killall
Terminated
     
Mac Elite
Join Date: Jan 2001
Location: Helsinki, Finland
Status: Offline
Reply With Quote
Jan 17, 2003, 07:56 AM
 
This would be a nice thing to have. I've sent Apple feedback on this, hoping they'd combine it with the Character Palette, but you know, it's like talking to a wall...

J
     
Synotic  (op)
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jan 17, 2003, 12:36 PM
 
That above doc was for Carbon... not really my area of expertise (if you can even call my limited Obj-C knowledge an expertise...) Is anyone interested in tackling this?... It would be greatly appreciated.
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Jan 17, 2003, 03:23 PM
 
The Font Manager and ATS calls for activating and deactivating fonts (they're mostly equivalent) work just fine in a Cocoa app. We use FMActivateFonts to make any OmniAppKit-based application automatically load fonts from AppWrapper.app/Contents/Fonts... here's a snippet:

Code:
if (FSPathMakeRef([fontsDirectory fileSystemRepresentation], &myFSRef, NULL) == noErr) if (FSGetCatalogInfo(&myFSRef, kFSCatInfoNone, NULL, NULL, &myFSSpec, NULL) == noErr) FMActivateFonts(&myFSSpec, NULL, NULL, kFMLocalActivationContext);
Given fontsDirectory, an NSString containing the path to the fonts folder (could be a path to a font file, too), this snippet 1) gets an FSRef for the path, 2) gets an FFSpec from the FSRef, 3) activates any fonts at that file system location. kFMLocalActivationContext is used to activate the fonts only within the current application.
Rick Roe
icons.cx | weblog
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Jan 17, 2003, 10:53 PM
 
Okay, this caught my interest. Enjoy.

Ended up using ATSFontActivateFromFileSpecification instead of FMActivateFonts, since the latter doesn't tell you which fonts were activated... kind of important if you want to show a preview of them.
Rick Roe
icons.cx | weblog
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jan 17, 2003, 11:36 PM
 
Originally posted by Rickster:
Okay, this caught my interest. Enjoy.

Ended up using ATSFontActivateFromFileSpecification instead of FMActivateFonts, since the latter doesn't tell you which fonts were activated... kind of important if you want to show a preview of them.
In case you're curious to know, it doesn't work at all on my machine. It murders the Finder if I try to open it from there, and the Terminal gives the following output if I just run the executable there:
2003-01-17 21:31:22.658 FontViewer[820] *** _NSAutoreleaseNoPool(): Object 0xa1980 of class NSCFString autoreleased with no pool in place - just leaking
2003-01-17 21:31:22.660 FontViewer[820] *** -[NSCFBoolean length]: selector not recognized
2003-01-17 21:31:22.660 FontViewer[820] *** _NSAutoreleaseNoPool(): Object 0xa3100 of class NSCFString autoreleased with no pool in place - just leaking
2003-01-17 21:31:22.663 FontViewer[820] *** _NSAutoreleaseNoPool(): Object 0xa31c0 of class NSCFString autoreleased with no pool in place - just leaking
2003-01-17 21:31:22.665 FontViewer[820] *** _NSAutoreleaseNoPool(): Object 0xa31a0 of class NSException autoreleased with no pool in place - just leaking
2003-01-17 21:31:22.668 FontViewer[820] *** Uncaught exception: <NSInvalidArgumentException> *** -[NSCFBoolean length]: selector not recognized
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Jan 18, 2003, 03:14 PM
 
Hrm... works on all three machines I tested it on. They're all 10.2.3. I don't think I used any API specific to 10.2, though...
Rick Roe
icons.cx | weblog
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Jan 19, 2003, 02:11 AM
 
Works fine for me. One question, Rickster - how did you solve the problem I had when I tried to do this, that LaunchServices refused to allow an application with an LSUIElement of 1 to be a document handler?
[vash:~] banana% killall killall
Terminated
     
Mac Elite
Join Date: May 2001
Location: NYC
Status: Offline
Reply With Quote
Jan 22, 2003, 09:49 AM
 
Neat.

X Font Info, another freeware app, does the same thing.

Why Apple didn't build this into OS X itself is odd. Guess it fell to the bottom of the to-do list.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:03 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2