More work on the BFont special functions.

* Reworked functions like GetEscapements(), GetBoundingBoxesAsString() and GetGlyphShapes() completely
* Made the ServerFont functions uniform in their prototypes and cleaned out unnecessary arguments
* Added new UTF8 handling functions to moreUTF8.h that are now used by ServerFont
* Put the common transformations of the FT_Face into an own GetTransformedFace() to lessen code duplication

In other words, ServerFont is now cleaned and handles UTF8 pretty efficiently. Some ToDo's are still left though.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16241 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2006-02-05 23:36:59 +00:00
parent 2bdbc03a1d
commit db5734a452
5 changed files with 384 additions and 347 deletions
+10 -16
View File
@@ -1048,10 +1048,9 @@ BFont::GetEscapements(const char charArray[], int32 numChars, escapement_delta *
link.Attach<float>(delta ? delta->nonspace : 0.0);
link.Attach<float>(delta ? delta->space : 0.0);
// TODO: Should we not worry about the port capacity here?!?
link.Attach<int32>(numChars);
// TODO: Should we not worry about the port capacity here?!?
uint32 bytesInBuffer = UTF8CountBytes(charArray, numChars);
link.Attach<int32>(bytesInBuffer);
link.Attach(charArray, bytesInBuffer);
@@ -1088,22 +1087,15 @@ BFont::GetEscapements(const char charArray[], int32 numChars, escapement_delta *
link.Attach<float>(fRotation);
link.Attach<uint32>(fFlags);
link.Attach<float>(delta ? delta->nonspace : 0.0);
link.Attach<float>(delta ? delta->space : 0.0);
link.Attach<bool>(offsetArray != NULL);
link.Attach<int32>(numChars);
// TODO: Support UTF8 characters
if (offsetArray) {
for (int32 i = 0; i < numChars; i++) {
link.Attach<char>(charArray[i]);
link.Attach<BPoint>(offsetArray[i]);
}
} else {
BPoint dummypt(0, 0);
for (int32 i = 0; i < numChars; i++) {
link.Attach<char>(charArray[i]);
link.Attach<BPoint>(dummypt);
}
}
// TODO: Should we not worry about the port capacity here?!?
uint32 bytesInBuffer = UTF8CountBytes(charArray, numChars);
link.Attach<int32>(bytesInBuffer);
link.Attach(charArray, bytesInBuffer);
int32 code;
if (link.FlushWithReply(code) != B_OK
@@ -1111,6 +1103,8 @@ BFont::GetEscapements(const char charArray[], int32 numChars, escapement_delta *
return;
link.Read(escapementArray, sizeof(BPoint) * numChars);
if (offsetArray)
link.Read(offsetArray, sizeof(BPoint) * numChars);
}