ngl-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ngl-commits] changed the font rendering/management API [...]


From: Sebastien Metrot <address@hidden>
Subject: [ngl-commits] changed the font rendering/management API [...]
Date: Sat, 08 Nov 2003 23:36:24 -0500

Commit from meeloo 2003-11-08 23:36 EST
changed the font rendering/management API
fixed nuiWindow mouse move
Module File name Revision
nui ChangeLog 1.154 >>> 1.155
nui libnui.vcproj 1.37 >>> 1.38
nui examples/nuitest/nuiWin.cpp 1.92 >>> 1.93
nui include/nuiDrawContext.h 1.42 >>> 1.43
+ nui include/nuiFont.h 1.1
nui include/nuiMemoryDrawContext.h 1.22 >>> 1.23
nui include/nuiTheme.h 1.20 >>> 1.21
nui src/core/nuiContainer.cpp 1.36 >>> 1.37
nui src/core/nuiDrawContext.cpp 1.56 >>> 1.57
+ nui src/core/nuiFont.cpp 1.1
nui src/core/nuiImage.cpp 1.29 >>> 1.30
nui src/core/nuiMemoryDrawContext.cpp 1.36 >>> 1.37
nui src/core/nuiTheme.cpp 1.59 >>> 1.60
nui src/core/nuiTopLevel.cpp 1.4 >>> 1.5
nui src/core/nuiWidget.cpp 1.46 >>> 1.47
nui src/core/nuiWindow.cpp 1.53 >>> 1.54
nui src/core/nuiWindowManager.cpp 1.3 >>> 1.4
nui src/widgets/nuiEditText.cpp 1.75 >>> 1.76
nui src/widgets/nuiLabel.cpp 1.34 >>> 1.35

nui/ChangeLog   1.154 >>> 1.155
Line 1
+ 2003/11/9 05:34  meeloo
+ - Changed the text rendering API to a simpler and better one.
+ - fixed nuiWindow move.
+ - changed the way nuiTheme handles font information.
+
  2003/10/30 01:05  zerodeux
  - 'nix bugfixes
    * missing headers

nui/include/nuiDrawContext.h   1.42 >>> 1.43
Line 21
  #define __nuiDrawContext_h__
 
  #include "ngl.h"
- #include "nglFont1.h"
+ #include "nuiFont.h"
  #include "nuiRect.h"
  #include "nuiShape.h"
  #include "nuiWidget.h"
Line 41
  {
  public:
    nuiRenderState();
-   nuiRenderState(const nuiRenderState& rState);
+   nuiRenderState(const nuiRenderState& rState); ///< Copy constructor.
+   nuiRenderState& operator=(const nuiRenderState& rState); ///< Copy the given render state in this object.
    virtual ~nuiRenderState();
-   void GetGLState(); ///< Mirror the real current opengl state.
 
+   void GetGLState(); ///< Mirror the real current opengl state.
+   void Copy(const nuiRenderState& rState); ///< Copy the given render state in this object.
 
    // glEnable / glDisable cache
    bool mLighting;
Line 125
    nglVector2f mGradientPoint1;
    nglVector2f mGradientPoint2;
 
+   nuiColor mClearColor;
+   nuiColor mTextColor;
+   nuiFont* mpFont;
+
    bool mAntialiasedLines;
  };
 
Line 214
 
    bool SetBlendFunc(GLenum sfactor, GLenum dfactor);
 
-   bool IsTextureCurrent  ( nuiTexture* pTex , int num = 0);
-   nuiTexture* GetTextureCurrent ( int num = 0);
-   bool SetTextureCurrent ( nuiTexture* pTex , int num = 0);
+   bool IsCurrentTexture  ( nuiTexture* pTex , int num = 0);
+   nuiTexture* GetCurrentTexture ( int num = 0);
+   bool SetCurrentTexture ( nuiTexture* pTex , int num = 0);
 
    bool ActivateRenderState(const nuiRenderState& rState);
    bool ResetRenderState(); ///< Set the render state to OpenGL's default values.
