WWDC2001 Session 128

Transcript

Kind: captions
Language: en
hi I like to welcome you too
twenty-eight fault management or noise
then the fault management on Mac os10
has changed a lot compared with Mike
Weston and the font formats we supported
I think we would have a great session
today would have actually an extra guest
a special guest I should say from
Macromedia will talk about his migration
from Mac OS 9 to Mac OS 10 and the API
is he used to replace you know the whole
course he had on Mac OS 9 and go around
like you know the limitations of a
resource manager so let's start now I'd
like to introduce Nathan Taylor who is
actually software engineer in the type
group has been working on the font
manager for my Krishnan
that's all right well thank you for the
induction ha ba ba ba well I'd like to
announce that we've shipped Mac OS 10
we've done a lot of work here getting it
ready for you guys and we can't wait to
see what great applications that you
will create for this platform today's
agenda is an agenda for answering
questions we've received many questions
along the road and we hope to answer a
few of them today I'm going to start off
by going into the inner workings of ATS
and the font manager on OS 10 then we
will go into programming examples and
getting into the programming interface
and getting into the nuts and bolts of
the api's that you will be using and
finally we will have a real-life example
to spice things up in development of ATS
for Mac OS 10
we had several enhancements that we
wanted to make first off we created a
specialized database for handling fonts
and font data this obviated the need to
use the resource manager and as a result
we get better performance from taking
advantage of Mac OS tens kernel features
additionally from this approach we could
enhance scalability we can now handle
many more fonts and many filmora font
formats
additionally now there is no longer a
upper limit to the number of fonts that
could be installed in the system except
for the RAM that a user might have
installed in doing this we wanted to
improve the extensibility
of the font system on necklace 10 and we
also had some mention before we support
more font technologies and font
packaging formats
additionally we have support for plugin
font rasterizer x' so we can create new
font rasterizes to support such things
to stroke bait stroke based fonts in the
future a major design goal of this
rewrite for Mac OS 10 was to provide a
consistent programmer interface this way
developers who want to use fonts don't
have to know the specific details of the
font formats that they're going to be
using and they don't need to be Wizards
of the resource manager another major
feature is that we feature non-invasive
file access you can be insure assured
that when you install fonts from a CD
those fonts will not be modified this
graphic here shows a description outline
of the 80s client higher hierarchy as
you can see 80s lies at the bottom it's
the foundation for all the text handling
in Mac OS 10 there are different
frameworks here that you can take
advantage with your application and they
will all call into 80s to get font and
font data one of the major questions we
have received most frequently is what
type of font formats do we support we
support the TrueType font technologies
in a various packaging formats we
support the standard Macintosh resource
base fonts use cases that you know from
previous versions of the OS we also
support a new format the default format
which is a data fork packaged font very
similar to the resource fork we also
support now Windows true type fonts so
you can install TTFN and ttc fonts and
they will just work in mac OS 10
thank you additionally we support a wide
variety of PostScript fonts we now
support the up and coming standard
OpenType from Microsoft and Adobe and we
also support the type 1 format that you
all know from Adobe type manager finally
we we have support for Asian fonts using
the character identifier keyed
PostScript fonts another frequently
asked question is where should fonts be
installed in the system these areas in
the system are listed in precedence
order here and we use the precedents to
resolve font duplicates we consider
these areas domains in the system the
highest precedence domain is the user
domain and it's in the users font for
our users home directory they have a
library fonts folder users can install
any fonts they want in this directory
they will have take precedence over
other fonts and the user will get to see
the fonts that they intend to use
additionally the next domain in the
precedence chain is the local domain
this is where a system administrator can
install fonts for use by all users on a
system it is also where we encourage
developers to install
application-specific fonts and response
they decide to share between other
applications
another interesting domain is the
network domain where a corporation can
install a corporate specific font at
Apple we install apple Garamond to type
in the network domain and use it on all
the corporate systems the fourth domain
which have highlighted here is the
system domain the system domain is where
Apple installs the system fonts we
recommend that this system may not be
used for installing
third-party fonts or application fonts
finally we also support fonts from the
standard Mac OS 9 system folder these
fonts will be picked up from a previous
install of Mac OS 9 and used with all
Mac OS 10 applications there is a caveat
to this though the classic applications
that you run will not get to see other
Mac OS 10 fonts they will only see the
fonts that are in the classic system
folder this system folder
changes when a user changes their
specific classic folder in the
Preferences panel and one other thing
I'd like to note all of these domains
are scanned and activated when a user
logs in another area of concern is
working developers install fonts we are
actually very flexible fonts can be
solved in almost any directory on the
system and programmatically activated
from an application however there are
some recommended locations that you
install your fonts one place you might
want to consider if you are a vendor
that ships multiple applications that
wants to share a set of fonts you may
want to consider making a a planarian
side of the local the local library or a
user's library to share files between
your various applications more
specifically if you require a specific
font for your user interface you might
want to consider installing the font
inside of your applications bundle this
can be programmatically activated
locally only to that application and
your application will be assured that it
gets the the font that it needs for its
UI
additionally we support activation from
memory resident fonts and also
application from resource forks if you
insist on in bundling a fork inside your
applications resource you can activate
that particular file and it will
activate the font right from the
resource work I'd like to make one note
fonts that are activated
programmatically take precedence over
the fonts that are activated from the
multiple domains and above all the the
local domain when you activate a font
programmatically locally to your
application you will be brought you to
be assured that you will get that font
font installation on Mac OS 10 is a
simple procedure as it was before it's a
simple matter of locating the font
directory that you want to install the
font dragging the fonts you want
installed and dropping them in that
folder
deactivation works very similarly just
take them out these directories will get
rescanned
when you launch your application also
they get scanned when you log a user
logs into a system one caveat to this is
that
running applications will not see an
update of the directories until another
application another application has
launched when this application has
launched is scanned it triggers a rescan
of the directories since we have
multiple domains for installing fonts
there's the issue of handling duplicate
fonts and as I mentioned before we
handle these based on a precedence
ordering of the domains the user domain
takes precedence over all the standard
domains and programmatically activated
fonts will take precedence over fonts in
the standard font folders conflicts are
handled in a slightly different manner
we handle count conflicts by
synthesizing an entry in the font
database this is to facilitate the fact
as I mentioned before that we will not
modify the files and support non
invasive file access font selection on
Mac OS 10 is works just like it did
before we have rewritten the api's for
creating the standard font menus and
they act as clients directly to 80s
Carbon developers using the carbon
framework can present their font menu in
two manners you get a standard flat font
menu as you are your app users are used
to for Mac OS 9 and then there is a new
more compact hierarchical format font
menu if you are writing a cocoa
application you get the benefit of the
new app kit font panel this font panel
makes it easy to access your fonts in
large collections manage your
collections and also gives the user an
easy way to visualize the font family
style and size that they are currently
using the printing system on Mac OS 10
is a major client of ATS it uses ATS to
convert fonts from the standard display
format to formats appropriate for
embedding in PDF documents or
downloading to a printer the printing is
handled through a standard dialog in all
Carbon and cocoa applications and uses
as a PDF as an intermediary throughout
the entire process
fonts are streamed from 80s and embedded
in this PDF file and we also do
subsetting of the fonts for this because
the fonts are embedded these PDF files
can be shared between cross between
platforms and viewed with a standard PDF
viewer and expected to display as as
they should
okay I'd like to take a moment to
discuss what I'll be showing in a brief
demonstration here I'll illustrate the
standard font directories on Mac OS 10
then I will illustrate the the methods
for selecting fonts printing and
printing to PDF in exchange of PDFs and
finally an application I have that does
a local activation of a specific font
all right
okay first off I'd like to show you this
is the classic so this is the yeah
classic domain where classic system
fonts are from you can see it's coming
from the standard Mac OS 9 system folder
that's installed in the system
additionally here this is the system
domain where you can see where we have
our system fonts that are stored as D
fonts and OTF fonts additionally I have
the local domain here where system
administrators will install system-wide
fonts for use by all the users of a
system and finally users have their own
font folder inside the user home
directory where they can sell any fonts
they choose font installation as I
mentioned is a simple process I have
here a collection of multiple formats of
fonts and I'll do install some OTF fonts
here some PostScript character identify
our key fonts standard PostScript type 1
fonts and finally a Windows to type font
in TTFN format
sorry the command key on the left is
broken on this keyboard and I keep
forgetting it okay doesn't mention I
just installed the fonts here and you
can see that they are not actually
active in activated inside of this menu
if I launch a new application as I'm
doing now these fonts will be activated
the directory will be rescanned
and you can see an example right here I
have Ariel in the TTFN format the
windows format I just installed and it's
a simple matter to use it I can select
my text and change to it now I have two
demo apps here this one first is shows
the standard flat flat style font menu
and carbon and then I have a new one
that I have implemented with a
hierarchical style menu and then as I
said before cocoa applications get the
benefit of the new font panel where it's
easy to see the family typeface and size
and change this to a font I activated
will go with Tecton pro oblique now as I
mentioned printing is a simple process
presented in a standard dialog I can
choose to print and preview this
directly which will generate a PDF the
fonts are streamed to it subsetted and
embedded in the PDF document this
document now is saleable as a PDF
document and I can
save it to the desktop whatever and then
I have one I've previously created which
can be shared cross-platform
in this example with classic using
Acrobat Reader for finally as I
mentioned I wanted to show an example of
locally activated fonts this version of
bring up a document here of simple text
with the hierarchical menus has a copy
of Apple Garamond TrueType embedded in
the applications bundle I call standard
ap is an act to locate this and activate
it and it's activated locally only to
this application and is not available to
other applications as you see I go to
this other simple text here there is no
an apple gehrman there's an Apple
Chancery that came from the classic
domain and additionally TextEdit doesn't
have it either that concludes the
demonstration
I'm sorry that I'd like to introduce
Julio Gonzalez a senior software
engineer in the type group you will go
into the programming interfaces of ATS
and font manager on Mac OS 10 Thank You
Nathan I'll be talking today about
basically the api's are available to you
and for font management and some of the
issues related to or a stent I'll start
with the API sets some concepts tasks
especially from the point of view or
from the angle of all the questions
we've received as people have been
bringing up their applications to run OS
10 and finally I will touch up on some
of the performance issues that might
bite you if you're special if you're
coming from Mac OS 9 before I get into
into everything I you know while I was
writing up this presentation I just
decided let me take a look at what font
management used to be and I opened up
inside Mac volume one and that's what I
came up with there were seven simple
api's boy do I miss those days a lot
less work but we've come a long way
especially with ten so let's get into it
now
one of the issues or things that
presented some confusion as we
introduced Mac OS 10 is that there are
two set of API so that you can use for
font management the first one being the
font management is the extended file
management set of API so are present on
nine they're also available to you or we
exported by carbon Lib and also of
course available in 10 but then there's
a new set of API that some of you have
seen that are part of the 80s framework
it's the header sath and I want to make
McMansion
this is a new set of api's that we've
created and only available on the Mac
os10 we have no plans at this point to
take that back to Carbon lab or mac os9
the intent of this API was to fill in
some of the gaps that were created as we
move to Mac OS 10 and try to address
some of the system differences moreover
there are opportunities here in this in
this new set of API is to address some
some features that we can no longer
address under the font management set of
API s so once again this is our only
available Mac OS 10 so let's get started
with some of the programming concepts
first one being the font-family
reference hopefully most of you are
aware that it's basically an opaque
reference to a collection of fonts that
share the same design characteristics
then there are font references basically
these are opaque references to specific
strike or a specific font in that font
family then there are containers
containers are opaque references to
where the data for the font resides and
this could get a little ambiguous as we
now support different file formats for
the fonts so where does the data really
live we like to keep that as much of it
hidden from you as to prevent some
confusion and this is something for
example that we'll try to address in the
new set of a api's finally there's
console generation as we moved away in
Mac OS 10 from using the resource
manager to keep track of all our font
data we create our own database in fact
this is also present in 9 so in order to
keep track of when the data change or
when fonts were added got deleted we
have a generation a generation seed that
we can keep track of and their API where
you can get the seat so this is how you
can tell when something has changed in
the database so yes we know it's you
still have
Paul notification hopefully will be on
the way okay the next one is the data
types this has definitely cause some
some grief for some of the developers
out there and we'd like to take it take
some time now to clarify this basically
you have data types for specifying font
references and font family references
and the for the font references so you
have the ethem font and ads with 1ib and
the aps font ref FM font and that's
through fun id are basically the same
thing and can be used interchangeably
however 80's font rafts are not the same
even though as at this moment they are
the same and you can get away with it
but they're not intended to be the same
thing if you use them interchangeably
you will surely run into trouble same
thing goes for the F and font family and
80s fun family ref here it's a little
bit more obvious as the effing font
family is that the the usual sign 16-bit
number basically the resource ID whereas
the 80s from family ref is an opaque
32-bit data type
once again they cannot be used
interchangeably so next we'll move into
some of the programming tasks they like
to cover and again this are tasks where
people have had been having troubles who
are questions as they've come up to us
then storing font references data access
specially enumeration that is how to
find out what fonts are installed in the
system conversion compatibility how to
go about activating fonts and the
activate them and finally how to go
about selecting the fonts through the UI
storing font references we get asked
this question year after year
what is Apple's recommendation to store
font references well we you know we
still at the same stage we have no
strong recommendation on what to do
about it but let's examine what people
have done in the past and some of the
caveats here some applications I've gone
in and stored the font family ID as a
font reference that worked mostly fine
our nine is confined to the own to one
one particular system
but intent that breaks that could that
could break even even quick quicker
reason being as Nathan mentioned before
we no longer modify font files as we
install the fonts into the system as we
used to do a nine we modified the if we
found that there was a resource ID
conflict we would go ahead and modify
the font before it or the suitcase
before I got a place then on ten we no
longer modify the files and we what we
do is we do create a synthetic resource
ID entry if you will have fun family
entry so depending on what fonts you
installer you install new fonts this
this ID is no longer guaranteed so it's
a really really bad idea to store a fun
family ID as a reference so you can you
can still do if if it's applicable or
enough for your for your application
store the the font name in the reference
but better suggestions for example the
the port's engine stores post scripts
names Atsui or sorry not at suis but M
LTE stores a combination of font names
you can get creative and and pick up a
different set of name store them all and
then s you open the document later on
try to match on the font name however as
far as the API sets that we provide the
best way still to store a font reference
if you want to be guaranteed of this of
the font that you stored it's the same
form that you're gonna be using is to
use a font sync reference ok next point
is data access let's examine what we do
typically online regarding font data
access typically we use heavily the font
man the resource manager to get this
together the data that we need it with
then we moved completely away from
relying on the resource manager to get
our at our data so this this is a big
issue now the same goes with low memory
Global's online there were truly global
some ten there per application for
context not that that you care that much
but there are some caveats about low
memory Global's as we stepped away from
using the resource manager to keep our
data some of the low memory Global's
that we have
store data references worth which were
resource handles so if you were to
access those lemon memory Global's and
expect to see a resource handle there
you'll be you you'll be up for a
surprise whenever possible we store
nulls in there to sort of warning you
that this reference is no longer
applicable another thing was that on a
nine any font file or any access to a
font that you had you were guaranteed
that the font file was open not so in
ten even though the through enumeration
you can get at the font the font file
might not be open so what is the
recommended way for you to move on and
get the data on the font is to use some
of the accesses that we've provided in
the font management set of api's for
example F M get font table anthem get
from table directory FM get fun
container and there are others here's a
preview of some of the data accesses
that api's have we provided the APS font
set of api's that might be useful to you
at this stage are the for example the
80s fun get postscript name which will
return to you the postscript name and
you don't have to go dig it from the
phone or anything like that and given
the right options is Altru also return
to you the CID name also there's the
80's funk it horizontal metrics and get
vertical metrics which will return to
you some metrics information that you
might have otherwise gathered from the
with tables or FM swat font so now what
if we don't have the api's right now to
get out the data that that that you want
for example one typical request that we
got from developers was how do I get out
of the fun I still need to get access to
the phone and process the data in my own
way
so there's something that we'll have
hopefully later in the future in the 80s
one set of API is but you can do that
with the set of API is that we have
right now first presumably you're gonna
be starting from a font family reference
and also hopefully a quick toast aisle
or wait so from there you can call FM
get font from fun family instance and
get out get a font reference
given the font reference you can get you
can call FM get font container which
will give you the FS peck and next you
got a call open resource for it again
you got a call it because it might the
file might not be open it's not
guaranteed to be open that that in
itself might fail because there might be
a D font so you'll need to call the
appropriate carbon calls to open the the
data fort resource want once you do that
you can get the fun family name and from
there called get one name resource to
get at the fun notice I used the name we
did not use the font family ID to get
out of the resource recent being the fun
family ID might be a synthetic fun fun
family so you're now gonna be able to
get at the resource that way so please
use the name okay the next question is
how do I find out what fonts are
installed in the system before it was
very simple you could enumerate and
through the resource manager and I'll
give you all the fonts not so under ten
so there's a couple of iterator
api's that are available to you both on
the font f in front of set of api's in
the 80s font set of api's with this
there is a there's an issue that
developers had in reading are the
documentation that is up on the web
basically the documentation stated that
neither one of these iterators would
return to you all the fonts are
installed in the system that is that is
mostly true and it's a little bit
confusing where that statement comes
from is that on line you can't get all
the fonts installed in the system
because simply because an online we do
not support data for fonts and our our
conflict resolution and duplicate
resolution is not as strong as it is on
ten however on 10 you can't get our all
the fonts are installed in the system if
you call a font reference the iterator
you get all the outline fonts only you
will not get any of the bitmap fonts
basically because if you try to use a
reference on a bit more fun in any in
some of the api's that we have there
you'll basically get an error
there's no sense on getting a table for
a bit
for example however using the
font-family iterators along with the fun
family instance iterators you'll be able
to get at every single font and font
strike that is installed on the system
well there is a data fork font a bitmap
font and not line font whatever you'll
get you'll be able to attend together
every single one of the fonts are
installed one nice thing is about this
iterators is the the filters there's a
some set of filters that you can use we
provide some standard ones such as the
technology filter and you can tell
please give me all the to type fonts
well the type 1 fonts are installed the
container filter so giving a container
reference that you might have obtained
elsewhere it give me all the fonts or
font families that belong to this
container generation which you might
find useful if you're keeping track of
the generation to let you know what
fonts got installed just got installed
on the system and also we provide you
with some callbacks that you can use to
get at the to filter the the fonts as
you go along so here here's some example
on how to get out every single one of
the strikes on on on 10 you basically
first call FM create from a fun family
iterator which will it return an
iterator cookie to you you call you use
this cookie to call FM get next font
family and it just basically give you
every fun family from that point on once
you have the fun family you can create a
fun family instance iterator this
iterator will return to you each one of
the the weights that are part of this
family along with any duplicates that we
might have resolved so you'll get every
single font that got installed at the
end just disposed to yeah the iterators
one thing to note that in the while loop
we check for for the errors here one of
the errors that you might get as a
Valera is that it the iteration is done
but another interesting error that you
can get is that the phone object
database has changed so as you're
iterating you can you can get note of
this error and decide whether you want
to keep you know ignored that the
database has changed and just proceed or
you can reset there's a reset call that
you can call and and reset the iterator
and start it started
over again conversion api's at the
moment we only have conversion ApS that
can take you all within the F and font
management set of api's from from a font
reference to a font family reference the
fun family instance reference there is
no way at this point in time to go from
an FN font ref 2080s font ref and the
same goes for the 80s one family ref and
an effing fun fun family ref that will
be forthcoming compatibility we have
that in the lair of the 80s font and
it's basically - I mean your attempt
actually to just get at some of the some
compatibility with the quick TRO space
and there will be more on this Iranian -
as we try to make it easier for you to
transition from the event management set
of API switch is for the moment the
recommended way to do things to the 80s
font set of API switch will be in the
future the right way to do carry on if
you're developing exclusively for us
then another interesting API here is the
80s font get file specification which
has sort of a counterpart on the FN side
of things I think is FN get fun
container the 80s won't get file
specification takes a font reference and
in general font references are
references to do outline data so this
will get you directly to the outline
data are supposed to save in an lwf and
font it won't point back to you of where
the suitcase is okay now how do I go
about programmatically activating and
deactivating fonts some of these api's
have been available in nine DFM activate
fonts and FMD activate font you can
activate a single file or a whole
directory of files please note that if
you pass in a directory as an to get
activated we only activate the files
that are in that that space and that in
that directory we don't go and
recursively activate all the fonts and
the in the directories and the 80s side
of things there is a couple of nice ways
to activate and deactivate font files
and
it has a nice feature the 80s fun
activate from file specification that
you can specify a context so you can
like Nathan showed in his demo if you
make this call you can specify a local
context so that that font is only
visible to that running process or
application lastly there's the aps font
activate from memory which given a
stream and if you give some hints about
the stream we can activate the font for
you
this is heavily used by the quartz
engine to rent their embedded PDF fonts
so here's a demo and this is basically
sorry some source code for what a Nathan
showed in his demo if say you were an
application and nine application that is
quickly coming up to ten and you still
have your fonts as part of your resource
fork well in nine as the resource fork
for the application opened up as the
application launched the font
immediately became part of the resource
chain and it became available or visible
in the for the font manager and actually
to all applications that were running in
ten since we no longer rely on the
resource manager we if you wish for the
font to be activated you must
programmatically do so so one way to do
this is you call the process manager
api's and whatever else to get at what
is the file spec for the currently
running application your application
once you have the FS spec you can call
this API 80s font activate from file
specification pass that off the
application file spec you can specify
the context if you for some reason want
it to be global you can specify that
there but preferably or most of the time
it will be local and I'll return to yuan
opaque container reference lastly if you
care to do so you can find what fonts
are part of this container by calling
80s fine font from container note the
preferred way actually to as Nathan said
to ship fonts where your application
would be to just place a directory full
of fonts in your application bundle
instead of just having it be part of
your resource your resource fork it's
just a little cleaner
now selection this is another question
that we've been getting from from our
developers in the carbon side is how do
you go about selecting fonts so the
answer is as Nathan showed that's leads
from the carbon side of things is that
you have to still use and depend on the
carbon set of api's which means that you
don't have access to the front panel
that Coco has for you that that will be
forthcoming too and it's a high priority
so how do you go about having a fun menu
in 10 since we no longer use a resource
manager well you can still call a pen
rest menu and it will do the right thing
you'll create the year standard flat
font menu that that you all know but it
basically ends those ends up calling
create standard font may need to do to
do its job and there are a couple of new
API set that go along with this that
I'll talk to you about in a minute
so here's the create standard font menu
call basically you get your menu handle
and that's Nathan showed in his demo you
have two options excuse me
you can create a flat representation of
the of the of the of the font or a
hierarchical more compact representation
of the font which basically takes a font
family and then a pens us submenu which
with all the put your styles are
associated with it so here in the in the
call it's very simple than this one you
specify the hierarchical fun menu and
every turns to you a hierarchical menu
count cookie that you'll need later so
what happens when the user collects on
the font menu so if you had a just your
plain plain olds flat space font menu
you called menu select and and get the
menu item and the name and then from
there go to the font family a better way
to do this and which takes advantage of
some of the features at 10 is to before
you call menu select you call update
standard font menu what this does for
you if you created the font using the
creator API that I just showed you is
that it will keep track of the
generation for you so if you call this
this call before the menu select
we'll find out if the database the
foreign object database has changed and
if so it will recreate the font menu and
Nathan showed that in this demo so once
you have that once you call menu select
you get the mini ID and from there you
can call get phone family from many
selection which in the flat menu space
will just return to you the fun family
but in the case of the hierarchical menu
it will also give you the style that the
user picked lastly I want to talk a
little bit about performance some of the
issues that you might or might not be
aware of as as you start developing 410
the history here is this we moved to 10
the major issue was that we don't have
the single memory space that we had on 9
so font data is quite extensive and we
had to come up with a way to share this
data across all the 80s clients so we
ended up having a server what this means
to the client is that some of the API is
you call end up sending messages to the
server whereas before a 9 there was no
such thing it was quite fast so it is
something that that you might need to
pay attention to if you start to see
that some things that were faster seem
faster than 9 are not so on 10 you can
you can start using some of the tools of
element n such as stop or sample to find
out what this what the activity is to
the 80s server another area of concern
is of font file under OS 10 on Mac OS 9
every single font file that was
available you was open basically on 10
we can't afford to do that since every
process lives in its own little world so
we manage this so through font file
iteration it is possible that you will
iterate through every single font file
say if you wanted to create your
standard sorry not your standard but you
know a special font menu some nifty font
menu that we do not provide and you want
to iterate through all the fonts in the
system well this will cost messaging to
the server along with that it will cause
some of the file caches that we have to
to get thrash which is perfectly fine if
we if we do not provide with what you
need in the aps that we have however
what we what you need to keep in mind is
that you might want to cache this
information to avoid this sort of
iteration another way is is the usage of
who usage of the aps we provide for
example the activation set of api's can
allows you to activate a fun follower or
a directory so it's far more efficient
to activate a directory then if you had
some old code that it just activated a
file at a time because that will create
multiple messages to the server so one
final note is please use the API that
we've provided whenever possible and not
go to the low-level and dig your own
data the reason being is that we have
optimized the api's for messaging to the
server for keeping the files open
moreover we have a good set of caches on
the server that makes things easier for
us so please stick to the API so
whenever you can now I like to take a
moment and buy the scott thompson from
micro media and he'll give us a
real-life example of what he had to do
to bring up his app under ten especially
to do with font management
[Applause]
thank you
hope you don't mind my cheat sheet here
see if I can figure how this magic works
okay great so my name is Scott Thompson
I'm a senior software Alchemist and the
Macintosh technical lead for macromedia
freehand
we just recently shipped freehand ten
they showed a demo of it in the keynote
I hope you all enjoy that what I want to
do is I want to start by telling you a
little bit about what free hands Tex
needs are and particularly some of the
font things that we have to do then I'm
going to talk a little bit about the
sort of things that we had to do to
adopt to the new font manager under
carbene live in mac OS 10 free hand 10
as their shipping application is a CFM
carbon application you'd use this
quick-draw to do its drawing despite
what you may have seen in some of the
reviews of freehand we don't do quarts
yet we began carbonizing freehand in
july of the year 2000 in earnest
we just finished shipping in May so just
to give you an idea of how long it went
when we decided to implement the carbon
feature we implemented as a feature we
set out a big schedule at the very
beginning and we knew that two areas
that we were going to have to do a lot
of work on were fonts and printing so we
put those at the very beginning of the
schedule thinking that you know if they
ran long we could kind of hop out since
printing depended on fonts it turns out
that font manager support turned out to
be item number one on our carbon
schedule and having gone through it
fonts was also the biggest thing that we
did it consumed the most of my time
anyway part of that was because it was
very complicated free hands uses your
fonts was very complicated and part of
that was because I know a lot more about
fonts now than I did when I began so
once we see on this slide is a little
bit about the text handling capabilities
of free hand just to give you an idea of
what we have I call it a mid-range text
handling capabilities we don't do any
real SuperDuper advanced typography but
we do a little bit more than your than
your average you know text editor kind
of thing we do multi-column text we do
justification of text phil' justifying
lift justifying all that good stuff we
allow the user to do custom kerning and
tracking of the text we do text on a
path text in a path
texe flowing around a path meaning that
you know you have an object in there and
the text goes on the outside of it and
we do PostScript output so where do we
begin well the first thing that I
started with was the font menu our font
menu was being created by append res
menu and all that good stuff one of one
of our big goals for freehand was to
sort of get away from the idea that all
fonts had to have a resource fork and
particularly fond because you know one
of the really nice features that you can
do on Mac os10 that a lot of our
customers are really excited about is
you grab your windows font drag it over
Mac OS 10 machine drop it in there it
shows up it works it's really great so a
lot of our code was get geared at
understanding that that fonts always had
a fondo de had to get away from that so
in that vein the first thing we did was
create the font menu was being done
through a pen res menu we had to change
that to use create standard font menu we
ran into one little interesting thing in
that freehand is a quick draw
application when we created the
hierarchical menu using hierarchical
option we found out that it was adding a
lot of fonts that are available to Atsui
but are not necessarily available
through QuickTime so that's something
you want to keep in mind if you want to
have the hierarchical menu inside of
your quick tour application you can do
it but you're gonna have to use the font
iterators to to create your own menu and
all the other good stuff
oh my dear what did I write so in the in
the vein of getting rid of fawns are
getting getting our reliance on fonts
done we had one interesting challenge
and the biggest challenge turned out
being that we wanted free hand tend to
continue to support Mac OS 8 6 Mac OS 8
6 doesn't have all the nice font manager
routines that you have under Mac OS 9
and Mac OS 10 so we had to do a little
bit of abstraction a little bit of
keeping the old code around so that
could still parse the founds and that
sort of thing in the end it turned out
that that wasn't such a bad idea because
we found some some pitfalls along the
way with using the the font manager
routines where there were differences
between the information that we got back
from the font manager routines
and the information that you would pull
out of the fonds some of those things
have been taken care of because
reported in his bugs and the Apple
engineers fixed them for us so hopefully
you'll never have to see those sorts of
things so this slide talks a little bit
about the kinds of things that we used
to get out of the font we used to get
font names in particular we were
interested in the PostScript font name
because freehand downloads PostScript to
the printer we deal a lot with
postscript names in terms of saving our
our font IDs that's what we say usually
is the PostScript font name we would get
glyph widths and other glyph metrics
some of those things I had no idea what
they were but by golly I learned we had
to get the glyph free encoding tables if
you're downloading fonts to the printer
you have to know how the fonts can be re
encoded the mac encodings and all that
other good stuff and we got things like
kerning pair information and other such
things we were able to find substitutes
for all of these things in the new font
manager api's 486 of course we just
continued using founds and and and
didn't have a problem under mac os9 we
tended to lean more towards the FM font
manager the calls that are in the that
begin with FM and we use some of the at
su font manager routines and then our
Mac os10 there are actually two cases
where he had to drop to the 80s
framework of the framework out from from
the system one of those was 80s find
font family resource you'll have to ask
Julio later whether you should use EPS
80s fine font family resource or whether
you should actually go through the thing
that he had on a slide we're probably
doing the wrong thing and then we also
had another routine that called 80s
activate font freehand has two fonts
that it stores in its resource fork and
we had to activate those fonts so we had
to load that out of the out of the
carbon bundle rather bundle using CF
bundle for the PostScript names the
routines that we found particularly
helpful was apps you find font name and
let's say you know and I guess that's a
to find font from name and oh and ETSU
find font name 80s are the absolute
routines give you a lot of information
about how to get fonts names out of the
font tables and they're really handy for
finding out a lot of information for
example I didn't know that fonts can
actually contain localized
names but you can get those using ads
who find font name I want to warn you a
little bit about the routine ATS who
find font from name we used ETSU find
font from name initially in our first
pass to find fonts based on their
PostScript name all the time that turned
out to be a little bit of a mistake
because that routine doesn't perform
really well on Mac OS 9 I'm led to
understand that the the caching schemes
on Mac OS 9 and Mac OS 10 are very
different and so as a result it performs
fine on Mac OS 10 but under Mac OS 9 you
get poor performance of the routine what
we ended up doing was continuing to rely
on the fond information trying to find
the font by parsing the font first and
if that doesn't work then we go to ads
who find font from name and that worked
out really well
glyph width and other glyph metrics I
found replacements for those in a lot of
the updated quick-draw font measuring
routines sounds really odd you have to
remember freehand is a really old
application a lot of the stuff that we
did during our carbonization was
actually modernization bring us up to
the new brave from the world and so we
were relying on some stuff from the fund
that could actually be gotten from quick
draw routines from that on glyph free
encoding tables
I believe we get those from the fund as
well if there's not a fond then we just
let the printer driver handle it and go
on with our lives
kerning pare information also I believe
comes from the font and if the phone's
not there we just skip it the other big
change that we made in freehand was
finding glyph outlines in freehand you
can take a bunch of text convert it to
paths get the outlines of the fonts and
then do special effects on them these
are the four ways that the freehand 10
can actually use to get font outlines we
have our own PostScript type 1 font
parser that's inside a freehand we have
our own true type font parser we also
talked to the Adobe type manager
back-end for those of you that are going
through Adobe type manager I don't know
if Adobe's actually released sort of a
carbonized glue code for their Adobe
type manager but I was able to load some
routines from interface live and
actually continue to use the Adobe type
manager back-end on 9 and
we use the Atsui low-level programming
interface the etsu II stuff is actually
really really nice it's really handy you
pass it off you know a set of glyphs
that you want the outlines for give us
that a call backs it comes back and
iterate through things so in closing I'd
like to talk about one one pitfall that
I ran into that you'll probably want to
start thinking about number one you'll
notice that a lot of the high end or the
higher end text formatting options the
freehand has can now be handled by Atsui
so if you have the choice between using
your own font layout engine or using
Atsui my recommendation would be try and
use it so we first because it's going to
save us a whole lot of trouble in the
future I think another one that I would
encourage anyone that's writing an
application that uses fonts go ahead and
call the folks at Adobe and buy some
OpenType fonts to start testing with
them now OpenType fonts don't have
resource forks
they have special things they don't tend
to go through true type parsers the way
you might think because sometimes the
found outlines aren't true type outlines
they're cff ER or PostScript type 1
outlines and freehand was was a
challenge it was a lot of fun and I hope
that the information I provide is really
useful ok
[Applause]
Thank You Scott that was great used to
wrap it up in summary Scott basically
summarized it all for us here as you go
on and bring your applications up to ten
the first thing to do is remove as much
resource manager dependencies as you
have in your application please try to
remember just like like Scott did in his
app not all fonts are gonna be pressing
are gonna have a fun in there it didn't
even have a resource fork in them so try
to move as much away from using a
resource manager to get your data as as
possible and we'll be giving you some
help with that in the future also then
as far as the API sets that I talked
about the same as Scott did the FM set
of api's are available to you under nine
and carbon live whereas the APS font set
of api's are just available for ten and
it's it's basically working project
progress that's that's what we want to
we want to be in the future but we're
not quite there yet so concentrate on
using the FM font set of api's and we're
pretty certain that you can get most of
what you need there in some cases you
might have to dip down and go to the 80s
font API said but hopefully that won't
have to be too much so here are some
sessions that have gone on that are
related to somehow somewhat related to
management there was the text session
yesterday I don't know if all you were
able to attend but you could find that I
find that our session on video and you
especially you will the references that
Scott made to Atsui the Atsui set of API
they were talked about in this session
so you might find that useful coming up
there's the using cocoa session and you
can learn how text text and fonts are
handled by cocoa and later today on at
5:00 there's the International feedback
forum in which you can also ask for some
questions that that you might have that
might not
might not have time to answer here later
on so here's some pointers for you
regarding documentation there is up on
the website right now the font manager
technical documentation that you see
there it covers the FM font set of AP is
the extended quick draw text font
manager api's however there are no
there's no documentation to the 80s font
set of AP is at the moment again it's
working progress and as soon as we
completed there be some documentation
that goes along with it
if you're interested in storing pretty
good font references and your and your
documents I recommend that you read the
font sync technical documentation that
is also there on the website finally I
want to make mention of something that
is not in this slide which is there's a
tech note that we're working on and
we've got almost complete which covers
most of what I've talked about to here
today but in far more detail so please
look for it on the on the website where
all the technical notes are it should be
forthcoming I don't expect it to be much
longer
finally if something comes up tomorrow
day after tomorrow and you need to talk
to us about a feature that you want
added some problem that you have some
some issue that we haven't addressed
properly in our api's please feel free
feel free to contact Sam here leggo who
is the worldwide developer relations
contact for our group and he's got our
ear pretty pretty much to his to his
devotion he next was pretty good and we
do pay attention to him he gives us a
lot of good feedback
you