Implemented GetHasGlyphs support somehow (FT support is lacking)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13766 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1bbb0771e4
commit
599be43472
|
@ -133,6 +133,9 @@ class ServerFont {
|
|||
BShape** GetGlyphShapes(const char charArray[],
|
||||
int32 numChars) const;
|
||||
|
||||
void GetHasGlyphs(const char charArray[],
|
||||
int32 numChars, bool hasArray[]) const;
|
||||
|
||||
BPoint* GetEscapements(const char charArray[],
|
||||
int32 numChars,
|
||||
BPoint offsetArray[]) const;
|
||||
|
|
|
@ -1171,6 +1171,8 @@ BFont::GetHasGlyphs(const char charArray[], int32 numChars, bool hasArray[]) con
|
|||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_HAS_GLYPHS);
|
||||
link.Attach<uint16>(fFamilyID);
|
||||
link.Attach<uint16>(fStyleID);
|
||||
link.Attach<int32>(numChars);
|
||||
link.Attach(charArray, numChars);
|
||||
|
||||
|
|
|
@ -1786,6 +1786,34 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||
fLink.Flush();
|
||||
break;
|
||||
}
|
||||
case AS_GET_HAS_GLYPHS:
|
||||
{
|
||||
FTRACE(("ServerApp %s: AS_GET_HAS_GLYPHS\n", Signature()));
|
||||
// Attached Data:
|
||||
// 1) uint16 - family ID
|
||||
// 2) uint16 - style ID
|
||||
// 3) int32 - numChars
|
||||
// 4) char - chars (numChars times)
|
||||
|
||||
uint16 famid, styid;
|
||||
link.Read<uint16>(&famid);
|
||||
link.Read<uint16>(&styid);
|
||||
int32 numChars;
|
||||
link.Read<int32>(&numChars);
|
||||
char charArray[numChars];
|
||||
link.Read(&charArray, numChars);
|
||||
|
||||
ServerFont font;
|
||||
if (font.SetFamilyAndStyle(famid, styid) == B_OK) {
|
||||
bool hasArray[numChars];
|
||||
font.GetHasGlyphs(charArray, numChars, hasArray);
|
||||
fLink.StartMessage(SERVER_TRUE);
|
||||
fLink.Attach(hasArray, sizeof(hasArray));
|
||||
} else
|
||||
fLink.StartMessage(SERVER_FALSE);
|
||||
fLink.Flush();
|
||||
break;
|
||||
}
|
||||
case AS_GET_ESCAPEMENTS:
|
||||
{
|
||||
FTRACE(("ServerApp %s: AS_GET_ESCAPEMENTS\n", Signature()));
|
||||
|
|
|
@ -322,6 +322,7 @@ ServerFont::GetGlyphShapes(const char charArray[], int32 numChars) const
|
|||
for (int i = 0; i < numChars; i++) {
|
||||
shapes[i] = new BShape();
|
||||
shapes[i]->Clear();
|
||||
// TODO : this is wrong (the nth char isn't charArray[i])
|
||||
FT_Load_Char(face, charArray[i], FT_LOAD_NO_BITMAP);
|
||||
FT_Outline outline = face->glyph->outline;
|
||||
FT_Outline_Decompose(&outline, &funcs, shapes[i]);
|
||||
|
@ -331,6 +332,21 @@ ServerFont::GetGlyphShapes(const char charArray[], int32 numChars) const
|
|||
return shapes;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ServerFont::GetHasGlyphs(const char charArray[], int32 numChars, bool hasArray[]) const
|
||||
{
|
||||
if (!fStyle || !charArray || numChars <= 0 || !hasArray)
|
||||
return;
|
||||
|
||||
// TODO : implement for real
|
||||
|
||||
for (int i = 0; i < numChars; i++) {
|
||||
hasArray[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// GetEscapements
|
||||
BPoint*
|
||||
ServerFont::GetEscapements(const char charArray[], int32 numChars,
|
||||
|
@ -374,6 +390,7 @@ ServerFont::GetEscapements(const char charArray[], int32 numChars,
|
|||
// TODO: handle UTF8... see below!!
|
||||
BPoint *escapements = (BPoint *)malloc(sizeof(BPoint) * numChars);
|
||||
for (int i = 0; i < numChars; i++) {
|
||||
// TODO : this is wrong (the nth char isn't charArray[i])
|
||||
FT_Load_Char(face, charArray[i], FT_LOAD_NO_BITMAP);
|
||||
// escapements[i].x = float(face->glyph->metrics.width / 64) / fSize;
|
||||
// escapements[i].y = 0;
|
||||
|
|
Loading…
Reference in New Issue