Line 296
 
    /** @name Fonts and text handling: */
    //@{
-   virtual void SetFont(nuiTheme::FontStyle Style, nglFont1* pFont, bool Delete=true); ///< Changes the font used for the given style. If Delete==true the old one will be deleted.
-   virtual nglFont1* GetFont(nuiTheme::FontStyle Style); ///< Retreive the font used for the given style.
-   virtual bool GetFontInfo(nuiTheme::FontStyle FontStyle, nglFontInfo1& rFontInfo);
-   virtual int GetTextSize (nuiTheme::FontStyle FontStyle, float& rX, float& rY, const nglChar* pText); ///< Calculate the bounding of the string in texels and returns it in X & Y.
-   virtual int GetTextPos (nuiTheme::FontStyle FontStyle, float X, const nglChar* pText); ///< Calculate the bounding of the char pos in the given text where the pixel (X,?) lies and returns it.
+   virtual bool GetFontInfo(nglFontInfo1& rFontInfo);
 
-   virtual void SetTextColor(const nuiColor& rColor, nuiTheme::FontStyle Style = nuiTheme::Default);
-   virtual void DrawText(nuiSize x, nuiSize y, const nglString& rString, nuiTheme::FontStyle Style = nuiTheme::Default); /// Draw text at the given coordinates and the given font style.
+   virtual int GetTextSize (float& rX, float& rY, const nglChar* pText); ///< Calculate the bounding of the string in texels and returns it in X & Y.
+   virtual int GetTextPos (float X, const nglChar* pText); ///< Calculate the bounding of the char pos in the given text where the pixel (X,?) lies and returns it.
+   virtual bool SetCurrentFont ( nuiFont* pFont ); ///< Set the font that will be used by the subsequent calls to DrawText.
+   virtual bool SetCurrentFont ( nuiTheme::FontStyle Style = nuiTheme::Default); ///< Set the font that will be used by the subsequent calls to DrawText.
+   virtual nuiFont* GetCurrentFont(); ///< Retreive the current font.
+
+   virtual void SetTextColor(const nuiColor& rColor); 
+   virtual void DrawText(nuiSize x, nuiSize y, const nglString& rString); /// Draw text at the given coordinates and the current font.
    //@}
 
  protected:
Line 349
 
    uint mMaxLights;
    uint mMaxClipPlanes;
-
-   nuiColor mClearColor;
 
  #ifndef CALLBACK 
    #define CALLBACK 

nui/include/nuiFont.h   1.1
Line 0
+ /*
+   NUI - C++ cross-platform GUI framework for OpenGL based applications
+   Copyright (C) 2002-2003 Sébastien Métrot
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+ #ifndef __nuiFont_h__
+ #define __nuiFont_h__
+
+ #include "ngl.h"
+ #include "nglFont1.h"
+ #include "nuiRect.h"
+ #include "nuiObject.h"
+ #include "nuiRefCount.h"
+
+ #include <map>
+
+ /// This class implements a basic Font widget.
+ class nuiFont : public nglFont1, public nuiObject, public nuiRefCount
+ {
+ public:
+   // Constructors and destructors are protected!
+   //  static nuiFont* GetFont (nglIStream* pInput); ///< Create a font from an input stream.
+   static nuiFont* GetFont (const nglPath& rPath, nuiSize size); ///< Create a font from a path.
+   static nuiFont* GetFont (nuiXMLNode* pNode); ///< Create a font from an xml description.
+
+   static nglString GetUniqueID(const nglString& rFace, nuiSize size); ///< Get a text unique id for this font definition.
+
+   void Release();
+
+ protected:
+   //nuiFont (nglIStream* pInput); ///< Create a font from an input stream.
+   nuiFont (const nglPath& rPath, nuiSize size); ///< Create a font from a path.
+   nuiFont (nuiXMLNode* pNode); ///< Create a font from an xml description.
+   
+   virtual ~nuiFont();
+   friend class nuiDrawContext;
+   virtual bool Apply(nuiDrawContext* pContext); ///< Set this Font as the current opengl Font. 
+
+   static std::map<nglString,nuiFont*> mpFonts;
+ };
+
+ #endif // __nuiFont_h__
\  No newline at end of file

nui/include/nuiMemoryDrawContext.h   1.22 >>> 1.23
Line 66
 
    /** @name Fonts and text handling: */
    //@{
