Changed keyboard nav color to match R5 even though we use Dano's attributes
BFont::GetHeight now works properly git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10806 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
9a2b128aea
commit
d86ffbc9c4
@ -159,7 +159,7 @@ printf("Initializing color settings to defaults\n");
|
||||
control_text.SetColor(0,0,0);
|
||||
control_border.SetColor(0,0,0);
|
||||
control_highlight.SetColor(115,120,184);
|
||||
keyboard_navigation_base.SetColor(170,50,184);
|
||||
keyboard_navigation_base.SetColor(0,0,229);
|
||||
keyboard_navigation_pulse.SetColor(0,0,0);
|
||||
shine.SetColor(255,255,255);
|
||||
shadow.SetColor(0,0,0);
|
||||
|
@ -52,6 +52,10 @@ FontStyle::FontStyle(const char *filepath, FT_Face face)
|
||||
fbounds.Set(0,0,0,0);
|
||||
fFace=TranslateStyleToFace(face->style_name);
|
||||
fID=0;
|
||||
fHeight.ascent=face->ascender;
|
||||
fHeight.descent=face->descender;
|
||||
fHeight.leading=face->height;
|
||||
fHeight.units_per_em=face->units_per_EM;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -76,6 +80,21 @@ const char *FontStyle::Name(void) const
|
||||
return fName.String();
|
||||
}
|
||||
|
||||
font_height FontStyle::GetHeight(const float &size)
|
||||
{
|
||||
font_height fh={0,0,0};
|
||||
|
||||
// font units are 26.6 format, so we get REALLY big numbers if
|
||||
// we don't do some shifting.
|
||||
fh.ascent=(fHeight.ascent * size) / fHeight.units_per_em;
|
||||
|
||||
// FT2's descent numbers are negative. Be's is positive
|
||||
fh.descent=(fHeight.descent * size * -1) / fHeight.units_per_em;
|
||||
|
||||
fh.leading=(fHeight.leading * size) / fHeight.units_per_em;
|
||||
return fh;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the path to the style's font file
|
||||
\return The style's font file path
|
||||
|
@ -115,7 +115,7 @@ int32 FontServer::CountFamilies(void)
|
||||
*/
|
||||
int32 FontServer::CountStyles(const char *family)
|
||||
{
|
||||
FontFamily *f=_FindFamily(family);
|
||||
FontFamily *f=GetFamily(family);
|
||||
if(f)
|
||||
{
|
||||
return f->CountStyles();
|
||||
@ -129,7 +129,7 @@ int32 FontServer::CountStyles(const char *family)
|
||||
*/
|
||||
void FontServer::RemoveFamily(const char *family)
|
||||
{
|
||||
FontFamily *f=_FindFamily(family);
|
||||
FontFamily *f=GetFamily(family);
|
||||
if(f)
|
||||
{
|
||||
families->RemoveItem(f);
|
||||
@ -151,7 +151,7 @@ const char *FontServer::GetFamilyName(uint16 id) const
|
||||
|
||||
const char *FontServer::GetStyleName(const char *family, uint16 id) const
|
||||
{
|
||||
FontFamily *fam=_FindFamily(family);
|
||||
FontFamily *fam=GetFamily(family);
|
||||
FontStyle *sty;
|
||||
for(int32 i=0; i<families->CountItems(); i++)
|
||||
{
|
||||
@ -164,7 +164,7 @@ const char *FontServer::GetStyleName(const char *family, uint16 id) const
|
||||
|
||||
FontStyle *FontServer::GetStyle(const char *family, uint16 id) const
|
||||
{
|
||||
FontFamily *fam=_FindFamily(family);
|
||||
FontFamily *fam=GetFamily(family);
|
||||
FontStyle *sty;
|
||||
for(int32 i=0; i<families->CountItems(); i++)
|
||||
{
|
||||
@ -182,7 +182,7 @@ FontStyle *FontServer::GetStyle(const char *family, uint16 id) const
|
||||
|
||||
Do NOT delete the FontFamily returned by this function.
|
||||
*/
|
||||
FontFamily *FontServer::_FindFamily(const char *name) const
|
||||
FontFamily *FontServer::GetFamily(const char *name) const
|
||||
{
|
||||
if(!init)
|
||||
return NULL;
|
||||
@ -258,7 +258,7 @@ status_t FontServer::ScanDirectory(const char *fontspath)
|
||||
|
||||
face->charmap=charmap;
|
||||
|
||||
family=_FindFamily(face->family_name);
|
||||
family=GetFamily(face->family_name);
|
||||
|
||||
if(!family)
|
||||
{
|
||||
@ -280,7 +280,6 @@ status_t FontServer::ScanDirectory(const char *fontspath)
|
||||
printf("\tFont Style: %s\n",face->style_name);
|
||||
#endif
|
||||
|
||||
// Has vertical metrics?
|
||||
style=new FontStyle(path.Path(),face);
|
||||
if(!family->AddStyle(style))
|
||||
delete style;
|
||||
@ -424,7 +423,7 @@ void FontServer::SaveList(void)
|
||||
*/
|
||||
FontStyle *FontServer::GetStyle(const char *family, const char *style)
|
||||
{
|
||||
FontFamily *ffam=_FindFamily(family);
|
||||
FontFamily *ffam=GetFamily(family);
|
||||
|
||||
if(ffam)
|
||||
{
|
||||
@ -443,10 +442,16 @@ FontStyle *FontServer::GetStyle(const char *family, const char *style)
|
||||
FontStyle *FontServer::GetStyle(const uint16 &familyid, const uint16 &styleid)
|
||||
{
|
||||
// TODO: Implement FontServer::GetStyle(id,id)
|
||||
FontFamily *fam=GetFamily(familyid);
|
||||
if(fam)
|
||||
{
|
||||
FontStyle *sty=fam->GetStyle(styleid);
|
||||
return sty;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FontFamily *FontServer::GetFamily(const uint16 &familyid)
|
||||
FontFamily *FontServer::GetFamily(const uint16 &familyid) const
|
||||
{
|
||||
for(int32 i=0; i<families->CountItems(); i++)
|
||||
{
|
||||
@ -515,7 +520,7 @@ ServerFont *FontServer::GetSystemFixed(void)
|
||||
*/
|
||||
bool FontServer::SetSystemPlain(const char *family, const char *style, float size)
|
||||
{
|
||||
FontFamily *fam=_FindFamily(family);
|
||||
FontFamily *fam=GetFamily(family);
|
||||
if(!fam)
|
||||
return false;
|
||||
FontStyle *sty=fam->GetStyle(style);
|
||||
@ -539,7 +544,7 @@ bool FontServer::SetSystemPlain(const char *family, const char *style, float siz
|
||||
*/
|
||||
bool FontServer::SetSystemBold(const char *family, const char *style, float size)
|
||||
{
|
||||
FontFamily *fam=_FindFamily(family);
|
||||
FontFamily *fam=GetFamily(family);
|
||||
if(!fam)
|
||||
return false;
|
||||
FontStyle *sty=fam->GetStyle(style);
|
||||
@ -563,7 +568,7 @@ bool FontServer::SetSystemBold(const char *family, const char *style, float size
|
||||
*/
|
||||
bool FontServer::SetSystemFixed(const char *family, const char *style, float size)
|
||||
{
|
||||
FontFamily *fam=_FindFamily(family);
|
||||
FontFamily *fam=GetFamily(family);
|
||||
if(!fam)
|
||||
return false;
|
||||
FontStyle *sty=fam->GetStyle(style);
|
||||
|
@ -192,6 +192,6 @@ void LayerData::PrintToStream() const{
|
||||
printf("\t FontRotation: %f\n", font.Rotation());
|
||||
printf("\t FontSpacing: %ld\n", font.Spacing());
|
||||
printf("\t FontEncoding: %ld\n", font.Encoding());
|
||||
printf("\t FontFace: %ld\n", font.Face());
|
||||
printf("\t FontFace: %d\n", font.Face());
|
||||
printf("\t FontFlags: %lu\n", font.Flags());
|
||||
}
|
||||
|
@ -1232,60 +1232,204 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
case AS_COUNT_FONT_FAMILIES:
|
||||
{
|
||||
// Attached Data:
|
||||
// None
|
||||
// 1) port_id - reply port
|
||||
|
||||
// Returns:
|
||||
// 1) int32 - # of font families
|
||||
port_id replyport=-1;
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
fontserver->Lock();
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<int32>(fontserver->CountFamilies());
|
||||
replylink.Flush();
|
||||
fontserver->Unlock();
|
||||
|
||||
break;
|
||||
}
|
||||
case AS_COUNT_FONT_STYLES:
|
||||
{
|
||||
// Attached Data:
|
||||
// 1) font_family - name of font family
|
||||
// 2) port_id - reply port
|
||||
|
||||
// Returns:
|
||||
// 1) int32 - # of font styles
|
||||
port_id replyport;
|
||||
font_family fam;
|
||||
|
||||
msg.Read(fam,sizeof(font_family));
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
|
||||
fontserver->Lock();
|
||||
FontFamily *ffam=fontserver->GetFamily(fam);
|
||||
if(ffam)
|
||||
{
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<int32>(ffam->CountStyles());
|
||||
replylink.Flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
}
|
||||
|
||||
fontserver->Unlock();
|
||||
break;
|
||||
}
|
||||
case AS_SET_SYSFONT_PLAIN:
|
||||
{
|
||||
// Attached Data:
|
||||
// None
|
||||
// port_id reply port
|
||||
|
||||
// Returns:
|
||||
// 1) uint16 - family ID
|
||||
// 2) uint16 - style ID
|
||||
// 3) float - size in points
|
||||
// 4) uint16 - face flags
|
||||
// 5) font_height - height structure
|
||||
// 5) uint32 - font flags
|
||||
|
||||
// TODO: See if font_height is needed in SET_SYSFONT_XXXX messages
|
||||
port_id replyport;
|
||||
msg.Read<port_id>(&replyport);
|
||||
replylink.SetSendPort(replyport);
|
||||
|
||||
fontserver->Lock();
|
||||
ServerFont *sf=fontserver->GetSystemPlain();
|
||||
if(sf)
|
||||
{
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<uint16>(sf->FamilyID());
|
||||
replylink.Attach<uint16>(sf->StyleID());
|
||||
replylink.Attach<float>(sf->Size());
|
||||
replylink.Attach<uint16>(sf->Face());
|
||||
replylink.Attach<uint32>(sf->Flags());
|
||||
replylink.Flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
}
|
||||
|
||||
fontserver->Unlock();
|
||||
|
||||
delete sf;
|
||||
break;
|
||||
}
|
||||
case AS_GET_FONT_HEIGHT:
|
||||
{
|
||||
// Attached Data:
|
||||
// 1) uint16 family ID
|
||||
// 2) uint16 style ID
|
||||
// 3) float size
|
||||
// 4) port_id reply port
|
||||
uint16 famid,styid;
|
||||
float ptsize;
|
||||
port_id replyport;
|
||||
|
||||
msg.Read<uint16>(&famid);
|
||||
msg.Read<uint16>(&styid);
|
||||
msg.Read<float>(&ptsize);
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
|
||||
fontserver->Lock();
|
||||
FontStyle *fstyle=fontserver->GetStyle(famid,styid);
|
||||
if(fstyle)
|
||||
{
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<font_height>(fstyle->GetHeight(ptsize));
|
||||
replylink.Flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
}
|
||||
|
||||
fontserver->Unlock();
|
||||
break;
|
||||
}
|
||||
case AS_SET_SYSFONT_BOLD:
|
||||
{
|
||||
// Attached Data:
|
||||
// None
|
||||
// port_id reply port
|
||||
|
||||
// Returns:
|
||||
// 1) uint16 - family ID
|
||||
// 2) uint16 - style ID
|
||||
// 3) float - size in points
|
||||
// 4) uint16 - face flags
|
||||
// 5) font_height - height structure
|
||||
// 5) uint32 - font flags
|
||||
|
||||
port_id replyport;
|
||||
msg.Read<port_id>(&replyport);
|
||||
replylink.SetSendPort(replyport);
|
||||
|
||||
fontserver->Lock();
|
||||
ServerFont *sf=fontserver->GetSystemBold();
|
||||
if(sf)
|
||||
{
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<uint16>(sf->FamilyID());
|
||||
replylink.Attach<uint16>(sf->StyleID());
|
||||
replylink.Attach<float>(sf->Size());
|
||||
replylink.Attach<uint16>(sf->Face());
|
||||
replylink.Attach<uint32>(sf->Flags());
|
||||
replylink.Flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
}
|
||||
|
||||
fontserver->Unlock();
|
||||
|
||||
delete sf;
|
||||
break;
|
||||
}
|
||||
case AS_SET_SYSFONT_FIXED:
|
||||
{
|
||||
// Attached Data:
|
||||
// None
|
||||
// port_id reply port
|
||||
|
||||
// Returns:
|
||||
// 1) uint16 - family ID
|
||||
// 2) uint16 - style ID
|
||||
// 3) float - size in points
|
||||
// 4) uint16 - face flags
|
||||
// 5) font_height - height structure
|
||||
// 5) uint32 - font flags
|
||||
|
||||
port_id replyport;
|
||||
msg.Read<port_id>(&replyport);
|
||||
replylink.SetSendPort(replyport);
|
||||
|
||||
fontserver->Lock();
|
||||
ServerFont *sf=fontserver->GetSystemFixed();
|
||||
if(sf)
|
||||
{
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<uint16>(sf->FamilyID());
|
||||
replylink.Attach<uint16>(sf->StyleID());
|
||||
replylink.Attach<float>(sf->Size());
|
||||
replylink.Attach<uint16>(sf->Face());
|
||||
replylink.Attach<uint32>(sf->Flags());
|
||||
replylink.Flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
}
|
||||
|
||||
fontserver->Unlock();
|
||||
|
||||
delete sf;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user