diff --git a/components/nvidia-widgets/doc/compile.bat b/components/nvidia-widgets/doc/compile.bat index b8ca61a70..cc01ec17e 100644 --- a/components/nvidia-widgets/doc/compile.bat +++ b/components/nvidia-widgets/doc/compile.bat @@ -1,6 +1,6 @@ set path=%path%;H:\other\graphviz\bin -fpclasschart --input=../src/nvwidgets.pas --input=../src/gl/nvglwidgets.pas --input=../src/glut/nvglutwidgets.pas --input=../src/gl/nvshaderutils.pas --input=../src/gl/glfreetype.pas --input=../src/nvbasefont.pas --format=graphviz --output=nvwidgets.dot +fpclasschart --input=../src/nvwidgets.pas --input=../src/gl/nvglwidgets.pas --input=../src/glut/nvglutwidgets.pas --input=../src/gl/nvshaderutils.pas --input=../src/gl/glfreetype.pas --input=../src/nvbasefont.pas --input=../src/gl/glfreetypefont.pas --input=../src/glut/glutbitmapfont.pas --format=graphviz --output=nvwidgets.dot dot -Tpng nvwidgets.dot > ./images/nvwidgets.png @@ -10,7 +10,7 @@ del nvwidgets.dot del *.chm ::create chm documentation -fpdoc --package=nvidia-widgets --auto-index --auto-toc --make-searchable --footer-date="mmm dd yyyy" --descr=nvwidgets.xml --input=../src/nvwidgets.pas --descr=nvglwidgets.xml --input=../src/gl/nvglwidgets.pas --descr=nvglutwidgets.xml --input=../src/glut/nvglutwidgets.pas --descr=nvshaderutils.xml --input=../src/gl/nvshaderutils.pas --descr=glfreetype.xml --input=../src/gl/glfreetype.pas --descr=nvbasefont.xml --input=../src/nvbasefont.pas --css-file=fpdoc.css --image-url=images/ --format=chm --output=nvwidgets.chm +fpdoc --package=nvidia-widgets --auto-index --auto-toc --make-searchable --footer-date="mmm dd yyyy" --descr=nvwidgets.xml --input=../src/nvwidgets.pas --descr=nvglwidgets.xml --input=../src/gl/nvglwidgets.pas --descr=nvglutwidgets.xml --input=../src/glut/nvglutwidgets.pas --descr=nvshaderutils.xml --input=../src/gl/nvshaderutils.pas --descr=glfreetype.xml --input=../src/gl/glfreetype.pas --descr=nvbasefont.xml --input=../src/nvbasefont.pas --descr=glfreetypefont.xml --input=../src/gl/glfreetypefont.pas --descr=glutbitmapfont.xml --input=../src/glut/glutbitmapfont.pas --css-file=fpdoc.css --image-url=images/ --format=chm --output=nvwidgets.chm ::decompile the chm file (for debugging) ::del /Q /S html\* @@ -25,4 +25,4 @@ del /Q /S nvshaderutils\*.html ::create html documentation ::once documentation settles add --footer-date="mmm dd yyyy" -fpdoc --package=nvidia-widgets --descr=nvwidgets.xml --input=../src/nvwidgets.pas --descr=nvglwidgets.xml --input=../src/gl/nvglwidgets.pas --descr=nvglutwidgets.xml --input=../src/glut/nvglutwidgets.pas --descr=nvshaderutils.xml --input=../src/gl/nvshaderutils.pas --descr=glfreetype.xml --input=../src/gl/glfreetype.pas --descr=nvbasefont.xml --input=../src/nvbasefont.pas --image-url=images/ --format=html +fpdoc --package=nvidia-widgets --descr=nvwidgets.xml --input=../src/nvwidgets.pas --descr=nvglwidgets.xml --input=../src/gl/nvglwidgets.pas --descr=nvglutwidgets.xml --input=../src/glut/nvglutwidgets.pas --descr=nvshaderutils.xml --input=../src/gl/nvshaderutils.pas --descr=glfreetype.xml --input=../src/gl/glfreetype.pas --descr=nvbasefont.xml --input=../src/nvbasefont.pas --descr=glfreetypefont.xml --input=../src/gl/glfreetypefont.pas --descr=glutbitmapfont.xml --input=../src/glut/glutbitmapfont.pas --image-url=images/ --format=html diff --git a/components/nvidia-widgets/doc/glfreetype/index-4.html b/components/nvidia-widgets/doc/glfreetype/index-4.html index 6a40b814b..a2e6d6478 100644 --- a/components/nvidia-widgets/doc/glfreetype/index-4.html +++ b/components/nvidia-widgets/doc/glfreetype/index-4.html @@ -16,7 +16,7 @@

Reference for unit 'GLFreeType': Classes

- +

TGLFreeTypeFont

TGLFreeType

diff --git a/components/nvidia-widgets/doc/glfreetype/index-8.html b/components/nvidia-widgets/doc/glfreetype/index-8.html index 17505b583..07d51cb9b 100644 --- a/components/nvidia-widgets/doc/glfreetype/index-8.html +++ b/components/nvidia-widgets/doc/glfreetype/index-8.html @@ -22,7 +22,7 @@

T

- + diff --git a/components/nvidia-widgets/doc/glfreetypefont/index-3.html b/components/nvidia-widgets/doc/glfreetypefont/index-3.html new file mode 100644 index 000000000..81a8fefd0 --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/index-3.html @@ -0,0 +1,23 @@ + + + + +Reference for unit 'GLFreeTypeFont': Types + + + + +
TGLFreeTypeFontTGLFreeType
+ + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLFreeTypeFont' (#nvidia-widgets)
+

Reference for unit 'GLFreeTypeFont': Types

+ + + + +

TFontStyles

+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/index-4.html b/components/nvidia-widgets/doc/glfreetypefont/index-4.html new file mode 100644 index 000000000..a633488a8 --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/index-4.html @@ -0,0 +1,23 @@ + + + + +Reference for unit 'GLFreeTypeFont': Classes + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLFreeTypeFont' (#nvidia-widgets)
+

Reference for unit 'GLFreeTypeFont': Classes

+ + + + +

TGLFreeTypeFont

+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/index-8.html b/components/nvidia-widgets/doc/glfreetypefont/index-8.html new file mode 100644 index 000000000..c16ddc298 --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/index-8.html @@ -0,0 +1,31 @@ + + + + +Index of all identifiers in unit 'GLFreeTypeFont' + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLFreeTypeFont' (#nvidia-widgets)
+

Index of all identifiers in unit 'GLFreeTypeFont'

+ + + + +
T 
+

T

+ + + + + + +
TFontStylesTGLFreeTypeFont
+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/index.html b/components/nvidia-widgets/doc/glfreetypefont/index.html new file mode 100644 index 000000000..f5a0d907b --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/index.html @@ -0,0 +1,40 @@ + + + + +Reference for unit 'GLFreeTypeFont' + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLFreeTypeFont' (#nvidia-widgets)
+

Reference for unit 'GLFreeTypeFont'

+

+ + + + + + + + + + + + + + + + + + + + +

uses

  System,

  SysUtils,

  GLFreeType,

  

Free Type support for OpenGL

  nvBaseFont;

  

Generic font support class

+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/tfontstyles.html b/components/nvidia-widgets/doc/glfreetypefont/tfontstyles.html new file mode 100644 index 000000000..13e5bc72c --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/tfontstyles.html @@ -0,0 +1,47 @@ + + + + +TFontStyles + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLFreeTypeFont' (#nvidia-widgets)
+

