ServerFont::StringWidth() did not set the size of the face, and could therefore
return wrong results. Activated it again to work-around the possible font deadlock. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14654 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1347,13 +1347,13 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
if (!stringArray[i] || lengthArray[i] <= 0)
|
if (!stringArray[i] || lengthArray[i] <= 0)
|
||||||
widthArray[i] = 0.0;
|
widthArray[i] = 0.0;
|
||||||
else {
|
else {
|
||||||
widthArray[i] = fDesktop->GetDisplayDriver()->StringWidth(stringArray[i], lengthArray[i], font);
|
//widthArray[i] = fDesktop->GetDisplayDriver()->StringWidth(stringArray[i], lengthArray[i], font);
|
||||||
// NOTE: The line below will return the exact same thing. However,
|
// NOTE: The line below will return the exact same thing. However,
|
||||||
// the line above uses the AGG rendering backend, for which glyph caching
|
// the line above uses the AGG rendering backend, for which glyph caching
|
||||||
// actually works. It is about 20 times faster!
|
// actually works. It is about 20 times faster!
|
||||||
// TODO: I've disabled the AGG version for now, as it produces a dead lock
|
// TODO: I've disabled the AGG version for now, as it produces a dead lock
|
||||||
// (font use), that I am currently too lazy to investigate...
|
// (font use), that I am currently too lazy to investigate...
|
||||||
// widthArray[i] = font.StringWidth(stringArray[i], lengthArray[i]);
|
widthArray[i] = font.StringWidth(stringArray[i], lengthArray[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -556,8 +556,9 @@ ServerFont::GetEscapements(const char charArray[], int32 numChars, int32 numByte
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ServerFont::GetBoundingBoxesAsString(const char charArray[], int32 numChars, BRect rectArray[],
|
ServerFont::GetBoundingBoxesAsString(const char charArray[], int32 numChars,
|
||||||
bool string_escapement, font_metric_mode mode, escapement_delta delta)
|
BRect rectArray[], bool string_escapement, font_metric_mode mode,
|
||||||
|
escapement_delta delta)
|
||||||
{
|
{
|
||||||
if (!fStyle || !charArray || numChars <= 0 || !rectArray)
|
if (!fStyle || !charArray || numChars <= 0 || !rectArray)
|
||||||
return false;
|
return false;
|
||||||
@@ -629,7 +630,7 @@ ServerFont::GetBoundingBoxesForStrings(char *charArray[], int32 lengthArray[],
|
|||||||
|
|
||||||
FT_Set_Char_Size(face, 0, int32(fSize * 64), 72, 72);
|
FT_Set_Char_Size(face, 0, int32(fSize * 64), 72, 72);
|
||||||
|
|
||||||
for (int32 i=0; i<numStrings; i++) {
|
for (int32 i = 0; i < numStrings; i++) {
|
||||||
// TODO: ...
|
// TODO: ...
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -650,10 +651,11 @@ ServerFont::StringWidth(const char* string, int32 numBytes) const
|
|||||||
if (!face)
|
if (!face)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
float width = 0.0;
|
FT_Set_Char_Size(face, 0, int32(fSize * 64), 72, 72);
|
||||||
|
|
||||||
int32 convertedLength = numBytes * 2;
|
int32 convertedLength = numBytes * 2;
|
||||||
char* convertedBuffer = new char[convertedLength];
|
char* convertedBuffer = new char[convertedLength];
|
||||||
|
float width = 0.0;
|
||||||
|
|
||||||
int32 state = 0;
|
int32 state = 0;
|
||||||
status_t ret;
|
status_t ret;
|
||||||
@@ -670,7 +672,7 @@ ServerFont::StringWidth(const char* string, int32 numBytes) const
|
|||||||
|
|
||||||
for (int i = 0; i < numChars; i++) {
|
for (int i = 0; i < numChars; i++) {
|
||||||
FT_Load_Char(face, glyphIndex[i], FT_LOAD_NO_BITMAP);
|
FT_Load_Char(face, glyphIndex[i], FT_LOAD_NO_BITMAP);
|
||||||
width += (float)face->glyph->metrics.horiAdvance / 64.0;
|
width += face->glyph->advance.x / 64.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete[] convertedBuffer;
|
delete[] convertedBuffer;
|
||||||
|
|||||||
Reference in New Issue
Block a user