From 1218d80ff86345cecd42684594b8d0b72c9716ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Fri, 20 May 2005 19:54:12 +0000 Subject: [PATCH] removed no longer used stuff git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12746 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../Painter/font_support/TextRenderer.cpp | 278 ------------------ .../Painter/font_support/TextRenderer.h | 79 ----- .../FontManager.cpp | 0 .../FontManager.h | 0 4 files changed, 357 deletions(-) delete mode 100644 src/servers/app/drawing/Painter/font_support/TextRenderer.cpp delete mode 100644 src/servers/app/drawing/Painter/font_support/TextRenderer.h rename src/servers/app/drawing/{Painter/font_support => old_but_informative}/FontManager.cpp (100%) rename src/servers/app/drawing/{Painter/font_support => old_but_informative}/FontManager.h (100%) diff --git a/src/servers/app/drawing/Painter/font_support/TextRenderer.cpp b/src/servers/app/drawing/Painter/font_support/TextRenderer.cpp deleted file mode 100644 index d83c57268b..0000000000 --- a/src/servers/app/drawing/Painter/font_support/TextRenderer.cpp +++ /dev/null @@ -1,278 +0,0 @@ -// TextRenderer.cpp - -#include -#include - -#include -#include -#include - -#include "FontManager.h" - -#include "TextRenderer.h" - -#define MAXPTSIZE 5000 - -// constructor -TextRenderer::TextRenderer() - : fPtSize(12.0), - fHinted(true), - fAntialias(true), - fKerning(true), - fOpacity(255), - fAdvanceScale(1.0), - fLineSpacingScale(1.2) -{ - fFontFilePath[0] = 0; -} - -TextRenderer::TextRenderer(BMessage* archive) - : fPtSize(12.0), - fHinted(true), - fAntialias(true), - fKerning(true), - fOpacity(255), - fAdvanceScale(1.0), - fLineSpacingScale(1.2) -{ - // backwards compatibility crap - int32 size; - if (archive->FindInt32("size", &size) < B_OK) { - if (archive->FindFloat("size", &fPtSize) < B_OK) - fPtSize = 12.0; - } else { - fPtSize = size / 16.0; - } - - int32 opacity; - if (archive->FindInt32("gray levels", &opacity) < B_OK) - fOpacity = 255; - else - fOpacity = max_c(0, min_c(255, opacity)); - - if (archive->FindFloat("advance scale", &fAdvanceScale) < B_OK) - fAdvanceScale = 1.0; - - if (archive->FindFloat("line spacing scale", &fLineSpacingScale) < B_OK) - fLineSpacingScale = 1.2; - - fFontFilePath[0] = 0; - const char* family; - const char* style; - if (archive->FindString("family", &family) >= B_OK - && archive->FindString("style", &style) >= B_OK) { - FontManager* fm = FontManager::Default(); -//printf("locking font manager, %s, %s\n", family, style); - if (fm->Lock()) { -//printf("setting font: %s, %s\n", family, style); - SetFontRef(fm->FontFileFor(family, style)); - fm->Unlock(); - } - } else { -//printf("no family or style!\n"); - } -} - -// constructor -TextRenderer::TextRenderer(const TextRenderer& from) - : fPtSize(12.0), - fHinted(true), - fAntialias(true), - fKerning(true), - fOpacity(255), - fAdvanceScale(1.0), - fLineSpacingScale(1.2) -{ - fFontFilePath[0] = 0; - SetTo(&from); -} - -// destructor -TextRenderer::~TextRenderer() -{ - Unset(); -} - -// SetTo -void -TextRenderer::SetTo(const TextRenderer* other) -{ - Unset(); - - fFontFilePath[0] = 0; - - fPtSize = other->fPtSize; - fHinted = other->fHinted; - fAntialias = other->fAntialias; - fKerning = other->fKerning; - fOpacity = other->fOpacity; - fAdvanceScale = other->fAdvanceScale; - fLineSpacingScale = other->fLineSpacingScale; - - strcpy(fFontFilePath, other->fFontFilePath); - - Update(); -} - -// Archive -status_t -TextRenderer::Archive(BMessage* into, bool deep) const -{ - status_t status = BArchivable::Archive(into, deep); - - if (status >= B_OK) { - if (Family()) - status = into->AddString("family", Family()); - else - fprintf(stderr, "no font family to put into message!\n"); - if (status >= B_OK && Style()) - status = into->AddString("style", Style()); - else - fprintf(stderr, "no font style to put into message!\n"); - if (status >= B_OK) - status = into->AddFloat("size", fPtSize); - if (status >= B_OK) - status = into->AddInt32("gray levels", fOpacity); - if (status >= B_OK) - status = into->AddFloat("advance scale", fAdvanceScale); - if (status >= B_OK) - status = into->AddFloat("line spacing scale", fLineSpacingScale); - - // finish - if (status >= B_OK) - status = into->AddString("class", "TextRenderer"); - } - return status; -} - -// SetFontRef -bool -TextRenderer::SetFontRef(const entry_ref* ref) -{ - // TODO: Remove this, as we do font loading in FontServer - /*printf("TextRenderer::SetFontRef(%s)\n", ref ? ref->name : "no ref!"); - if (ref) { - BPath path(ref); - if (path.InitCheck() >= B_OK) - return SetFont(path.Path()); - return true; - }*/ - return false; -} - -// SetFont -bool -TextRenderer::SetFont(const ServerFont &font) -{ - sprintf(fFontFilePath, "%s", font.GetPath()); - return true; -} - -// Unset -void -TextRenderer::Unset() -{ - fFontFilePath[0] = 0; -} - -// SetFamilyAndStyle -bool -TextRenderer::SetFamilyAndStyle(const char* family, const char* style) -{ - FontManager* fm = FontManager::Default(); - if (fm->Lock()) { - const entry_ref* fontRef = fm->FontFileFor(family, style); - fm->Unlock(); - - return SetFontRef(fontRef); - } - return false; -} - -// SetPointSize -void -TextRenderer::SetPointSize(float size) -{ - if (size < 0.0) - size = 0.0; - if (size * 16.0 > MAXPTSIZE) - size = MAXPTSIZE / 16.0; - if (size != fPtSize) { - fPtSize = size; - Update(); - } -} - -// PointSize -float -TextRenderer::PointSize() const -{ - return fPtSize; -} - -// SetHinting -void -TextRenderer::SetHinting(bool hinting) -{ - fHinted = hinting; - Update(); -} - -// SetAntialiasing -void -TextRenderer::SetAntialiasing(bool antialiasing) -{ - fAntialias = antialiasing; - Update(); -} - -// SetOpacity -void -TextRenderer::SetOpacity(uint8 opacity) -{ - fOpacity = opacity; -} - -// Opacity -uint8 -TextRenderer::Opacity() const -{ - return fOpacity; -} - -// SetAdvanceScale -void -TextRenderer::SetAdvanceScale(float scale) -{ - fAdvanceScale = scale; - Update(); -} - -// AdvanceScale -float -TextRenderer::AdvanceScale() const -{ - return fAdvanceScale; -} - -// SetLineSpacingScale -void -TextRenderer::SetLineSpacingScale(float scale) -{ - fLineSpacingScale = scale; - Update(); -} - -// LineSpacingScale -float -TextRenderer::LineSpacingScale() const -{ - return fLineSpacingScale; -} - -// LineOffset -float -TextRenderer::LineOffset() const -{ - return fLineSpacingScale * fPtSize * 16.0; -} diff --git a/src/servers/app/drawing/Painter/font_support/TextRenderer.h b/src/servers/app/drawing/Painter/font_support/TextRenderer.h deleted file mode 100644 index 18ccaab693..0000000000 --- a/src/servers/app/drawing/Painter/font_support/TextRenderer.h +++ /dev/null @@ -1,79 +0,0 @@ -// TextRenderer.h - -#ifndef TEXT_RENDERER_H -#define TEXT_RENDERER_H - -#include "Transformable.h" - -struct entry_ref; - -class BBitmap; -class ServerFont; - -class TextRenderer : public BArchivable { - public: - TextRenderer(); - TextRenderer(BMessage* archive); - TextRenderer(const TextRenderer& from); - virtual ~TextRenderer(); - - virtual void SetTo(const TextRenderer* other); - - virtual status_t Archive(BMessage* into, bool deep = true) const; - - bool SetFontRef(const entry_ref* ref); - virtual bool SetFont(const ServerFont &font); - virtual void Unset(); - - bool SetFamilyAndStyle(const char* family, - const char* style); - virtual const char* Family() const = 0; - virtual const char* Style() const = 0; - virtual const char* PostScriptName() const = 0; - - virtual void SetPointSize(float size); - float PointSize() const; - - virtual void SetHinting(bool hinting); - bool Hinting() const - { return fHinted; } - - virtual void SetAntialiasing(bool antialiasing); - bool Antialiasing() const - { return fAntialias; } - - virtual void SetOpacity(uint8 opacity); - uint8 Opacity() const; - - virtual void SetAdvanceScale(float scale); - float AdvanceScale() const; - - virtual void SetLineSpacingScale(float scale); - float LineSpacingScale() const; - - float LineOffset() const; - -/* virtual void RenderString(const char* utf8String, - BBitmap* bitmap, - BRect constrainRect, - const Transformable& transform) = 0; - - virtual BRect Bounds(const char* utf8String, uint32 length, - const Transformable& transform) = 0;*/ - - virtual void Update() {}; - - protected: - char fFontFilePath[B_PATH_NAME_LENGTH]; - - float fPtSize; - - bool fHinted; // is glyph hinting active? - bool fAntialias; // is anti-aliasing active? - bool fKerning; - uint8 fOpacity; - float fAdvanceScale; - float fLineSpacingScale; -}; - -#endif // FT_TEXT_RENDER_H diff --git a/src/servers/app/drawing/Painter/font_support/FontManager.cpp b/src/servers/app/drawing/old_but_informative/FontManager.cpp similarity index 100% rename from src/servers/app/drawing/Painter/font_support/FontManager.cpp rename to src/servers/app/drawing/old_but_informative/FontManager.cpp diff --git a/src/servers/app/drawing/Painter/font_support/FontManager.h b/src/servers/app/drawing/old_but_informative/FontManager.h similarity index 100% rename from src/servers/app/drawing/Painter/font_support/FontManager.h rename to src/servers/app/drawing/old_but_informative/FontManager.h