Getting path of font menu item

External developers... This forum's for you!

Getting path of font menu item

Postby gonetriadrr » Sun Oct 10, 2010 3:17 pm

Anyone know of an external that can return the source path of a font menu entry?

DCS
gonetriadrr
 
Posts: 170
Joined: Fri Jan 08, 2010 6:50 pm

Re: Getting path of font menu item

Postby codegreen » Sun Oct 10, 2010 11:27 pm

onetriadrr wrote:Anyone know of an external that can return the source path of a font menu entry?

Hi David,

I don't, so I just dashed one off for you and stuck it in the file section. Please let me know if you find any problems with it...

HTH,
-Mark
codegreen
 
Posts: 1510
Joined: Mon Jul 14, 2008 11:03 pm

Re: Getting path of font menu item

Postby gonetriadrr » Mon Oct 11, 2010 7:54 am

mark wrote:I don't, so I just dashed one off for you and stuck it in the file section. Please let me know if you find any problems with it...

HTH,
-Mark


Thanks!! :D

DCS
gonetriadrr
 
Posts: 170
Joined: Fri Jan 08, 2010 6:50 pm

Re: Getting path of font menu item

Postby gonetriadrr » Thu Oct 14, 2010 9:58 am

Mark,

Tested getFontFile() using the font list provided by listfonts().
Fails unless the font name = the 'full name' of the font.

For instance, the full name of 'ACaslon Regular' = 'Adobe Caslon Regular' ,and full name of 'Times Regular' = 'Times Roman'.

Using a pair of xternals i whipped up using Uli's SuperCompiler, i was able to make getFontFile() work reliably.
The first calls availableFontFamilies and the next, availableMembersOfFontFamily.
Even so, it takes up to 4 tests to determine the proper 'full name'... using combinations of the familyName and postScriptName/styleName provided by availableMembersOfFontFamily .

I would post the project, but i'm not sure the xternals are universal.
Working towards a mechanism to link textFont/textStyle as appled in SC to the font file.
Curiously, postScript fonts resolve to the 'lwfn' file rather than the suitcase, which makes this a little difficult.

DCS
gonetriadrr
 
Posts: 170
Joined: Fri Jan 08, 2010 6:50 pm

Re: Getting path of font menu item

Postby Dave_Higgins » Thu Oct 14, 2010 12:17 pm

onetriadrr wrote:I would post the project, but i'm not sure the xternals are universal.

Nah. SuperCompiler is making Xfcn at best. He said he may get back into it some day to update it. I'm surprised you were able to actually get it to work at all right now.
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Getting path of font menu item

Postby gonetriadrr » Fri Oct 15, 2010 12:04 pm

Dave Higgins wrote:Nah. SuperCompiler is making Xfcn at best. He said he may get back into it some day to update it. I'm surprised you were able to actually get it to work at all right now.

Actually, those xternals were back when Uli was plugging along with it.

DCS
gonetriadrr
 
Posts: 170
Joined: Fri Jan 08, 2010 6:50 pm

Re: Getting path of font menu item

Postby gonetriadrr » Sat Oct 16, 2010 9:49 am

onetriadrr wrote:
Dave Higgins wrote:Nah. SuperCompiler is making Xfcn at best. He said he may get back into it some day to update it. I'm surprised you were able to actually get it to work at all right now.

Actually, those xternals were back when Uli was plugging along with it.

DCS


SuperCompiler did in fact create XFcns. IIRC, i was able to recompile a xternal not too long ago by turning back the Mac's clock to before the expiration date.

DCS
gonetriadrr
 
Posts: 170
Joined: Fri Jan 08, 2010 6:50 pm

Re: Getting path of font menu item

Postby Dave_Higgins » Sat Oct 16, 2010 10:55 am

onetriadrr wrote:SuperCompiler did in fact create XFcns. IIRC, i was able to recompile a xternal not too long ago by turning back the Mac's clock to before the expiration date.

Ahh. Didn't realize that. I was chatting with him a while back about it, but decided to let it go for now since it was timed out. Maybe we'll be able to nudge him back into it before long to update it (he mentioned a lot that he intends to add to it if/when he does).
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Getting path of font menu item

Postby codegreen » Sun Oct 17, 2010 4:09 am

onetriadrr wrote:Tested getFontFile() using the font list provided by listfonts().
Fails unless the font name = the 'full name' of the font.

For instance, the full name of 'ACaslon Regular' = 'Adobe Caslon Regular' ,and full name of 'Times Regular' = 'Times Roman'.

Hi David,

I just posted an update that uses older QuickDaw-based APIs to try to resolve font names first before falling back to the Apple Type Services routines used in the original version. It's able to successfully resolve 369 of the 372 Roman fonts returned on my system by the ListFonts XFcn (the exceptions being Brush Script MT, Myriad Italic, and Myriad BoldItalic), and about half of the non-Roman ones at the bottom of the Font menu as well (alas some names containing Unicode Asian characters still fail).

Not perfect (font access from Carbon in OS X is still not quite soup yet...) but hopefully less hassle in practice.

Are you saying you've managed to get 100% accuracy using the Cocoa font APIs?

HTH,
-Mark
codegreen
 
Posts: 1510
Joined: Mon Jul 14, 2008 11:03 pm


Return to Xcode and the Internals Toolbox

Who is online

Users browsing this forum: No registered users and 1 guest

cron