Style updates and remove docs from cpp file

This commit is contained in:
John Scipione
2013-01-19 13:17:46 -05:00
parent 058f84c3e1
commit 1f7ff051a7
+51 -123
View File
@@ -384,16 +384,9 @@ status_t set_font_cache_info(uint32 id, void *set)
} }
/*! // Private function used to replace the R5 hack which sets a system font
\brief Private function used to replace the R5 hack which sets a system font // R5 used a global area offset table to set the system fonts in the Font
\param which string denoting which font to set // preferences panel. Bleah.
\param family the new family for the system font
\param style the new style for the system font
\param size the size for the system font to have
R5 used a global area offset table to set the system fonts in the Font
preferences panel. Bleah.
*/
void void
_set_system_font_(const char *which, font_family family, font_style style, _set_system_font_(const char *which, font_family family, font_style style,
float size) float size)
@@ -430,10 +423,7 @@ _get_system_default_font_(const char* which, font_family family,
} }
/*! // Returns the number of installed font families
\brief Returns the number of installed font families
\return The number of installed font families
*/
int32 int32
count_font_families() count_font_families()
{ {
@@ -441,10 +431,7 @@ count_font_families()
} }
/*! // Returns the number of styles available for a font family
\brief Returns the number of styles available for a font family
\return The number of styles available for a font family
*/
int32 int32
count_font_styles(font_family family) count_font_styles(font_family family)
{ {
@@ -452,14 +439,7 @@ count_font_styles(font_family family)
} }
/*! // Retrieves the family name at the specified index
\brief Retrieves the family name at the specified index
\param index Unique font identifier code.
\param name font_family string to receive the name of the family
\param flags if non-NULL, the values of the flags IS_FIXED and
B_HAS_TUNED_FONT are returned
\return B_ERROR if the index does not correspond to a font family
*/
status_t status_t
get_font_family(int32 index, font_family *_name, uint32 *_flags) get_font_family(int32 index, font_family *_name, uint32 *_flags)
{ {
@@ -470,14 +450,7 @@ get_font_family(int32 index, font_family *_name, uint32 *_flags)
} }
/*! // Retrieves the family name at the specified index
\brief Retrieves the family name at the specified index
\param index Unique font identifier code.
\param name font_family string to receive the name of the family
\param flags if non-NULL, the values of the flags IS_FIXED and
B_HAS_TUNED_FONT are returned
\return B_ERROR if the index does not correspond to a font style
*/
status_t status_t
get_font_style(font_family family, int32 index, font_style *_name, get_font_style(font_family family, int32 index, font_style *_name,
uint32 *_flags) uint32 *_flags)
@@ -486,19 +459,10 @@ get_font_style(font_family family, int32 index, font_style *_name,
} }
/*! // Retrieves the family name at the specified index
\brief Retrieves the family name at the specified index // The face value returned by this function is not very reliable. At the same
\param index Unique font identifier code. // time, the value returned should be fairly reliable, returning the proper
\param name font_family string to receive the name of the family // flag for 90%-99% of font names.
\param face recipient of font face value, such as B_REGULAR_FACE
\param flags if non-NULL, the values of the flags IS_FIXED and
B_HAS_TUNED_FONT are returned
\return B_ERROR if the index does not correspond to a font style
The face value returned by this function is not very reliable. At the same
time, the value returned should be fairly reliable, returning the proper
flag for 90%-99% of font names.
*/
status_t status_t
get_font_style(font_family family, int32 index, font_style *_name, get_font_style(font_family family, int32 index, font_style *_name,
uint16 *_face, uint32 *_flags) uint16 *_face, uint32 *_flags)
@@ -510,11 +474,7 @@ get_font_style(font_family family, int32 index, font_style *_name,
} }
/*! // Updates the font family list
\brief Updates the font family list
\param checkOnly is ignored
\return true if the font list has changed, false if not.
*/
bool bool
update_font_families(bool /*checkOnly*/) update_font_families(bool /*checkOnly*/)
{ {
@@ -558,19 +518,14 @@ BFont::BFont(const BFont &font)
BFont::BFont(const BFont *font) BFont::BFont(const BFont *font)
{ {
if (font) if (font != NULL)
*this = *font; *this = *font;
else else
*this = *be_plain_font; *this = *be_plain_font;
} }
/*! // Sets the font's family and style all at once
\brief Sets the font's family and style all at once
\param family Font family to set
\param style Font style to set
\return B_NAME_NOT_FOUND if family or style do not exist.
*/
status_t status_t
BFont::SetFamilyAndStyle(const font_family family, const font_style style) BFont::SetFamilyAndStyle(const font_family family, const font_style style)
{ {
@@ -587,8 +542,7 @@ BFont::SetFamilyAndStyle(const font_family family, const font_style style)
link.Attach<uint16>(fFace); link.Attach<uint16>(fFace);
int32 status = B_ERROR; int32 status = B_ERROR;
if (link.FlushWithReply(status) != B_OK if (link.FlushWithReply(status) != B_OK || status != B_OK)
|| status != B_OK)
return status; return status;
link.Read<uint16>(&fFamilyID); link.Read<uint16>(&fFamilyID);
@@ -601,10 +555,7 @@ BFont::SetFamilyAndStyle(const font_family family, const font_style style)
} }
/*! // Sets the font's family and style all at once
\brief Sets the font's family and style all at once
\param code Unique font identifier obtained from the server.
*/
void void
BFont::SetFamilyAndStyle(uint32 fontcode) BFont::SetFamilyAndStyle(uint32 fontcode)
{ {
@@ -627,8 +578,7 @@ BFont::SetFamilyAndStyle(uint32 fontcode)
link.Attach<uint16>(fFace); link.Attach<uint16>(fFace);
int32 code; int32 code;
if (link.FlushWithReply(code) != B_OK if (link.FlushWithReply(code) != B_OK || code != B_OK)
|| code != B_OK)
return; return;
link.Read<uint16>(&fFamilyID); link.Read<uint16>(&fFamilyID);
@@ -639,17 +589,11 @@ BFont::SetFamilyAndStyle(uint32 fontcode)
} }
/*! // Sets the font's family and face all at once
\brief Sets the font's family and face all at once // To comply with the BeBook, this function will only set valid values - i.e.
\param family Font family to set // passing a nonexistent family will cause only the face to be set.
\param face Font face to set. // Additionally, if a particular face does not exist in a family, the closest
\return B_ERROR if family does not exists or face is an invalid value. // match will be chosen.
To comply with the BeBook, this function will only set valid values - i.e.
passing a nonexistent family will cause only the face to be set.
Additionally, if a particular face does not exist in a family, the closest
match will be chosen.
*/
status_t status_t
BFont::SetFamilyAndFace(const font_family family, uint16 face) BFont::SetFamilyAndFace(const font_family family, uint16 face)
{ {
@@ -662,8 +606,7 @@ BFont::SetFamilyAndFace(const font_family family, uint16 face)
link.Attach<uint16>(face); link.Attach<uint16>(face);
int32 status = B_ERROR; int32 status = B_ERROR;
if (link.FlushWithReply(status) != B_OK if (link.FlushWithReply(status) != B_OK || status != B_OK)
|| status != B_OK)
return status; return status;
link.Read<uint16>(&fFamilyID); link.Read<uint16>(&fFamilyID);
@@ -760,8 +703,7 @@ BFont::GetFamilyAndStyle(font_family *family, font_style *style) const
link.Attach<uint16>(fStyleID); link.Attach<uint16>(fStyleID);
int32 code; int32 code;
if (link.FlushWithReply(code) != B_OK if (link.FlushWithReply(code) != B_OK || code != B_OK) {
|| code != B_OK) {
// the least we can do is to clear the buffers // the least we can do is to clear the buffers
memset(*family, 0, sizeof(font_family)); memset(*family, 0, sizeof(font_family));
memset(*style, 0, sizeof(font_style)); memset(*style, 0, sizeof(font_style));
@@ -852,13 +794,10 @@ BFont::IsFixed() const
} }
/*! // Returns whether or not the font is fixed-width and contains both
\brief Returns true if the font is fixed-width and contains both full // full and half-width characters.
and half-width characters // This was left unimplemented as of R5. It is a way to work with both
// Kanji and Roman characters in the same fixed-width font.
This was left unimplemented as of R5. It was a way to work with both
Kanji and Roman characters in the same fixed-width font.
*/
bool bool
BFont::IsFullAndHalfFixed() const BFont::IsFullAndHalfFixed() const
{ {
@@ -938,7 +877,7 @@ BFont::CountTuned() const
void void
BFont::GetTunedInfo(int32 index, tuned_font_info *info) const BFont::GetTunedInfo(int32 index, tuned_font_info *info) const
{ {
if (!info) if (info == NULL)
return; return;
BPrivate::AppServerLink link; BPrivate::AppServerLink link;
@@ -948,8 +887,7 @@ BFont::GetTunedInfo(int32 index, tuned_font_info *info) const
link.Attach<uint32>(index); link.Attach<uint32>(index);
int32 code; int32 code;
if (link.FlushWithReply(code) != B_OK if (link.FlushWithReply(code) != B_OK || code != B_OK)
|| code != B_OK)
return; return;
link.Read<tuned_font_info>(info); link.Read<tuned_font_info>(info);
@@ -1013,7 +951,7 @@ BFont::GetTruncatedStrings(const char *stringArray[], int32 numStrings,
float float
BFont::StringWidth(const char *string) const BFont::StringWidth(const char *string) const
{ {
if (!string) if (string == NULL)
return 0.0; return 0.0;
int32 length = strlen(string); int32 length = strlen(string);
@@ -1041,8 +979,10 @@ void
BFont::GetStringWidths(const char *stringArray[], const int32 lengthArray[], BFont::GetStringWidths(const char *stringArray[], const int32 lengthArray[],
int32 numStrings, float widthArray[]) const int32 numStrings, float widthArray[]) const
{ {
if (!stringArray || !lengthArray || numStrings < 1 || !widthArray) if (stringArray == NULL || lengthArray == NULL || numStrings < 1
|| widthArray == NULL) {
return; return;
}
BPrivate::AppServerLink link; BPrivate::AppServerLink link;
link.StartMessage(AS_GET_STRING_WIDTHS); link.StartMessage(AS_GET_STRING_WIDTHS);
@@ -1055,13 +995,11 @@ BFont::GetStringWidths(const char *stringArray[], const int32 lengthArray[],
// TODO: all strings into a single array??? // TODO: all strings into a single array???
// we do have a maximum message length, and it could be easily touched // we do have a maximum message length, and it could be easily touched
// here... // here...
for (int32 i = 0; i < numStrings; i++) { for (int32 i = 0; i < numStrings; i++)
link.AttachString(stringArray[i], lengthArray[i]); link.AttachString(stringArray[i], lengthArray[i]);
}
status_t status; status_t status;
if (link.FlushWithReply(status) != B_OK if (link.FlushWithReply(status) != B_OK || status != B_OK)
|| status != B_OK)
return; return;
link.Read(widthArray, sizeof(float) * numStrings); link.Read(widthArray, sizeof(float) * numStrings);
@@ -1102,8 +1040,7 @@ BFont::GetEscapements(const char charArray[], int32 numChars,
link.Attach(charArray, bytesInBuffer); link.Attach(charArray, bytesInBuffer);
int32 code; int32 code;
if (link.FlushWithReply(code) != B_OK if (link.FlushWithReply(code) != B_OK || code != B_OK)
|| code != B_OK)
return; return;
link.Read(escapementArray, numChars * sizeof(float)); link.Read(escapementArray, numChars * sizeof(float));
@@ -1146,8 +1083,7 @@ BFont::GetEscapements(const char charArray[], int32 numChars,
link.Attach(charArray, bytesInBuffer); link.Attach(charArray, bytesInBuffer);
int32 code; int32 code;
if (link.FlushWithReply(code) != B_OK if (link.FlushWithReply(code) != B_OK || code != B_OK)
|| code != B_OK)
return; return;
link.Read(escapementArray, sizeof(BPoint) * numChars); link.Read(escapementArray, sizeof(BPoint) * numChars);
@@ -1175,8 +1111,7 @@ BFont::GetEdges(const char charArray[], int32 numChars,
link.Attach<int32>(bytesInBuffer); link.Attach<int32>(bytesInBuffer);
link.Attach(charArray, bytesInBuffer); link.Attach(charArray, bytesInBuffer);
if (link.FlushWithReply(code) != B_OK if (link.FlushWithReply(code) != B_OK || code != B_OK)
|| code != B_OK)
return; return;
link.Read(edgeArray, sizeof(edge_info) * numChars); link.Read(edgeArray, sizeof(edge_info) * numChars);
@@ -1199,8 +1134,7 @@ BFont::GetHeight(font_height *_height) const
link.Attach<float>(fSize); link.Attach<float>(fSize);
int32 code; int32 code;
if (link.FlushWithReply(code) != B_OK if (link.FlushWithReply(code) != B_OK || code != B_OK)
|| code != B_OK)
return; return;
// Who put that "const" to this method? :-) // Who put that "const" to this method? :-)
@@ -1217,8 +1151,8 @@ void
BFont::GetBoundingBoxesAsGlyphs(const char charArray[], int32 numChars, BFont::GetBoundingBoxesAsGlyphs(const char charArray[], int32 numChars,
font_metric_mode mode, BRect boundingBoxArray[]) const font_metric_mode mode, BRect boundingBoxArray[]) const
{ {
_GetBoundingBoxes(charArray, numChars, mode, false, NULL, boundingBoxArray, _GetBoundingBoxes(charArray, numChars, mode, false, NULL,
false); boundingBoxArray, false);
} }
@@ -1227,8 +1161,8 @@ BFont::GetBoundingBoxesAsString(const char charArray[], int32 numChars,
font_metric_mode mode, escapement_delta *delta, font_metric_mode mode, escapement_delta *delta,
BRect boundingBoxArray[]) const BRect boundingBoxArray[]) const
{ {
_GetBoundingBoxes(charArray, numChars, mode, true, delta, boundingBoxArray, _GetBoundingBoxes(charArray, numChars, mode, true, delta,
true); boundingBoxArray, true);
} }
@@ -1237,7 +1171,7 @@ BFont::_GetBoundingBoxes(const char charArray[], int32 numChars,
font_metric_mode mode, bool string_escapement, escapement_delta *delta, font_metric_mode mode, bool string_escapement, escapement_delta *delta,
BRect boundingBoxArray[], bool asString) const BRect boundingBoxArray[], bool asString) const
{ {
if (!charArray || numChars < 1 || !boundingBoxArray) if (charArray == NULL || numChars < 1 || boundingBoxArray == NULL)
return; return;
int32 code; int32 code;
@@ -1257,7 +1191,7 @@ BFont::_GetBoundingBoxes(const char charArray[], int32 numChars,
link.Attach<font_metric_mode>(mode); link.Attach<font_metric_mode>(mode);
link.Attach<bool>(string_escapement); link.Attach<bool>(string_escapement);
if (delta) { if (delta != NULL) {
link.Attach<escapement_delta>(*delta); link.Attach<escapement_delta>(*delta);
} else { } else {
escapement_delta emptyDelta = {0, 0}; escapement_delta emptyDelta = {0, 0};
@@ -1269,8 +1203,7 @@ BFont::_GetBoundingBoxes(const char charArray[], int32 numChars,
link.Attach<int32>(bytesInBuffer); link.Attach<int32>(bytesInBuffer);
link.Attach(charArray, bytesInBuffer); link.Attach(charArray, bytesInBuffer);
if (link.FlushWithReply(code) != B_OK if (link.FlushWithReply(code) != B_OK || code != B_OK)
|| code != B_OK)
return; return;
link.Read(boundingBoxArray, sizeof(BRect) * numChars); link.Read(boundingBoxArray, sizeof(BRect) * numChars);
@@ -1314,8 +1247,7 @@ BFont::GetBoundingBoxesForStrings(const char *stringArray[], int32 numStrings,
} }
} }
if (link.FlushWithReply(code) != B_OK if (link.FlushWithReply(code) != B_OK || code != B_OK)
|| code != B_OK)
return; return;
link.Read(boundingBoxArray, sizeof(BRect) * numStrings); link.Read(boundingBoxArray, sizeof(BRect) * numStrings);
@@ -1348,8 +1280,7 @@ BFont::GetGlyphShapes(const char charArray[], int32 numChars,
link.Attach<int32>(bytesInBuffer); link.Attach<int32>(bytesInBuffer);
link.Attach(charArray, bytesInBuffer); link.Attach(charArray, bytesInBuffer);
if (link.FlushWithReply(code) != B_OK if (link.FlushWithReply(code) != B_OK || code != B_OK)
|| code != B_OK)
return; return;
for (int32 i = 0; i < numChars; i++) for (int32 i = 0; i < numChars; i++)
@@ -1376,8 +1307,7 @@ BFont::GetHasGlyphs(const char charArray[], int32 numChars,
link.Attach<int32>(bytesInBuffer); link.Attach<int32>(bytesInBuffer);
link.Attach(charArray, bytesInBuffer); link.Attach(charArray, bytesInBuffer);
if (link.FlushWithReply(code) != B_OK if (link.FlushWithReply(code) != B_OK || code != B_OK)
|| code != B_OK)
return; return;
link.Read(hasArray, sizeof(bool) * numChars); link.Read(hasArray, sizeof(bool) * numChars);
@@ -1461,8 +1391,7 @@ BFont::_GetExtraFlags() const
link.Attach<uint16>(fStyleID); link.Attach<uint16>(fStyleID);
status_t status = B_ERROR; status_t status = B_ERROR;
if (link.FlushWithReply(status) != B_OK if (link.FlushWithReply(status) != B_OK || status != B_OK) {
|| status != B_OK) {
// use defaut values for the flags // use defaut values for the flags
fExtraFlags = (uint32)B_FONT_LEFT_TO_RIGHT fExtraFlags = (uint32)B_FONT_LEFT_TO_RIGHT
<< B_PRIVATE_FONT_DIRECTION_SHIFT; << B_PRIVATE_FONT_DIRECTION_SHIFT;
@@ -1471,4 +1400,3 @@ BFont::_GetExtraFlags() const
link.Read<uint32>(&fExtraFlags); link.Read<uint32>(&fExtraFlags);
} }