-   virtual void SetFont(nuiTheme::FontStyle Style, nglFont1* pFont, bool Delete=true); ///< Changes the font used for the given style. If Delete==true the old one will be deleted.
-   virtual nglFont1* GetFont(nuiTheme::FontStyle Style); ///< Retreive the font used for the given style.
-   virtual bool GetFontInfo(nuiTheme::FontStyle FontStyle, nglFontInfo1& rFontInfo);
-   virtual int GetTextSize (nuiTheme::FontStyle FontStyle, float& rX, float& rY, const nglChar* pText); ///< Calculate the bounding of the string in texels and returns it in X & Y.
-   virtual int GetTextPos (nuiTheme::FontStyle FontStyle, float X, const nglChar* pText); ///< Calculate the bounding of the char pos in the given text where the pixel (X,?) lies and returns it.
-
-   virtual void SetTextColor(const nuiColor& rColor, nuiTheme::FontStyle Style = nuiTheme::Default);
-   virtual void DrawText(nuiSize x, nuiSize y, const nglString& rString, nuiTheme::FontStyle Style = nuiTheme::Default); /// Draw text at the given coordinates and the given font style.
+   virtual void DrawText(nuiSize x, nuiSize y, const nglString& rString); /// Draw text at the given coordinates and the given font style.
    //@}
 
    bool SetTextureCurrent ( nuiTexture* pTex , int num = 0);
Line 103
  //  virtual void TesselateShape(nuiShape* pShape, nuiShapeMode Mode, ColorMode UseColors = eContextColors, TextureMode UseTexture = eNoTexture);
 
    std::stack<nglMatrixf> mMatrixStack;
-   std::map<nuiTheme::FontStyle,nuiColor> mFontColors;
-   nuiColor mFontColor;
 
    class Color
    {

nui/include/nuiTheme.h   1.20 >>> 1.21
Line 30
  class nuiButton;
  class nuiScrollBar;
 
- class nglFont1;
+ class nuiFont;
 
  enum nuiWidgetElement
  {
Line 105
    friend class nuiDrawContext;
    // Fonts and text handling:
    void SetFont(FontStyle Style, nglFont1* pFont, bool Delete=true); ///< Changes the font used for the given style. If Delete==true the old one will be deleted.
-   nglFont1* GetFont(FontStyle Style); ///< Retreive the font used for the given style.
-
-   virtual void SetTextColor(const nuiColor& rColor, FontStyle Style = Default);
-   virtual void DrawText(nuiSize x, nuiSize y, const nglString& rString, FontStyle Style = Default); /// Draw text at the given coordinates and the given font style.
+   nuiFont* GetFont(FontStyle Style); ///< Retreive the font used for the given style. You must release the font once you used it!!!
 
    void LoadDefaults(); ///< Load the default color & geometry values.
 
-   nglFont1* mpFonts[StyleCount];
+   nglString mFonts[StyleCount];
+   nuiFont*  mpFonts[StyleCount];
 
    nuiColor mTableColumnBG;
    nuiColor mSelectedTableColumnBG;
Line 122
    nuiColor mButtonFill[2][2];
 
    nuiColor mElementColors[eLastWidgetElement];
+
+   nglPath mPath;
  };
 
  #endif // __nuiTheme_h__



reply via email to

[Prev in Thread] Current Thread [Next in Thread]