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
+1
View File
@@ -311,6 +311,7 @@ class Painter {
// font file, it uses the FontManager to locate a file // font file, it uses the FontManager to locate a file
// by Family and Style // by Family and Style
AGGTextRenderer* fTextRenderer; AGGTextRenderer* fTextRenderer;
uint32 fLastFamilyAndStyle;
}; };
// SetHighColor // SetHighColor
+1 -1
View File
@@ -79,7 +79,7 @@ public:
const char *GetPath(void) const { return fStyle->GetPath(); } const char *GetPath(void) const { return fStyle->GetPath(); }
uint16 StyleID(void) const { return fStyle->GetID(); } uint16 StyleID(void) const { return fStyle->GetID(); }
uint16 FamilyID(void) const { return fStyle->Family()->GetID(); } uint16 FamilyID(void) const { return fStyle->Family()->GetID(); }
uint32 GetFamilyAndStyle(void); uint32 GetFamilyAndStyle(void) const;
BRect BoundingBox(void); BRect BoundingBox(void);
void Height(font_height *fh); void Height(font_height *fh);
+1 -1
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 \brief Gets the ID values for the ServerFont instance in one shot
\return the combination of family and style ID numbers \return the combination of family and style ID numbers
*/ */
uint32 ServerFont::GetFamilyAndStyle(void) uint32 ServerFont::GetFamilyAndStyle(void) const
{ {
uint32 famsty=0; uint32 famsty=0;
+13 -5
View File
@@ -63,7 +63,8 @@ Painter::Painter()
fPenLocation(0.0, 0.0), fPenLocation(0.0, 0.0),
fPatternHandler(new PatternHandler()), fPatternHandler(new PatternHandler()),
fFont(be_plain_font), fFont(be_plain_font),
fTextRenderer(new AGGTextRenderer()) fTextRenderer(new AGGTextRenderer()),
fLastFamilyAndStyle(0)
{ {
_UpdateFont(); _UpdateFont();
_UpdateLineWidth(); _UpdateLineWidth();
@@ -277,7 +278,10 @@ Painter::SetFont(const ServerFont& font)
fFont.SetRotation(font.Rotation()); fFont.SetRotation(font.Rotation());
fFont.SetSize(font.Size()); fFont.SetSize(font.Size());
if (fLastFamilyAndStyle != font.GetFamilyAndStyle()) {
fLastFamilyAndStyle = font.GetFamilyAndStyle();
_UpdateFont(font.GetPath()); _UpdateFont(font.GetPath());
}
} }
// #pragma mark - // #pragma mark -
@@ -1034,20 +1038,24 @@ Painter::_RebuildClipping()
void void
Painter::_UpdateFont(const char* pathToFontFile) Painter::_UpdateFont(const char* pathToFontFile)
{ {
bool success = false;
if (pathToFontFile) { if (pathToFontFile) {
fTextRenderer->SetFont(pathToFontFile); success = fTextRenderer->SetFont(pathToFontFile);
if (!success)
fprintf(stderr, "unable to set '%s'\n", pathToFontFile);
} else { } else {
font_family family; font_family family;
font_style style; font_style style;
fFont.GetFamilyAndStyle(&family, &style); fFont.GetFamilyAndStyle(&family, &style);
bool success = fTextRenderer->SetFamilyAndStyle(family, style); success = fTextRenderer->SetFamilyAndStyle(family, style);
if (!success) { if (!success)
fprintf(stderr, "unable to set '%s' + '%s'\n", family, style); fprintf(stderr, "unable to set '%s' + '%s'\n", family, style);
}
if (!success) {
fprintf(stderr, "font is still: '%s' + '%s'\n", fprintf(stderr, "font is still: '%s' + '%s'\n",
fTextRenderer->Family(), fTextRenderer->Style()); fTextRenderer->Family(), fTextRenderer->Style());
} }
}
fTextRenderer->SetPointSize(fFont.Size()); fTextRenderer->SetPointSize(fFont.Size());
} }