some improvements to font handling, but Miniterminal still renders only black blocks

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12148 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-03-29 23:42:52 +00:00
parent 507c1efe07
commit d01b623805
4 changed files with 20 additions and 11 deletions

View File

@ -311,6 +311,7 @@ class Painter {
// font file, it uses the FontManager to locate a file
// by Family and Style
AGGTextRenderer* fTextRenderer;
uint32 fLastFamilyAndStyle;
};
// SetHighColor

View File

@ -79,7 +79,7 @@ public:
const char *GetPath(void) const { return fStyle->GetPath(); }
uint16 StyleID(void) const { return fStyle->GetID(); }
uint16 FamilyID(void) const { return fStyle->Family()->GetID(); }
uint32 GetFamilyAndStyle(void);
uint32 GetFamilyAndStyle(void) const;
BRect BoundingBox(void);
void Height(font_height *fh);

View File

@ -213,7 +213,7 @@ status_t ServerFont::SetFamilyAndStyle(const uint32 &fontID)
\brief Gets the ID values for the ServerFont instance in one shot
\return the combination of family and style ID numbers
*/
uint32 ServerFont::GetFamilyAndStyle(void)
uint32 ServerFont::GetFamilyAndStyle(void) const
{
uint32 famsty=0;

View File

@ -63,7 +63,8 @@ Painter::Painter()
fPenLocation(0.0, 0.0),
fPatternHandler(new PatternHandler()),
fFont(be_plain_font),
fTextRenderer(new AGGTextRenderer())
fTextRenderer(new AGGTextRenderer()),
fLastFamilyAndStyle(0)
{
_UpdateFont();
_UpdateLineWidth();
@ -276,8 +277,11 @@ Painter::SetFont(const ServerFont& font)
fFont.SetShear(font.Shear());
fFont.SetRotation(font.Rotation());
fFont.SetSize(font.Size());
_UpdateFont(font.GetPath());
if (fLastFamilyAndStyle != font.GetFamilyAndStyle()) {
fLastFamilyAndStyle = font.GetFamilyAndStyle();
_UpdateFont(font.GetPath());
}
}
// #pragma mark -
@ -1034,19 +1038,23 @@ Painter::_RebuildClipping()
void
Painter::_UpdateFont(const char* pathToFontFile)
{
bool success = false;
if (pathToFontFile) {
fTextRenderer->SetFont(pathToFontFile);
success = fTextRenderer->SetFont(pathToFontFile);
if (!success)
fprintf(stderr, "unable to set '%s'\n", pathToFontFile);
} else {
font_family family;
font_style style;
fFont.GetFamilyAndStyle(&family, &style);
bool success = fTextRenderer->SetFamilyAndStyle(family, style);
if (!success) {
success = fTextRenderer->SetFamilyAndStyle(family, style);
if (!success)
fprintf(stderr, "unable to set '%s' + '%s'\n", family, style);
fprintf(stderr, "font is still: '%s' + '%s'\n",
fTextRenderer->Family(), fTextRenderer->Style());
}
}
if (!success) {
fprintf(stderr, "font is still: '%s' + '%s'\n",
fTextRenderer->Family(), fTextRenderer->Style());
}
fTextRenderer->SetPointSize(fFont.Size());