Many, many API updates

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2176 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2002-12-07 21:39:48 +00:00
parent 9e159bcf9a
commit d5d7a2437a
11 changed files with 580 additions and 161 deletions
+101 -31
View File
@@ -27,7 +27,7 @@
<P class="Body" style="margin: 0px">Member Functions</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<TABLE WIDTH=466 HEIGHT=185 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TABLE WIDTH=621 HEIGHT=306 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=225 HEIGHT=17>
<P class="Body" style="margin: 0px">FontServer(void)</P>
@@ -46,10 +46,10 @@
</TR>
<TR>
<TD WIDTH=225 HEIGHT=17>
<P class="Body" style="margin: 0px">FT_Library GetLibrary(void)</P>
<P class="Body" style="margin: 0px">void SaveList(void)</P>
</TD>
<TD WIDTH=240 HEIGHT=17>
<P class="Body" style="margin: 0px">void ScanDirectory(const char *path)</P>
<P class="Body" style="margin: 0px">status_t ScanDirectory(const char *path)</P>
</TD>
</TR>
<TR>
@@ -61,29 +61,53 @@
</TD>
</TR>
<TR>
<TD WIDTH=225 HEIGHT=38>
<P class="Body" style="margin: 0px">int32 CountFontFamilies(void)</P>
<TD WIDTH=225 HEIGHT=17>
<P class="Body" style="margin: 0px">int32 CountFamiles(void)</P>
</TD>
<TD WIDTH=240 HEIGHT=38>
<P class="Body" style="margin: 0px">status_t GetFamily(int32 index, font_family family)</P>
<TD WIDTH=240 HEIGHT=17>
<P class="Body" style="margin: 0px">status_t IsInitialized(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=225 HEIGHT=32>
<P class="Body" style="margin: 0px">int32 CountFontStyles(font_family family)</P>
<P class="Body" style="margin: 0px">int32 CountStyles(font_family family)</P>
</TD>
<TD WIDTH=240 HEIGHT=32>
<P class="Body" style="margin: 0px">status_t GetStyle(font_family family, font_style style, int32 *flags)</P>
<P class="Body" style="margin: 0px">FontStyle *GetStyle(font_family family, font_style style)</P>
</TD>
</TR>
<TR>
<TD WIDTH=225 HEIGHT=17>
<P class="Body" style="margin: 0px">void RemoveFamily(FontFamily *family)</P>
<P class="Body" style="margin: 0px">void RemoveFamily(const char *family)</P>
</TD>
<TD WIDTH=240 HEIGHT=17>
<P class="Body" style="margin: 0px">FontFamily *_FindFamily(const char *name)</P>
</TD>
</TR>
<TR>
<TD WIDTH=225 HEIGHT=17>
<P class="Body" style="margin: 0px">ServerFont *GetSystemPlain(void)</P>
</TD>
<TD WIDTH=240 HEIGHT=17>
<P class="Body" style="margin: 0px">ServerFont *GetSystemBold(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=225 HEIGHT=32>
<P class="Body" style="margin: 0px">ServerFont *GetSystemFixed(void)</P>
</TD>
<TD WIDTH=240 HEIGHT=32>
<P class="Body" style="margin: 0px">bool SetSystemPlain(const char *family, const char *style, float size)</P>
</TD>
</TR>
<TR>
<TD WIDTH=225 HEIGHT=17>
<P class="Body" style="margin: 0px">void RemoveUnusedFamilies(void)</P>
</TD>
<TD WIDTH=240 HEIGHT=17>
<P class="Body" style="margin: 0px">bool FontsNeedUpdated(void)</P>
</TD>
</TR>
</TABLE>
<P class="Body" style="margin: 0px"><BR>
<BR>
@@ -94,7 +118,6 @@
1) Create access semaphore</P>
<P class="Body" style="margin: 0px">2) Call FT_Init_FreeType()</P>
<P class="Body" style="margin: 0px">3) If no error initializing the FreeType library, set init flag to true</P>
<P class="Body" style="margin: 0px">4) Call ScanDirectory() on /boot/beos/etc/fonts/psfonts, .../ttfonts, ~/config/fonts/psfonts and .../ttfonts</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">~FontServer(void)</span></P>
@@ -108,25 +131,43 @@
These functions simply acquire and release the internal access semaphore.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">FT_Library GetLibrary(void)</span></P>
<span class="OBOS-Function-Def">void SaveList(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Returns the internal FT_Library object</P>
Saves the list of all scanned and valid font families and styles to disk</P>
<P class="Body" style="margin: 0px"><BR>
1) create a BMessage for storing font family data (hereafter, the font message)</P>
<P class="Body" style="margin: 0px">2) create a BMessage for storing a list of font family messages (hereafter, the list message)</P>
<P class="Body" style="margin: 0px">3) create a boolean tuned flag and a boolean fixed flag</P>
<P class="Body" style="margin: 0px">4) Iterate through all families</P>
<P class="Body" style="margin: 0px"> A) for each family, get its name and add its name to the font message as "name"</P>
<P class="Body" style="margin: 0px"> B) iterate through the families styles</P>
<P class="Body" style="margin: 0px"> a) get the style's name, and if valid, add it to the font message as "styles"</P>
<P class="Body" style="margin: 0px"> b) if IsTuned and IsScalable, set the tuned flag to true</P>
<P class="Body" style="margin: 0px"> c) if IsFixedWidth, set the fixed flag to true</P>
<P class="Body" style="margin: 0px"> C) if the tuned flag is set, add a boolean true to the font message as "tuned"</P>
<P class="Body" style="margin: 0px"> D) if the fixed flag is set, add a boolean true to the font message as "fixed"</P>
<P class="Body" style="margin: 0px"> E) add the font message to the list message as "family"</P>
<P class="Body" style="margin: 0px"> F) empty the font message</P>
<P class="Body" style="margin: 0px">5) Create a BFile from the path definition SERVER_FONT_LIST for Read/Write, creating the file if nonexistent and erasing any existing one</P>
<P class="Body" style="margin: 0px">6) Flatten the list message to the created BFile object</P>
<P class="Body" style="margin: 0px">7) Set the needs_update flag to false</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void ScanDirectory(const char *path)</span></P>
<span class="OBOS-Function-Def">status_t ScanDirectory(const char *path)</span></P>
<P class="Body" style="margin: 0px"><BR>
ScanDirectory is where the brunt of the work of the FontServer is done - scans the directory of all fonts which can be loaded.</P>
<P class="Body" style="margin: 0px"><BR>
1) Iterate through the font family STL map and set each FontFamily object's Delete flag to true</P>
1) Make a BDirectory object pointer at the path parameter. If the init code is not B_OK, return it.</P>
<P class="Body" style="margin: 0px">2) Enter a while() loop, iterating through each entry in the given directory, executing as follows:</P>
<P class="Body" style="margin: 0px"> a) Ensure that the entry is not '.' or '..'</P>
<P class="Body" style="margin: 0px"> b) Call FT_New_Face on the entry's full path</P>
<P class="Body" style="margin: 0px"> c) If a valid FT_Face is returned, iterate through to see if there are any supported character mappings in the current entry.</P>
<P class="Body" style="margin: 0px"> d) If there are no supported character mappings, dump the supported mappings to debug output, call FT_Done_Face(), and continue to the next entry</P>
<P class="Body" style="margin: 0px"> e) See if the entry's family has been added to the family list. If it hasn't, create one and add it.</P>
<P class="Body" style="margin: 0px"> f) Check to see if the font's style has been added to its family. If so, call set the family's Delete flag to false, call FT_Done_Face, and continue to the next entry</P>
<P class="Body" style="margin: 0px"> f) Check to see if the font's style has been added to its family. If so, call FT_Done_Face, and continue to the next entry</P>
<P class="Body" style="margin: 0px"> g) If the style has not been added, create a new SFont for that family and face, increment the font count, and continue to the next entry.</P>
<P class="Body" style="margin: 0px">3) Iterate through all styles in each family and delete all SFont objects which have a true Delete flag</P>
<P class="Body" style="margin: 0px">3) set the needs_update flag to true</P>
<P class="Body" style="margin: 0px">4) Return B_OK</P>
<P class="Body" style="margin: 0px"><BR>
Supported character mappings are Windows and Apple Unicode, Windows symbol, and Apple Roman character mappings, in order of preference from first to last.</P>
<P class="Body" style="margin: 0px"><BR>
@@ -148,22 +189,19 @@ Returns a usable instance of a specified font object with specified properties.<
<P class="Body" style="margin: 0px">2) Assuming that the FontStyle object is non-NULL, it calls its GetInstance method and returns the result.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">int32 CountFontFamilies(void)</span></P>
<span class="OBOS-Function-Def">int32 CountFamilies(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Returns the number of valid font families available to the system.</P>
<P class="Body" style="margin: 0px"><BR>
1) Return the number of items in the family list</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">status_t GetFamily(int32 index, font_family family)</span></P>
<span class="OBOS-Function-Def">status_t IsInitialized(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Gets the name of the family with the index passed to the function and sets the font_family object to the appropriate value.</P>
<P class="Body" style="margin: 0px"><BR>
1) If index &gt; family list count, return B_ERROR</P>
<P class="Body" style="margin: 0px">2) Look up the string at the index, copy it, and return B_OK</P>
Returns the initialization status variable</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">int32 CountFontStyles(font_family family)</span></P>
<span class="OBOS-Function-Def">int32 CountStyles(font_family family)</span></P>
<P class="Body" style="margin: 0px"><BR>
Returns the number of styles available for a given font family.</P>
<P class="Body" style="margin: 0px"><BR>
@@ -171,21 +209,20 @@ Returns the number of styles available for a given font family.</P>
<P class="Body" style="margin: 0px">2) If non-NULL, call its return the result of its CountStyles method</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">status_t GetStyle(font_family family, font_style style, int32 *flags)</span></P>
<span class="OBOS-Function-Def">FontStyle *GetStyle(font_family family, font_style style)</span></P>
<P class="Body" style="margin: 0px"><BR>
Gets the name of the family with the index passed to the function and sets the font_family object to the appropriate value.</P>
Gets the FontStyle object of the family, style, and flags.</P>
<P class="Body" style="margin: 0px"><BR>
1) Call _FindFamily() to get the appropriate font family</P>
<P class="Body" style="margin: 0px">2) If non-NULL, look up the string at the index, and copy it to the passed style object, otherwise, return B_ERROR</P>
<P class="Body" style="margin: 0px">3) Get the style's FontStyle object and set flags to the flags contained in the FontStyle object</P>
<P class="Body" style="margin: 0px">4) Return B_OK</P>
<P class="Body" style="margin: 0px">2) If non-NULL, call the family's GetStyle method on the font_style parameter and return the result</P>
<P class="Body" style="margin: 0px">3) If family is NULL, return NULL</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void RemoveFamily(FontFamily *family)</span></P>
<span class="OBOS-Function-Def">void RemoveFamily(const char *family)</span></P>
<P class="Body" style="margin: 0px"><BR>
Removes a font family from the family list</P>
<P class="Body" style="margin: 0px"><BR>
1) Look up font family in the family list</P>
1) Look up font family in the family list via _FindFamily()</P>
<P class="Body" style="margin: 0px">2) If it exists, delete it</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
@@ -197,6 +234,39 @@ Looks up a FontFamily object based on its family name. Returns NULL if not found
<P class="Body" style="margin: 0px"><BR>
1) Call the family list's find() method.</P>
<P class="Body" style="margin: 0px">2) Return the appropriate FontFamily object or NULL if not found.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">ServerFont *GetSystemPlain(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">ServerFont *GetSystemBold(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">ServerFont *GetSystemFixed(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
These return a copy of a pointer to the system-wide ServerFont objects which represent the appropriate system font settings. It is the responsibility of the caller to delete the object returned. NULL is returned if no setting has been set for a particular system font.</P>
<P class="Body" style="margin: 0px"><BR>
<span class="OBOS-Function-Def">bool SetSystemPlain(const char *family, const char *style, float size)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">bool SetSystemBold(const char *family, const char *style, float size)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">bool SetSystemFixed(const char *family, const char *style, float size)</span></P>
<P class="Body" style="margin: 0px"><BR>
The system fonts settings may be set via these calls by specifying the family, style, and size. They return true if everything worked out ok and false if not. Settings are not changed if false is returned.</P>
<P class="Body" style="margin: 0px"><BR>
1) Call _FindFamily on the family parameter. if NULL, return false</P>
<P class="Body" style="margin: 0px">2) Call the family's GetStyle member. if NULL, return false</P>
<P class="Body" style="margin: 0px">3) if the appropriate system font pointer is non-NULL, delete it</P>
<P class="Body" style="margin: 0px">4) call the style's Instantiate member with the size parameter</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void RemoveUnusedFamilies(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
The purpose of this function is to allow for a complete rescan of the fonts in the appropriate directories.</P>
<P class="Body" style="margin: 0px"><BR>
1) Iterate through the family list</P>
<P class="Body" style="margin: 0px"> A) Get a family</P>
<P class="Body" style="margin: 0px"> B) if it has no dependents, remove it from the list and delete it</P>
<P class="Body" style="margin: 0px">2) Set the needs_update flag to true</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">bool FontsNeedUpdated(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Returns the value of the needs_update flag</P>
<DIV class="layer" id="Layer 1">
</DIV>
</DIV>