TFontStyles

+

+

Declaration

+

Source position: glfreetypefont.pas line 12

+ + + + + + + + + + + + + + + + + + + + + + + + + +

type TFontStyles = record

  Name: ;

  Bold: Boolean;

  Italic: Boolean;

  StrikeTrough: Boolean;

  Underline: Boolean;

  Font: TGLFreeType;

end;

+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-1.html b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-1.html new file mode 100644 index 000000000..ce4cff3fd --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-1.html @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

TGLFreeTypeFont

 

TNVBaseFont

 

ro 

Name

 

ro 

Size

 

Angle

 

Bold

 

Italic

 

StrikeTrough

 

Underline

+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-2.html b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-2.html new file mode 100644 index 000000000..4f561637a --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-2.html @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

 

Angle (TNVBaseFont)

 

Bold (TNVBaseFont)

 

Italic (TNVBaseFont)

 

ro 

Name (TNVBaseFont)

 

ro 

Size (TNVBaseFont)

 

StrikeTrough (TNVBaseFont)

 

Underline (TNVBaseFont)

+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-3.html b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-3.html new file mode 100644 index 000000000..0eee7d501 --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-3.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

TGLFreeTypeFont

pt 

SetFlags

 

Create

 

Destroy

 

Add

 

TextHeight

 

TextWidth

 

TextOut

 

TNVBaseFont

pt 

SetAngle

pt 

SetFlags

 

Create

 

Add

 

TextHeight

 

TextWidth

 

TextSize

 

TextOut

+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-4.html b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-4.html new file mode 100644 index 000000000..7a673b88d --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-4.html @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

 

Add (TNVBaseFont)

 

Add (TGLFreeTypeFont)

 

Create (TNVBaseFont)

 

Create (TGLFreeTypeFont)

 

Destroy (TGLFreeTypeFont)

pt 

SetAngle (TNVBaseFont)

pt 

SetFlags (TNVBaseFont)

pt 

SetFlags (TGLFreeTypeFont)

 

TextHeight (TNVBaseFont)

 

TextHeight (TGLFreeTypeFont)

 

TextOut (TNVBaseFont)

 

TextOut (TGLFreeTypeFont)

 

TextSize (TNVBaseFont)

 

TextWidth (TNVBaseFont)

 

TextWidth (TGLFreeTypeFont)

+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-5.html b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-5.html new file mode 100644 index 000000000..1624e4191 --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-5.html @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + +

TGLFreeTypeFont

 

TNVBaseFont

+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-6.html b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-6.html new file mode 100644 index 000000000..629733c41 --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont-6.html @@ -0,0 +1,13 @@ + + + + + + + + + + +
+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont.destroy.html b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont.destroy.html new file mode 100644 index 000000000..60ecf40f3 --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont.destroy.html @@ -0,0 +1,26 @@ + + + + +TGLFreeTypeFont.Destroy + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLFreeTypeFont' (#nvidia-widgets)
+

TGLFreeTypeFont.Destroy

+

+

Declaration

+

Source position: glfreetypefont.pas line 33

+ + + + +

public destructor TGLFreeTypeFont.Destroy; override;

+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont.html b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont.html new file mode 100644 index 000000000..6335429b5 --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont.html @@ -0,0 +1,75 @@ + + + + +TGLFreeTypeFont + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLFreeTypeFont' (#nvidia-widgets)
+

TGLFreeTypeFont

+

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

+

+

Declaration

+

Source position: glfreetypefont.pas line 23

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

type TGLFreeTypeFont = class(TNVBaseFont)

protected

  procedure SetFlags(); override;

public

  constructor Create(); override;

  destructor Destroy; override;

  procedure Add(); override;

  function TextHeight(); override;

  function TextWidth(); override;

  procedure TextOut(); override;

end;

+

Inheritance

+ + + + + + + + + + + + + + + + +

TGLFreeTypeFont

|

TNVBaseFont

|

TObject

+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont.setflags.html b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont.setflags.html new file mode 100644 index 000000000..587f8cb23 --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont.setflags.html @@ -0,0 +1,35 @@ + + + + +TGLFreeTypeFont.SetFlags + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLFreeTypeFont' (#nvidia-widgets)
+

TGLFreeTypeFont.SetFlags

+

+

Declaration

+

Source position: glfreetypefont.pas line 30

+ + + + + + + + + + + + + +

protected procedure TGLFreeTypeFont.SetFlags(

  AIndex: Integer;

  AValue: Boolean

); override;

+ + diff --git a/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont.textout.html b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont.textout.html new file mode 100644 index 000000000..dcf2fb28c --- /dev/null +++ b/components/nvidia-widgets/doc/glfreetypefont/tglfreetypefont.textout.html @@ -0,0 +1,38 @@ + + + + +TGLFreeTypeFont.TextOut + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLFreeTypeFont' (#nvidia-widgets)
+

TGLFreeTypeFont.TextOut

+

+

Declaration

+

Source position: glfreetypefont.pas line 43

+ + + + + + + + + + + + + + + + +

public procedure TGLFreeTypeFont.TextOut(

  x: Double;

  y: Double;

  Text:

); override;

+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/index-3.html b/components/nvidia-widgets/doc/glutbitmapfont/index-3.html new file mode 100644 index 000000000..87287ccf3 --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/index-3.html @@ -0,0 +1,23 @@ + + + + +Reference for unit 'GLUTBitmapFont': Types + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLUTBitmapFont' (#nvidia-widgets)
+

Reference for unit 'GLUTBitmapFont': Types

+ + + + +

TFontStyles

+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/index-4.html b/components/nvidia-widgets/doc/glutbitmapfont/index-4.html new file mode 100644 index 000000000..ae1ac8e95 --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/index-4.html @@ -0,0 +1,23 @@ + + + + +Reference for unit 'GLUTBitmapFont': Classes + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLUTBitmapFont' (#nvidia-widgets)
+

Reference for unit 'GLUTBitmapFont': Classes

+ + + + +

TGLFreeTypeFont

+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/index-8.html b/components/nvidia-widgets/doc/glutbitmapfont/index-8.html new file mode 100644 index 000000000..850b95ec1 --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/index-8.html @@ -0,0 +1,31 @@ + + + + +Index of all identifiers in unit 'GLUTBitmapFont' + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLUTBitmapFont' (#nvidia-widgets)
+

Index of all identifiers in unit 'GLUTBitmapFont'

+ + + + +
T 
+

T

+ + + + + + +
TFontStylesTGLFreeTypeFont
+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/index.html b/components/nvidia-widgets/doc/glutbitmapfont/index.html new file mode 100644 index 000000000..e9c19492c --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/index.html @@ -0,0 +1,41 @@ + + + + +Reference for unit 'GLUTBitmapFont' + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLUTBitmapFont' (#nvidia-widgets)
+

Reference for unit 'GLUTBitmapFont'

+

GLUT bitmap font

+ + + + + + + + + + + + + + + + + + + + + +

uses

  System,

  Classes,

  SysUtils,

  GLut,

  nvBaseFont;

  

Generic font support class

+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/tfontstyles.html b/components/nvidia-widgets/doc/glutbitmapfont/tfontstyles.html new file mode 100644 index 000000000..2a93a0715 --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/tfontstyles.html @@ -0,0 +1,47 @@ + + + + +TFontStyles + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLUTBitmapFont' (#nvidia-widgets)
+

TFontStyles

