ali@polya.Stanford.EDU (Ali T. Ozer) (08/23/88)
--- Here's what I'm trying to do: Load a font from a subdirectory of the directory where my executable is. Call this subdirectory "myfonts". First, there seems to be no way to get OpenDiskFont() to look at "myfonts" without reassigning fonts:. Is this correct? (If not, how do you do it?) Assuming you have to reassign fonts:, here's the horrible thing I was doing as a "temporary" solution: Execute ("assign savefonts: fonts:", NULL, NULL); Execute ("assign fonts: myfonts", NULL, NULL); myfont = OpenDiskFont (blah blah); Execute ("assign fonts: savefonts:", NULL, NULL); Execute ("assign savefonts:", NULL, NULL); This is real ugly; it should have Forbid()/Permit() around it, and even then it might die, and besides, it doesn't work when the program is run from the Workbench, because Execute() is not connected to the right directory anymore. So then I tried to do the following sort of thing: BPTR seg = LoadSeg ("myfonts/fontname/30"); long *foo = BADDR(seg); /* bptr to C pointer */ AddFont (&foo[2]); /* Skip over the next ptr and moveq/rts */ ... then OpenFont ... After a few attempts that failed, I kind of dialed up, and while at it, decided to throw the question the way of comp.sys.amiga.tech. Is there any graceful way of doing what I'm trying to do? And, how about the LoadSeg/AddFont approach --- Will it eventually work if I work at it? Ali Ozer, aozer@next.com, ali@polya.stanford.edu
kodiak@amiga.UUCP (Robert R. Burns) (08/27/88)
In article <3704@polya.Stanford.EDU> aozer@next.com (Ali Ozer) writes: )--- )Here's what I'm trying to do: Load a font from a subdirectory of the )directory where my executable is. Open the font with: ta.ta_Name = "myapp:fontdir/bosco.font"; ta.ta_YSize = 11; ... OpenDiskFont(&ta); Now the tricky part. Under 1.2 (V33) and earlier diskfont.library, the font contents file name is opened relative to FONTS:, so it needed to be like "myapp:fontdir/bosco/11". Under 1.3 (V34) and later diskfont.library, the font contents file name is opened relative to the directory containing the font contents file, so it can be like "bosco/11", which is just like fonts you find in the FONTS: drawer. So, since you cannot ensure that the user has 1.3 (RSN :-)), you probably want to have an entry like the first one. See libraries/diskfont.h for the form of the font contents file. - Kodiak -- | / _ _|' _ |/ Bob Burns . . . . .---. . |/ (_)(_)|(_\|\ {pyramid|oliveb|cbmvax]! / \ |\ /| | | __ / \ |\ Kodiak \ amiga!kodiak _______/ A \| \/ |_|_|___|/ A \ | \ Software "dedicated to the science of fun"\_________
msl5864@ritcv.UUCP (Michael Leibow) (09/05/88)
In article <3704@polya.Stanford.EDU> aozer@next.com (Ali Ozer) writes: >--- >Here's what I'm trying to do: Load a font from a subdirectory of the >directory where my executable is. isn't the pathname for the requested font in the FONTS:#?.font file? If you create your own .font file, you should be able to put the actual font wherever you want. The format of the .font file is in the RKM: Libraries and Devices in the fonts chapter. --Mike -- Michael S. Leibow UUCP: {allegra,seismo}!rochester!ritcv!msl5864 CSNET: msl5864%rit@csnet-relay.ARPA