+

+

Declaration

+

Source position: glutbitmapfont.pas line 11

+ + + + + + + + + + + + + + + + + + + + + + + + + +

type TFontStyles = record

  Name: ;

  Bold: Boolean;

  Italic: Boolean;

  StrikeTrough: Boolean;

  Underline: Boolean;

  Font: pointer;

end;

+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-1.html b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-1.html new file mode 100644 index 000000000..3a03136c5 --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-1.html @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

TGLFreeTypeFont

 

TNVBaseFont

 

ro 

Name

 

ro 

Size

 

Angle

 

Bold

 

Italic

 

StrikeTrough

 

Underline

+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-2.html b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-2.html new file mode 100644 index 000000000..4f561637a --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-2.html @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

 

Angle (TNVBaseFont)

 

Bold (TNVBaseFont)

 

Italic (TNVBaseFont)

 

ro 

Name (TNVBaseFont)

 

ro 

Size (TNVBaseFont)

 

StrikeTrough (TNVBaseFont)

 

Underline (TNVBaseFont)

+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-3.html b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-3.html new file mode 100644 index 000000000..85f65d06a --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-3.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

TGLFreeTypeFont

pt 

SetFlags

 

Create

 

Destroy

 

Add

 

TextHeight

 

TextWidth

 

TextOut

 

TNVBaseFont

pt 

SetAngle

pt 

SetFlags

 

Create

 

Add

 

TextHeight

 

TextWidth

 

TextSize

 

TextOut

+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-4.html b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-4.html new file mode 100644 index 000000000..c5d6fe620 --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-4.html @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

 

Add (TNVBaseFont)

 

Add (TGLFreeTypeFont)

 

Create (TNVBaseFont)

 

Create (TGLFreeTypeFont)

 

Destroy (TGLFreeTypeFont)

pt 

SetAngle (TNVBaseFont)

pt 

SetFlags (TNVBaseFont)

pt 

SetFlags (TGLFreeTypeFont)

 

TextHeight (TNVBaseFont)

 

TextHeight (TGLFreeTypeFont)

 

TextOut (TNVBaseFont)

 

TextOut (TGLFreeTypeFont)

 

TextSize (TNVBaseFont)

 

TextWidth (TNVBaseFont)

 

TextWidth (TGLFreeTypeFont)

+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-5.html b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-5.html new file mode 100644 index 000000000..a3ebec60c --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-5.html @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + +

TGLFreeTypeFont

 

TNVBaseFont

+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-6.html b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-6.html new file mode 100644 index 000000000..629733c41 --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont-6.html @@ -0,0 +1,13 @@ + + + + + + + + + + +
+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont.destroy.html b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont.destroy.html new file mode 100644 index 000000000..431c920b5 --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont.destroy.html @@ -0,0 +1,26 @@ + + + + +TGLFreeTypeFont.Destroy + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLUTBitmapFont' (#nvidia-widgets)
+

TGLFreeTypeFont.Destroy

+

+

Declaration

+

Source position: glutbitmapfont.pas line 32

+ + + + +

public destructor TGLFreeTypeFont.Destroy; override;

+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont.html b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont.html new file mode 100644 index 000000000..cb2b4fedf --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont.html @@ -0,0 +1,75 @@ + + + + +TGLFreeTypeFont + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLUTBitmapFont' (#nvidia-widgets)
+

TGLFreeTypeFont

+

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

+

+

Declaration

+

Source position: glutbitmapfont.pas line 22

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

type TGLFreeTypeFont = class(TNVBaseFont)

protected

  procedure SetFlags(); override;

public

  constructor Create(); override;

  destructor Destroy; override;

  procedure Add(); override;

  function TextHeight(); override;

  function TextWidth(); override;

  procedure TextOut(); override;

end;

+

Inheritance

+ + + + + + + + + + + + + + + + +

TGLFreeTypeFont

|

TNVBaseFont

|

TObject

+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont.setflags.html b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont.setflags.html new file mode 100644 index 000000000..d57fd02b7 --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont.setflags.html @@ -0,0 +1,35 @@ + + + + +TGLFreeTypeFont.SetFlags + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLUTBitmapFont' (#nvidia-widgets)
+

TGLFreeTypeFont.SetFlags

+

+

Declaration

+

Source position: glutbitmapfont.pas line 29

+ + + + + + + + + + + + + +

protected procedure TGLFreeTypeFont.SetFlags(

  AIndex: Integer;

  AValue: Boolean

); override;

+ + diff --git a/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont.textout.html b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont.textout.html new file mode 100644 index 000000000..1b60851cb --- /dev/null +++ b/components/nvidia-widgets/doc/glutbitmapfont/tglfreetypefont.textout.html @@ -0,0 +1,38 @@ + + + + +TGLFreeTypeFont.TextOut + + + + + + + + + +
[Overview][Types][Classes][Index]Reference for unit 'GLUTBitmapFont' (#nvidia-widgets)
+

TGLFreeTypeFont.TextOut

+

+

Declaration

+

Source position: glutbitmapfont.pas line 42

+ + + + + + + + + + + + + + + + +

public procedure TGLFreeTypeFont.TextOut(

  x: Double;

  y: Double;

  Text:

); override;

+ + diff --git a/components/nvidia-widgets/doc/images/nvwidgets.png b/components/nvidia-widgets/doc/images/nvwidgets.png index 04fc6eae7..5ec3ec76b 100644 Binary files a/components/nvidia-widgets/doc/images/nvwidgets.png and b/components/nvidia-widgets/doc/images/nvwidgets.png differ diff --git a/components/nvidia-widgets/doc/index-8.html b/components/nvidia-widgets/doc/index-8.html index 19868d354..6fce42270 100644 --- a/components/nvidia-widgets/doc/index-8.html +++ b/components/nvidia-widgets/doc/index-8.html @@ -89,11 +89,21 @@ + + + + + + + + + + - + @@ -137,16 +147,6 @@ - - - - - - - - - -
GLFreeTypeGroupFlags_GrowDownFromLeftGroupFlags_LayoutMask
GLFreeTypeFontGroupFlags_GrowDownFromRightGroupFlags_LayoutNoMargin
GLUIPainter GroupFlags_GrowLeftFromBottom GroupFlags_LayoutNone
GLUIPainterGLUTBitmapFont GroupFlags_GrowLeftFromTop GroupFlags_LayoutNoSpace
GroupFlags_LayoutHorizontal GroupFlags_StartXMask
GroupFlags_GrowDownFromLeftGroupFlags_LayoutMask
GroupFlags_GrowDownFromRightGroupFlags_LayoutNoMargin

K

@@ -242,9 +242,14 @@

T

- + + + + + + + -
TGLFreeTypeFontTFontStylesTGLFreeTypeTGLFreeTypeFont
TFontStylesTGLFreeTypeFont TNVBaseFont

U

diff --git a/components/nvidia-widgets/doc/index.html b/components/nvidia-widgets/doc/index.html index 53cae6b27..90f1d53a1 100644 --- a/components/nvidia-widgets/doc/index.html +++ b/components/nvidia-widgets/doc/index.html @@ -23,6 +23,14 @@

Free Type support for OpenGL

+

GLFreeTypeFont

+ + +

GLUTBitmapFont

+

  

+

GLUT bitmap font

+ +

nvBaseFont

  

Generic font support class

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont-3.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont-3.html index 99376c1ce..4eb330919 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont-3.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont-3.html @@ -18,6 +18,11 @@

SetAngle

+

pt 

+ +

SetFlags

+ +

 

Create

@@ -25,6 +30,11 @@

 

+

Add

+ + +

 

+

TextHeight

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont-4.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont-4.html index 5cb874b1d..86b773983 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont-4.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont-4.html @@ -11,6 +11,11 @@

 

+

Add (TNVBaseFont)

+ + +

 

+

Create (TNVBaseFont)

@@ -19,6 +24,11 @@

SetAngle (TNVBaseFont)

+

pt 

+

+

SetFlags (TNVBaseFont)

+ +

 

TextHeight (TNVBaseFont)

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.angle.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.angle.html index a9d330081..9f5d690fa 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.angle.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.angle.html @@ -16,7 +16,7 @@

TNVBaseFont.Angle

Declaration

-

Source position: nvbasefont.pas line 38

+

Source position: nvbasefont.pas line 42

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.bold.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.bold.html index e225f5f87..dec08c853 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.bold.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.bold.html @@ -16,7 +16,7 @@

TNVBaseFont.Bold

Declaration

-

Source position: nvbasefont.pas line 39

+

Source position: nvbasefont.pas line 43

public property TNVBaseFont.Angle: Double
  read FAngle
  write SetAngle;

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.create.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.create.html index e483c1786..42d4b7d2a 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.create.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.create.html @@ -14,9 +14,9 @@

public property TNVBaseFont.Bold: Boolean
  index 1
  read GetFlags
  write SetFlags;

TNVBaseFont.Create

-

+

Contructor for the base font class

Declaration

-

Source position: nvbasefont.pas line 26

+

Source position: nvbasefont.pas line 27

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.html index 37e77c51e..552f6243c 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.html @@ -26,28 +26,51 @@ + + + + + + + + + + + + + + + + + + + + + - + + + diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.italic.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.italic.html index 29c18dee0..0b2f54a52 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.italic.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.italic.html @@ -16,7 +16,7 @@

TNVBaseFont.Italic

Declaration

-

Source position: nvbasefont.pas line 40

+

Source position: nvbasefont.pas line 44

public constructor TNVBaseFont.Create(

protected

  FSize: Integer;

  procedure SetAngle(); virtual;

  procedure SetFlags(); virtual;

public

  constructor Create(); virtual;

  

Contructor for the base font class

  procedure Add(); virtual; abstract;

  

Method that allows to add multiple stylized fonts

  property Name: ; [r]

  

Font name

  property Size: Integer; [r]

  

Font size

  function TextHeight(); virtual; abstract;

  

Text height

  function TextWidth(); virtual; abstract;

  

Text width

  procedure TextSize(); virtual; abstract;

  procedure TextSize(); virtual;

  

Text size

  property Angle: Double; [rw]

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.name.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.name.html index 8f8a2d023..895cf5886 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.name.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.name.html @@ -14,9 +14,9 @@

public property TNVBaseFont.Italic: Boolean
  index 2
  read GetFlags
  write SetFlags;

TNVBaseFont.Name

-

+

Font name

Declaration

-

Source position: nvbasefont.pas line 29

+

Source position: nvbasefont.pas line 33

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.size.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.size.html index 38969fca1..6068043e3 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.size.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.size.html @@ -14,9 +14,9 @@

public property TNVBaseFont.Name:
  read FName;

TNVBaseFont.Size

-

+

Font size

Declaration

-

Source position: nvbasefont.pas line 30

+

Source position: nvbasefont.pas line 34

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.striketrough.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.striketrough.html index f2c5e0370..ada82df88 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.striketrough.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.striketrough.html @@ -16,7 +16,7 @@

TNVBaseFont.StrikeTrough

Declaration

-

Source position: nvbasefont.pas line 41

+

Source position: nvbasefont.pas line 45

public property TNVBaseFont.Size: Integer
  read FSize;

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textheight.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textheight.html index bbf266a11..31305ee11 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textheight.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textheight.html @@ -14,9 +14,9 @@

public property TNVBaseFont.StrikeTrough: Boolean
  index 3
  read GetFlags
  write SetFlags;

TNVBaseFont.TextHeight

-

+

Text height

Declaration

-

Source position: nvbasefont.pas line 33

+

Source position: nvbasefont.pas line 37

@@ -28,5 +28,7 @@

public function TNVBaseFont.TextHeight(

):Integer; virtual; abstract;

+

Description

+

Some fonts will only return the font size and not the actual text height

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textout.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textout.html index f13667149..b7fadd1f3 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textout.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textout.html @@ -16,7 +16,7 @@

TNVBaseFont.TextOut

Declaration

-

Source position: nvbasefont.pas line 45

+

Source position: nvbasefont.pas line 49

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textsize.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textsize.html index e305ce103..995d4fc21 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textsize.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textsize.html @@ -14,9 +14,9 @@

public procedure TNVBaseFont.TextOut(

TNVBaseFont.TextSize

-

+

Text size

Declaration

-

Source position: nvbasefont.pas line 35

+

Source position: nvbasefont.pas line 39

@@ -31,7 +31,7 @@ - +

public procedure TNVBaseFont.TextSize(

  var h: Integer

); virtual; abstract;

); virtual;

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textwidth.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textwidth.html index 78141db72..b8d66c347 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textwidth.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.textwidth.html @@ -14,9 +14,9 @@

TNVBaseFont.TextWidth

-

+

Text width

Declaration

-

Source position: nvbasefont.pas line 34

+

Source position: nvbasefont.pas line 38

diff --git a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.underline.html b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.underline.html index f598ee286..6fdf36c7f 100644 --- a/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.underline.html +++ b/components/nvidia-widgets/doc/nvbasefont/tnvbasefont.underline.html @@ -16,7 +16,7 @@

TNVBaseFont.Underline

Declaration

-

Source position: nvbasefont.pas line 42

+

Source position: nvbasefont.pas line 46

public function TNVBaseFont.TextWidth(

diff --git a/components/nvidia-widgets/doc/nvglwidgets/index.html b/components/nvidia-widgets/doc/nvglwidgets/index.html index 997c3bdce..2f5d1e78e 100644 --- a/components/nvidia-widgets/doc/nvglwidgets/index.html +++ b/components/nvidia-widgets/doc/nvglwidgets/index.html @@ -40,9 +40,7 @@ - - - +

public property TNVBaseFont.Underline: Boolean
  index 4
  read GetFlags
  write SetFlags;

  FPCanvas,

  GLFreeType;

  

Free Type support for OpenGL

  GLFreeTypeFont;

diff --git a/components/nvidia-widgets/doc/nvwidgets.chm b/components/nvidia-widgets/doc/nvwidgets.chm index b22155964..a20ec4c8a 100644 Binary files a/components/nvidia-widgets/doc/nvwidgets.chm and b/components/nvidia-widgets/doc/nvwidgets.chm differ diff --git a/components/nvidia-widgets/examples/widget_test.pp b/components/nvidia-widgets/examples/widget_test.pp index 6ed073c6c..44ca3ce64 100644 --- a/components/nvidia-widgets/examples/widget_test.pp +++ b/components/nvidia-widgets/examples/widget_test.pp @@ -5,7 +5,7 @@ program widget_test; uses Classes, SysUtils, GLut, GL, GLu, - nvWidgets, nvGlutWidgets; + nvWidgets, nvGLWidgets, nvBaseFont, nvGlutWidgets, GLFreeTypeFont; var ui: GlutUIContext; @@ -195,6 +195,8 @@ begin glutCreateWindow('UI example'); ui := GlutUIContext.Create; + ui.Painter := GLUIPainter.Create; + ui.Painter.Font := TGLFreeTypeFont.Create('Ubuntu-R.ttf', 10); if not ui.init(win_w, win_h) then begin diff --git a/components/nvidia-widgets/src/config.inc b/components/nvidia-widgets/src/config.inc index bb63c8616..5b6dd40bc 100644 --- a/components/nvidia-widgets/src/config.inc +++ b/components/nvidia-widgets/src/config.inc @@ -2,6 +2,7 @@ type //add more here NV_CONTEXT = (GLUT); NV_PAINTER = (GL); + NV_FONT = (GLFREETYPE, GLUTBITMAP); const NV_DEBUG = True; @@ -15,4 +16,7 @@ var NV_ACTIVE_CONTEXT: NV_CONTEXT = GLUT; //choose the painter - NV_ACTIVE_PAINTER: NV_PAINTER = GL; \ No newline at end of file + NV_ACTIVE_PAINTER: NV_PAINTER = GL; + + //choose the font + NV_ACTIVE_FONT: NV_FONT = GLFREETYPE; \ No newline at end of file diff --git a/components/nvidia-widgets/src/fpmake.pp b/components/nvidia-widgets/src/fpmake.pp index f46062d4f..efdd8a5db 100644 --- a/components/nvidia-widgets/src/fpmake.pp +++ b/components/nvidia-widgets/src/fpmake.pp @@ -35,6 +35,18 @@ begin write('package ', P.Name, ' configured for '); + //select font class + case NV_ACTIVE_FONT of + GLFREETYPE: begin + write('FreeType font '); + P.Targets.AddUnit('./gl/glfreetypefont.pas'); + end; + GLUTBITMAP: begin + write('GLUT font '); + P.Targets.AddUnit('./glut/glutbitmapfont.pas'); + end; + end; + //context units case NV_ACTIVE_CONTEXT of GLUT: begin diff --git a/components/nvidia-widgets/src/gl/glfreetype.pas b/components/nvidia-widgets/src/gl/glfreetype.pas index 563078998..b0955ffc3 100644 --- a/components/nvidia-widgets/src/gl/glfreetype.pas +++ b/components/nvidia-widgets/src/gl/glfreetype.pas @@ -17,25 +17,11 @@ uses //freetype font that we want to create. type - { TGLFreeTypeFont } + { TGLFreeType } - TGLFreeTypeFont = object //class(TNVBaseFont) + TGLFreeType = object textures: pGLuint; //< Holds the texture id's list_base: GLuint; //< Holds the first display list id -{ public - constructor Create(AName: string; ASize: integer); override; - - //text metrics - function TextHeight(Text: string): integer; override; - function TextWidth(Text: string): integer; override; - procedure TextSize(Text: string; var w, h: integer); override; - - //printing function - procedure TextOut(x, y: double; Text: string); override; -} - - - Height: cardinal; //< Holds the height of the font. //The init function will create a font of @@ -202,7 +188,7 @@ begin FT_Done_Glyph(glyph); end; -procedure TGLFreeTypeFont.Init(const fname: string; AHeight: cardinal); +procedure TGLFreeType.Init(const fname: string; AHeight: cardinal); var library_: PFT_Library = nil; face: PFT_Face = nil; //The object in which Freetype holds information on a given font is called a "face". @@ -247,7 +233,7 @@ begin FT_Done_FreeType(library_); end; -procedure TGLFreeTypeFont.Clean; +procedure TGLFreeType.Clean; begin glDeleteLists(list_base, CHAR_NUM); glDeleteTextures(CHAR_NUM, textures); @@ -282,7 +268,7 @@ end; //Much like Nehe's glPrint function, but modified to work //with freetype fonts. -procedure TGLFreeTypeFont.Print(x, y: double; Text: string); +procedure TGLFreeType.Print(x, y: double; Text: string); var font: GLuint; modelview_matrix: array [0..15] of double; @@ -327,7 +313,7 @@ begin pop_projection_matrix; end; -function TGLFreeTypeFont.TextWidth(const Text: string): integer; +function TGLFreeType.TextWidth(const Text: string): integer; var i: Integer; begin diff --git a/components/nvidia-widgets/src/gl/glfreetypefont.pas b/components/nvidia-widgets/src/gl/glfreetypefont.pas new file mode 100644 index 000000000..596d8b9ee --- /dev/null +++ b/components/nvidia-widgets/src/gl/glfreetypefont.pas @@ -0,0 +1,136 @@ +unit GLFreeTypeFont; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, GLFreeType, + nvBaseFont; + +type + TFontStyles = record + Name: string; + Bold: boolean; + Italic: boolean; + StrikeTrough: boolean; + Underline: boolean; + Font: TGLFreeType; + end; + + { TGLFreeTypeFont } + + TGLFreeTypeFont = class(TNVBaseFont) + private + FFontList: array of TFontStyles; + FCount: integer; + FActiveFont: integer; + procedure FindStylizedFont; + protected + procedure SetFlags(AIndex: integer; AValue: boolean); override; + public + constructor Create(AName: string; ASize: integer); override; + destructor Destroy; override; + + //add stylized fonts + procedure Add(AName: string; ABold, AItalic, AStrikeTrough, AUnderline: boolean); override; + + //text metrics + function TextHeight(Text: string): integer; override; + function TextWidth(Text: string): integer; override; + + //printing function + procedure TextOut(x, y: double; Text: string); override; + end; + +implementation + +{ TGLFreeTypeFont } + +procedure TGLFreeTypeFont.FindStylizedFont; +var + item: TFontStyles; + i: integer; +begin + //if more fonts defined then find stylized font + if FCount > 1 then + for i := 0 to FCount - 1 do + begin + item := FFontList[i]; + + if (item.Bold = Bold) and + (item.Italic = Italic) and + (item.StrikeTrough = StrikeTrough) and + (item.Underline = Underline) then + begin + FActiveFont := i; + exit; + end; + end; + + //no font found, select default one + FActiveFont := 0; +end; + +procedure TGLFreeTypeFont.SetFlags(AIndex: integer; AValue: boolean); +begin + inherited SetFlags(AIndex, AValue); + + FindStylizedFont; +end; + +constructor TGLFreeTypeFont.Create(AName: string; ASize: integer); +begin + inherited Create(AName, ASize); + + FCount := 0; + FSize := ASize; + Add(AName, False, False, False, False); +end; + +destructor TGLFreeTypeFont.Destroy; +var + i: integer; +begin + for i := 0 to FCount - 1 do + FFontList[i].Font.Clean; + + inherited Destroy; +end; + +procedure TGLFreeTypeFont.Add(AName: string; ABold, AItalic, AStrikeTrough, AUnderline: boolean); +begin + Inc(FCount); + SetLength(FFontList, FCount); + + with FFontList[FCount - 1] do + begin + Font.Init(AName, Size); + Name := AName; + Bold := ABold; + Italic := AItalic; + StrikeTrough := AStrikeTrough; + Underline := AUnderline; + end; + + FindStylizedFont; +end; + +function TGLFreeTypeFont.TextHeight(Text: string): integer; +begin + Result := Size; +end; + +function TGLFreeTypeFont.TextWidth(Text: string): integer; +begin + //only one font available or style not found then show default + Result := FFontList[FActiveFont].Font.TextWidth(Text); +end; + +procedure TGLFreeTypeFont.TextOut(x, y: double; Text: string); +begin + FFontList[FActiveFont].Font.Print(x, y, Text); +end; + +end. + diff --git a/components/nvidia-widgets/src/gl/nvglwidgets.pas b/components/nvidia-widgets/src/gl/nvglwidgets.pas index a26d666f6..15dfd1d5d 100644 --- a/components/nvidia-widgets/src/gl/nvglwidgets.pas +++ b/components/nvidia-widgets/src/gl/nvglwidgets.pas @@ -15,7 +15,7 @@ interface uses Classes, nvWidgets, - GL, ftFont, FPCanvas, GLFreeType; + GL, ftFont, FPCanvas; const cBase = 0; @@ -196,8 +196,6 @@ type procedure init; override; private - Font: TGLFreeTypeFont; - m_setupStateDL: integer; m_restoreStateDL: integer; m_foregroundDL: integer; @@ -256,13 +254,11 @@ begin m_texelScaleUniform := 0; m_texelOffsetUniform := 0; m_texelSwizzlingUniform := 0; - - Font.Init('Ubuntu-R.ttf', 10); end; destructor GLUIPainter.Destroy; begin - Font.Clean; + Font.Free; inherited Destroy; end; @@ -797,7 +793,7 @@ end; function GLUIPainter.getFontHeight: integer; begin - Result := Font.Height + 4; + Result := Font.TextHeight('X') + 4; end; function GLUIPainter.getTextLineWidth(const Text: string): integer; @@ -925,7 +921,7 @@ end; procedure GLUIPainter.drawString(x: integer; y: integer; Text: string; nbLines: integer); begin - Font.Print(x, y + 2, Text); + Font.TextOut(x, y + 2, Text); end; procedure GLUIPainter.drawRect(aRect: Rect; fillColorId: integer; borderColorId: integer); diff --git a/components/nvidia-widgets/src/glut/glutbitmapfont.pas b/components/nvidia-widgets/src/glut/glutbitmapfont.pas new file mode 100644 index 000000000..2fa981e77 --- /dev/null +++ b/components/nvidia-widgets/src/glut/glutbitmapfont.pas @@ -0,0 +1,135 @@ +unit GLUTBitmapFont; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, GLut, nvBaseFont; + +type + TFontStyles = record + Name: string; + Bold: boolean; + Italic: boolean; + StrikeTrough: boolean; + Underline: boolean; + Font: pointer; + end; + + { TGLUTFreeTypeFont } + + TGLUTFreeTypeFont = class(TNVBaseFont) + private + FFontList: array of TFontStyles; + FCount: integer; + FActiveFont: integer; + procedure FindStylizedFont; + protected + procedure SetFlags(AIndex: integer; AValue: boolean); override; + public + constructor Create(AName: string; ASize: integer); override; + destructor Destroy; override; + + //add stylized fonts + procedure Add(AName: string; ABold, AItalic, AStrikeTrough, AUnderline: boolean); override; + + //text metrics + function TextHeight(Text: string): integer; override; + function TextWidth(Text: string): integer; override; + + //printing function + procedure TextOut(x, y: double; Text: string); override; + end; + +implementation + +{ TGLUTFreeTypeFont } + +procedure TGLUTFreeTypeFont.FindStylizedFont; +var + item: TFontStyles; + i: integer; +begin + //if more fonts defined then find stylized font + if FCount > 1 then + for i := 0 to FCount - 1 do + begin + item := FFontList[i]; + + if (item.Bold = Bold) and + (item.Italic = Italic) and + (item.StrikeTrough = StrikeTrough) and + (item.Underline = Underline) then + begin + FActiveFont := i; + exit; + end; + end; + + //no font found, select default one + FActiveFont := 0; +end; + +procedure TGLUTFreeTypeFont.SetFlags(AIndex: integer; AValue: boolean); +begin + inherited SetFlags(AIndex, AValue); + + FindStylizedFont; +end; + +constructor TGLUTFreeTypeFont.Create(AName: string; ASize: integer); +begin + inherited Create(AName, ASize); + + FSize := ASize; + Add(AName, False, False, False, False); + FActiveFont := 0; +end; + +destructor TGLUTFreeTypeFont.Destroy; +var + i: integer; +begin + //for i := 0 to FCount - 1 do + // FFontList[i].Font.Clean; + + inherited Destroy; +end; + +procedure TGLUTFreeTypeFont.Add(AName: string; ABold, AItalic, AStrikeTrough, AUnderline: boolean); +begin + Inc(FCount); + SetLength(FFontList, FCount); + + with FFontList[FCount - 1] do + begin + //Font.Init(AName, Size); + Name := AName; + Bold := ABold; + Italic := AItalic; + StrikeTrough := AStrikeTrough; + Underline := AUnderline; + end; + + FindStylizedFont; +end; + +function TGLUTFreeTypeFont.TextHeight(Text: string): integer; +begin + Result := Size; +end; + +function TGLUTFreeTypeFont.TextWidth(Text: string): integer; +begin + //only one font available or style not found then show default + //Result := FFontList[FActiveFont].Font.TextWidth(Text) +end; + +procedure TGLUTFreeTypeFont.TextOut(x, y: double; Text: string); +begin + //FFontList[FActiveFont].Font.Print(x, y, Text); +end; + +end. + diff --git a/components/nvidia-widgets/src/glut/nvglutwidgets.pas b/components/nvidia-widgets/src/glut/nvglutwidgets.pas index f3c199a7d..c19571f28 100755 --- a/components/nvidia-widgets/src/glut/nvglutwidgets.pas +++ b/components/nvidia-widgets/src/glut/nvglutwidgets.pas @@ -28,27 +28,6 @@ type public - // - // Default UI constructor - // - // Creates private OpenGL painter - ////////////////////////////////////////////////////////////////// - constructor Create; - - // - // Alternate UI constructor - // - // Allows for overriding the standard painter - ////////////////////////////////////////////////////////////////// - constructor Create(painter: UIPainter); - - // - // UI destructor - // - // Destroy painter if it is private - ////////////////////////////////////////////////////////////////// - destructor Destroy; override; - // // One time initialization // @@ -72,47 +51,19 @@ type procedure specialKeyboard(k, x, y: integer); private - m_ownPainter: boolean; - // // Translate non-ascii keys from GLUT to nvWidgets ////////////////////////////////////////////////////////////////// function translateKey(k: integer): byte; - end; implementation uses - GLut, GLext, nvGLWidgets; + GLut, GLext; { GlutUIContext } -constructor GlutUIContext.Create; -begin - inherited Create(GLUIPainter.Create); - m_ownPainter := True; -end; - -constructor GlutUIContext.Create(painter: UIPainter); -begin - inherited Create(painter); - m_ownPainter := False; -end; - -destructor GlutUIContext.Destroy; -var - painter: UIPainter; -begin - if m_ownPainter then - begin - painter := getPainter; - FreeAndNil(painter); - end; - - inherited; -end; - function GlutUIContext.init(w, h: integer): boolean; begin Result := False; diff --git a/components/nvidia-widgets/src/nvbasefont.pas b/components/nvidia-widgets/src/nvbasefont.pas index e1d591c76..8841e7606 100644 --- a/components/nvidia-widgets/src/nvbasefont.pas +++ b/components/nvidia-widgets/src/nvbasefont.pas @@ -16,15 +16,19 @@ type FAngle: double; FFlags: word; FName: string; - FSize: integer; function GetFlags(AIndex: integer): boolean; - procedure SetFlags(AIndex: integer; AValue: boolean); protected + FSize: integer; + procedure SetAngle(AValue: double); virtual; + procedure SetFlags(AIndex: integer; AValue: boolean); virtual; public constructor Create(AName: string; ASize: integer); virtual; + //add stylized fonts + procedure Add(AName: string; ABold, AItalic, AStrikeTrough, AUnderline: boolean); virtual; abstract; + //font characteristics property Name: string read FName; property Size: integer read FSize; @@ -32,7 +36,7 @@ type //text metrics function TextHeight(Text: string): integer; virtual; abstract; function TextWidth(Text: string): integer; virtual; abstract; - procedure TextSize(Text: string; var w, h: integer); virtual; abstract; + procedure TextSize(Text: string; var w, h: integer); virtual; //font flags <> property Angle: double read FAngle write SetAngle; @@ -77,5 +81,11 @@ begin FSize := ASize; end; +procedure TNVBaseFont.TextSize(Text: string; var w, h: integer); +begin + w := TextWidth(Text); + h := TextHeight(Text); +end; + end. diff --git a/components/nvidia-widgets/src/nvwidgets.pas b/components/nvidia-widgets/src/nvwidgets.pas index cc7466ad6..67b7b5d2b 100644 --- a/components/nvidia-widgets/src/nvwidgets.pas +++ b/components/nvidia-widgets/src/nvwidgets.pas @@ -14,7 +14,7 @@ unit nvWidgets; interface uses - Classes, SysUtils; + Classes, SysUtils, nvBaseFont; type @@ -146,6 +146,9 @@ type // UIPainter UIPainter = class(TObject) + private + FFont: TnvBaseFont; + procedure SetFont(AValue: TnvBaseFont); public constructor Create; @@ -202,13 +205,16 @@ type procedure drawDebugRect(const r: Rect); virtual; abstract; procedure init; virtual; abstract; + published + property Font: TnvBaseFont read FFont write SetFont; end; { UIContext } UIContext = class(TObject) public - constructor Create(painter: UIPainter); + constructor Create; + destructor Destroy; override; // UI method for processing window size events ////////////////////////////////////////////////////////////////// @@ -376,18 +382,21 @@ type function window: Rect; private + FPainter: UIPainter; procedure setCursor(x: integer; y: integer); function overlap(const aRect: Rect; const p: Point): boolean; function hasFocus(const aRect: Rect): boolean; function isHover(const aRect: Rect): boolean; + procedure SetPainter(AValue: UIPainter); protected function placeRect(const r: Rect): Rect; - protected - m_painter: UIPainter; + published + property Painter: UIPainter read FPainter write SetPainter; + protected m_groupIndex: integer; m_groupStack: array [0..63] of Group; @@ -490,13 +499,20 @@ end; { UIContext } -constructor UIContext.Create(painter: UIPainter); +constructor UIContext.Create; begin - m_painter := painter; m_twoStepFocus := False; m_focusCaretPos := -1; end; +destructor UIContext.Destroy; +begin + if Assigned(Painter) then + Painter.Free; + + inherited Destroy; +end; + procedure UIContext.reshape(w, h: integer); begin m_window.x := 0; @@ -558,12 +574,12 @@ end; procedure UIContext._begin; begin - m_painter._begin(m_window); + Painter._begin(m_window); m_groupIndex := 0; m_groupStack[m_groupIndex].flags := GroupFlags_LayoutNone; - m_groupStack[m_groupIndex].margin := m_painter.getCanvasMargin; - m_groupStack[m_groupIndex].space := m_painter.getCanvasSpace; + m_groupStack[m_groupIndex].margin := Painter.getCanvasMargin; + m_groupStack[m_groupIndex].space := Painter.getCanvasSpace; m_groupStack[m_groupIndex].bounds := m_window; end; @@ -571,7 +587,7 @@ procedure UIContext._end; var i: integer; begin - m_painter._end; + Painter._end; // Release focus. if (m_mouseButton[0].state and ButtonFlags_End) > 0 then @@ -597,8 +613,8 @@ var nbLines: integer; aRect: Rect; begin - aRect := placeRect(m_painter.getLabelRect(r, Text, rt, nbLines)); - m_painter.drawLabel(aRect, Text, rt, nbLines, isHover(aRect), style); + aRect := placeRect(Painter.getLabelRect(r, Text, rt, nbLines)); + Painter.drawLabel(aRect, Text, rt, nbLines, isHover(aRect), style); end; function UIContext.doButton(const r: Rect; const Text: string; var state: boolean; style: integer): boolean; @@ -609,14 +625,14 @@ var hover: boolean; isDown: boolean; begin - aRect := placeRect(m_painter.getButtonRect(r, Text, rt)); + aRect := placeRect(Painter.getButtonRect(r, Text, rt)); focus := hasFocus(aRect); hover := isHover(aRect); isDown := state; //isDown := ((m_mouseButton[0].state and ButtonFlags_On)>0) and hover and focus; - m_painter.drawButton(aRect, Text, rt, isDown, hover, focus, style); + Painter.drawButton(aRect, Text, rt, isDown, hover, focus, style); if not focus then m_uiOnFocus := True; @@ -646,10 +662,10 @@ var focus: boolean; hover: boolean; begin - aRect := placeRect(m_painter.getCheckRect(r, Text, rt, rc)); + aRect := placeRect(Painter.getCheckRect(r, Text, rt, rc)); focus := hasFocus(aRect); hover := isHover(aRect); - m_painter.drawCheckButton(aRect, Text, rt, rc, state, hover, focus, style); + Painter.drawCheckButton(aRect, Text, rt, rc, state, hover, focus, style); if hasFocus(aRect) then m_uiOnFocus := True; @@ -672,10 +688,10 @@ var focus: boolean; hover: boolean; begin - aRect := placeRect(m_painter.getRadioRect(r, Text, rt, rr)); + aRect := placeRect(Painter.getRadioRect(r, Text, rt, rr)); focus := hasFocus(aRect); hover := isHover(aRect); - m_painter.drawRadioButton(aRect, Text, rt, rr, longbool(Value and EvalBool(reference = Value)), hover, focus, style); + Painter.drawRadioButton(aRect, Text, rt, rr, longbool(Value and EvalBool(reference = Value)), hover, focus, style); if focus then m_uiOnFocus := True; @@ -709,7 +725,7 @@ begin if f > 1 then f := 1; - rr := placeRect(m_painter.getHorizontalSliderRect(aRect, rs, f, rc)); + rr := placeRect(Painter.getHorizontalSliderRect(aRect, rs, f, rc)); if hasFocus(rr) then begin @@ -735,7 +751,7 @@ begin end; end; - m_painter.drawHorizontalSlider(rr, rs, f, rc, isHover(rr), style); + Painter.drawHorizontalSlider(rr, rs, f, rc, isHover(rr), style); Result := changed; end; @@ -745,8 +761,8 @@ var rt: Rect; r: Rect; begin - r := placeRect(m_painter.getItemRect(aRect, Text, rt)); - m_painter.drawListItem(r, Text, rt, longbool(selected and EvalBool(index = selected)), isHover(r), style); + r := placeRect(Painter.getItemRect(aRect, Text, rt)); + Painter.drawListItem(r, Text, rt, longbool(selected and EvalBool(index = selected)), isHover(r), style); Result := isHover(r); end; @@ -761,7 +777,7 @@ var hovered: integer = -1; lSelected: integer = -1; begin - rr := placeRect(m_painter.getListRect(aRect, numOptions, options, ri, rt)); + rr := placeRect(Painter.getListRect(aRect, numOptions, options, ri, rt)); focus := hasFocus(rr); hover := isHover(rr); @@ -771,7 +787,7 @@ begin if selected <> 0 then lSelected := selected; - m_painter.drawListBox(rr, numOptions, options, ri, rt, lSelected, hovered, style); + Painter.drawListBox(rr, numOptions, options, ri, rt, lSelected, hovered, style); if focus then m_uiOnFocus := True; @@ -800,7 +816,7 @@ var hoverOptions: boolean; begin // First get the rect of the combobox itself and do some test with it - rr := placeRect(m_painter.getComboRect(aRect, numOptions, options, selected, rt, ra)); + rr := placeRect(Painter.getComboRect(aRect, numOptions, options, selected, rt, ra)); focus := hasFocus(rr); hover := isHover(rr); @@ -809,7 +825,7 @@ begin m_uiOnFocus := True; // then if the combo box has focus, we can look for the geometry of the options frame - ro := m_painter.getComboOptionsRect(rr, numOptions, options, ri, rit); + ro := Painter.getComboOptionsRect(rr, numOptions, options, ri, rit); hovered := -1; hoverOptions := overlap(ro, m_currentCursor); @@ -817,10 +833,10 @@ begin hovered := numOptions - 1 - (m_currentCursor.y - (ro.y + ri.y)) div (ri.h); // draw combo anyway - m_painter.drawComboBox(rr, numOptions, options, rt, ra, selected, hover, focus, style); + Painter.drawComboBox(rr, numOptions, options, rt, ra, selected, hover, focus, style); // draw options - m_painter.drawComboOptions(ro, numOptions, options, ri, rit, selected, hovered, hover, focus, style); + Painter.drawComboOptions(ro, numOptions, options, ri, rit, selected, hovered, hover, focus, style); // When the widget get the focus, cache the focus point if not m_twoStepFocus then @@ -860,7 +876,7 @@ begin end; end else - m_painter.drawComboBox(rr, numOptions, options, rt, ra, selected, hover, focus, style); + Painter.drawComboBox(rr, numOptions, options, rt, ra, selected, hover, focus, style); Result := False; end; @@ -877,7 +893,7 @@ var nbKeys: integer; keyNb: integer; begin - rr := placeRect(m_painter.getLineEditRect(aRect, Text, rt)); + rr := placeRect(Painter.getLineEditRect(aRect, Text, rt)); focus := hasFocus(rr); hover := isHover(rr); @@ -910,7 +926,7 @@ begin // Eval caret pos on every click hover if hover and ((m_mouseButton[0].state and ButtonFlags_Begin) > 0) then - m_focusCaretPos := m_painter.getPickedCharNb(Text, SetPoint(m_currentCursor.x - rt.x - rr.x, m_currentCursor.y - rt.y - rr.y)); + m_focusCaretPos := Painter.getPickedCharNb(Text, SetPoint(m_currentCursor.x - rt.x - rr.x, m_currentCursor.y - rt.y - rr.y)); // If keys are buffered, apply input to the edited text if m_nbKeys <> 0 then @@ -993,7 +1009,7 @@ begin carretPos := m_focusCaretPos; end; - m_painter.drawLineEdit(rr, Text, rt, carretPos, focus, hover, style); + Painter.drawLineEdit(rr, Text, rt, carretPos, focus, hover, style); Result := _result; end; @@ -1036,8 +1052,8 @@ begin groupFlags := (groupFlags and GroupFlags_AlignXMask) or parentAlign; end; - newGroup^.margin := EvalBool((groupFlags and GroupFlags_LayoutNoMargin) = 0) * m_painter.getCanvasMargin; - newGroup^.space := EvalBool((groupFlags and GroupFlags_LayoutNoSpace) = 0) * m_painter.getCanvasSpace; + newGroup^.margin := EvalBool((groupFlags and GroupFlags_LayoutNoMargin) = 0) * Painter.getCanvasMargin; + newGroup^.space := EvalBool((groupFlags and GroupFlags_LayoutNoSpace) = 0) * Painter.getCanvasSpace; newGroup^.flags := groupFlags; //newLayout := groupFlags and GroupFlags_LayoutMask; @@ -1119,7 +1135,7 @@ begin parentGroup^.bounds.h := maxBoundY - minBoundY; end; - {$IFDEF DEBUG} m_painter.drawDebugRect(newGroup.bounds); {$ENDIF} + {$IFDEF DEBUG} Painter.drawDebugRect(newGroup.bounds); {$ENDIF} end; procedure UIContext.beginFrame(groupFlags: integer; const rect: Rect; style: integer); @@ -1130,7 +1146,7 @@ end; procedure UIContext.endFrame; begin endGroup; - m_painter.drawFrame(m_groupStack[m_groupIndex + 1].bounds, m_groupStack[m_groupIndex + 1].margin, 0); + Painter.drawFrame(m_groupStack[m_groupIndex + 1].bounds, m_groupStack[m_groupIndex + 1].margin, 0); end; function UIContext.beginPanel(var r: Rect; const Text: string; var isUnfold: boolean; groupFlags: integer; style: integer): boolean; @@ -1143,7 +1159,7 @@ var hover: boolean; tmp: Rect; begin - rpanel := m_painter.getPanelRect(SetRect(r.x, r.y), Text, rt, ra); + rpanel := Painter.getPanelRect(SetRect(r.x, r.y), Text, rt, ra); if (groupFlags and GroupFlags_LayoutDefault) > 0 then groupFlags := GroupFlags_LayoutDefaultFallback; @@ -1168,7 +1184,7 @@ begin if ((m_mouseButton[0].state and ButtonFlags_End) > 0) and focus and (overlap(SetRect(aRect.x + ra.x, aRect.y + ra.y, ra.w, ra.h), m_currentCursor)) then isUnfold := not isUnfold; - m_painter.drawPanel(aRect, Text, rt, ra, isUnfold, hover, focus, style); + Painter.drawPanel(aRect, Text, rt, ra, isUnfold, hover, focus, style); if isUnfold then begin @@ -1219,16 +1235,16 @@ var rt: Rect; rr: Rect; begin - rr := placeRect(m_painter.getTextureViewRect(aRect, rt)); + rr := placeRect(Painter.getTextureViewRect(aRect, rt)); if (zoomRect.w = 0) or (zoomRect.h = 0) then zoomRect.Rect(0, 0, rt.w, rt.h); - m_painter.drawTextureView(rr, texID, rt, zoomRect, mipLevel, texelScale, texelOffset, red, green, blue, alpha, style); + Painter.drawTextureView(rr, texID, rt, zoomRect, mipLevel, texelScale, texelOffset, red, green, blue, alpha, style); end; function UIContext.getPainter: UIPainter; begin - Result := m_painter; + Result := Painter; end; function UIContext.window: Rect; @@ -1264,6 +1280,14 @@ begin Result := overlap(aRect, m_currentCursor); end; +procedure UIContext.SetPainter(AValue: UIPainter); +begin + if FPainter=AValue then + exit; + + FPainter:=AValue; +end; + function UIContext.placeRect(const r: Rect): Rect; var aGroup: PGroup; @@ -1353,6 +1377,12 @@ end; { UIPainter } +procedure UIPainter.SetFont(AValue: TnvBaseFont); +begin + if FFont=AValue then Exit; + FFont:=AValue; +end; + constructor UIPainter.Create; begin inherited;